r73593 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73592‎ | r73593 | r73594 >
Date:06:18, 23 September 2010
Author:werdna
Status:reverted (Comments)
Tags:
Comment:
Replace $ with $j in ajaxwatch.js, was causing fatal JS errors on pages for me. (resourceloader-related issue?)
Modified paths:
  • /trunk/phase3/skins/common/ajaxwatch.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/ajaxwatch.js
@@ -28,7 +28,7 @@
2929
3030 wgAjaxWatch.processResult = function( response ) {
3131 response = response.watch;
32 - var $link = $( this );
 32+ var $link = $j( this );
3333 // To ensure we set the same status for all watch links with the
3434 // same target we trigger a custom event on *all* watch links.
3535 if( response.watched !== undefined ) {
@@ -46,23 +46,23 @@
4747 // Bug 12395 - update the watch checkbox on edit pages when the
4848 // page is watched or unwatched via the tab.
4949 if( response.watched !== undefined ) {
50 - $( '#wpWatchthis' ).attr( 'checked', '1' );
 50+ $j( '#wpWatchthis' ).attr( 'checked', '1' );
5151 } else {
52 - $( '#wpWatchthis' ).removeAttr( 'checked' );
 52+ $j( '#wpWatchthis' ).removeAttr( 'checked' );
5353 }
5454 };
5555
56 -$( document ).ready( function() {
57 - var $links = $( '.mw-watchlink a, a.mw-watchlink' );
 56+$j( document ).ready( function() {
 57+ var $links = $j( '.mw-watchlink a, a.mw-watchlink' );
5858 // BC with older skins
5959 $links = $links
60 - .add( $( '#ca-watch a, #ca-unwatch a, a#mw-unwatch-link1' ) )
61 - .add( $( 'a#mw-unwatch-link2, a#mw-watch-link2, a#mw-watch-link1' ) );
 60+ .add( $j( '#ca-watch a, #ca-unwatch a, a#mw-unwatch-link1' ) )
 61+ .add( $j( 'a#mw-unwatch-link2, a#mw-watch-link2, a#mw-watch-link1' ) );
6262 // allowing people to add inline animated links is a little scary
6363 $links = $links.filter( ':not( #bodyContent *, #content * )' );
6464
6565 $links.each( function() {
66 - var $link = $( this );
 66+ var $link = $j( this );
6767 $link
6868 .data( 'icon', $link.parents( 'li' ).hasClass( 'icon' ) )
6969 .data( 'action', $link.attr( 'href' ).match( /[\?\&]action=unwatch/i ) ? 'unwatch' : 'watch' );
@@ -71,7 +71,7 @@
7272 });
7373
7474 $links.click( function( event ) {
75 - var $link = $( this );
 75+ var $link = $j( this );
7676
7777 if( wgAjaxWatch.supported === false || !wgEnableWriteAPI || !wfSupportsAjax() ) {
7878 // Lazy initialization so we don't toss up
@@ -82,7 +82,7 @@
8383 }
8484
8585 wgAjaxWatch.setLinkText( $link, $link.data( 'action' ) + 'ing' );
86 - $.get( wgScriptPath
 86+ $j.get( wgScriptPath
8787 + '/api' + wgScriptExtension + '?action=watch&format=json&title='
8888 + encodeURIComponent( $link.data( 'target' ) )
8989 + ( $link.data( 'action' ) == 'unwatch' ? '&unwatch' : '' ),
@@ -97,7 +97,7 @@
9898 // When a request returns, a custom event 'mw-ajaxwatch' is triggered
9999 // on *all* watch links, so they can be updated if necessary
100100 $links.bind( 'mw-ajaxwatch', function( event, target, action ) {
101 - var $link = $( this );
 101+ var $link = $j( this );
102102 var foo = $link.data( 'target' );
103103 if( $link.data( 'target' ) == target ) {
104104 var otheraction = action == 'watch'

Follow-up revisions

RevisionCommit summaryAuthorDate
r75243Revert r73593, root cause has long been fixedcatrope14:53, 23 October 2010

Comments

#Comment by Catrope (talk | contribs)   14:27, 23 September 2010

This shouldn't be needed. $j and $ should both be defined by the resource loader and should both be aliases for jQuery. If this doesn't work for you then obviously something is wrong, but this isn't the solution.

#Comment by Nikerabbit (talk | contribs)   18:54, 23 September 2010

Can this be reverted now that r73605 should fix the issue?

#Comment by Catrope (talk | contribs)   18:55, 23 September 2010

If that does indeed fix this issue, yes. This revision should be reverted once the real problem has been fixed, per my first comment.

Status & tagging log