r111013 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111012‎ | r111013 | r111014 >
Date:01:24, 9 February 2012
Author:werdna
Status:resolved (Comments)
Tags:acw-deploy 
Comment:
Apply changes per CR r111001: direct comparisons with undefined, Error instead of $.error, and use mw.util.wikiScript
Modified paths:
  • /trunk/extensions/ClickTracking/modules/jquery.clickTracking.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ClickTracking/modules/jquery.clickTracking.js
@@ -21,7 +21,7 @@
2222 }
2323 /**
2424 * Performs click tracking API call
25 - *
 25+ *
2626 * @param {string} id event identifier
2727 */
2828 $.trackAction = function( id ) {
@@ -49,8 +49,7 @@
5050 }, options);
5151
5252 if ( ! options.id ) {
53 - $.error("You must specify an event ID");
54 - return;
 53+ throw new Error("You must specify an event ID");
5554 }
5655
5756 var data = {
@@ -60,15 +59,15 @@
6160 'token': options.token
6261 };
6362
64 - if ( typeof options.namespace != 'undefined' ) {
 63+ if ( options.namespace === undefined ) {
6564 data.namespacenumber = options.namespace;
6665 }
6766
68 - if ( typeof options.info != 'undefined' ) {
 67+ if ( options.info === undefined ) {
6968 data.additional = options.info;
7069 }
7170
72 - $.post( mw.config.get( 'wgScriptPath' ) + '/api.php', data);
 71+ $.post( mw.util.wikiScript( 'api' ), data);
7372 };
7473
7574 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r111016Fix silliness :)werdna01:31, 9 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r111001ClickTracking: Refactor into a single method, allow overriding the namespacewerdna01:05, 9 February 2012

Comments

#Comment by Catrope (talk | contribs)   01:26, 9 February 2012
-		if ( typeof options.info != 'undefined' ) {
+		if ( options.info === undefined ) {

You're inverting the logic there, pretty sure that's wrong.

OK otherwise.

Status & tagging log