Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.js |
— | — | @@ -1,9 +1,8 @@ |
2 | 2 | /* |
3 | 3 | * Script for Article Feedback Extension |
4 | 4 | */ |
| 5 | +( function( $ ) { |
5 | 6 | |
6 | | -( function( $, mw ) { |
7 | | - |
8 | 7 | // Only track users who have been assigned to the tracking group |
9 | 8 | var tracked = 'track' === mw.user.bucket( |
10 | 9 | 'ext.articleFeedback-tracking', mw.config.get( 'wgArticleFeedbackTracking' ) |
— | — | @@ -42,13 +41,13 @@ |
43 | 42 | |
44 | 43 | function trackClick( id ) { |
45 | 44 | // Track the click so we can figure out how useful this is |
46 | | - if ( tracked && typeof $.trackActionWithInfo == 'function' ) { |
47 | | - $.trackActionWithInfo( prefix( id ), mediaWiki.config.get( 'wgTitle' ) ) |
| 45 | + if ( tracked && $.isFunction( $.trackActionWithInfo ) ) { |
| 46 | + $.trackActionWithInfo( prefix( id ), mw.config.get( 'wgTitle' ) ) |
48 | 47 | } |
49 | 48 | } |
50 | 49 | |
51 | 50 | function trackClickURL( url, id ) { |
52 | | - if ( tracked && typeof $.trackActionURL == 'function' ) { |
| 51 | + if ( tracked && $.isFunction( $.trackActionURL ) ) { |
53 | 52 | return $.trackActionURL( url, prefix( id ) ); |
54 | 53 | } else { |
55 | 54 | return url; |
— | — | @@ -61,7 +60,7 @@ |
62 | 61 | * This object makes use of Special:SimpleSurvey, and uses some nasty hacks - this needs to be |
63 | 62 | * replaced with something much better in the future. |
64 | 63 | */ |
65 | | -var survey = new ( function( mw ) { |
| 64 | +var survey = new ( function() { |
66 | 65 | |
67 | 66 | /* Private Members */ |
68 | 67 | |
— | — | @@ -193,7 +192,7 @@ |
194 | 193 | .appendTo( $dialog ); |
195 | 194 | $dialog.dialog( 'option', 'height', $message.height() + 100 ) |
196 | 195 | }; |
197 | | -} )( mediaWiki ); |
| 196 | +} )(); |
198 | 197 | |
199 | 198 | var config = { |
200 | 199 | 'ratings': { |
— | — | @@ -238,7 +237,7 @@ |
239 | 238 | }, |
240 | 239 | 'join': { |
241 | 240 | 'condition': function() { |
242 | | - return isPitchVisible( 'join' ) && mediaWiki.user.anonymous(); |
| 241 | + return isPitchVisible( 'join' ) && mw.user.anonymous(); |
243 | 242 | }, |
244 | 243 | 'action': function() { |
245 | 244 | // Mute for 1 day |
— | — | @@ -246,10 +245,10 @@ |
247 | 246 | // Go to account creation page |
248 | 247 | // Track the click through an API redirect |
249 | 248 | window.location = trackClickURL( |
250 | | - mediaWiki.config.get( 'wgScript' ) + '?' + $.param( { |
| 249 | + mw.config.get( 'wgScript' ) + '?' + $.param( { |
251 | 250 | 'title': 'Special:UserLogin', |
252 | 251 | 'type': 'signup', |
253 | | - 'returnto': mediaWiki.config.get( 'wgPageName' ) |
| 252 | + 'returnto': mw.config.get( 'wgPageName' ) |
254 | 253 | } ), 'pitch-signup-accept' ); |
255 | 254 | return false; |
256 | 255 | }, |
— | — | @@ -266,9 +265,9 @@ |
267 | 266 | // Go to login page |
268 | 267 | // Track the click through an API redirect |
269 | 268 | window.location = trackClickURL( |
270 | | - mediaWiki.config.get( 'wgScript' ) + '?' + $.param( { |
| 269 | + mw.config.get( 'wgScript' ) + '?' + $.param( { |
271 | 270 | 'title': 'Special:UserLogin', |
272 | | - 'returnto': mediaWiki.config.get( 'wgPageName' ) |
| 271 | + 'returnto': mw.config.get( 'wgPageName' ) |
273 | 272 | } ), 'pitch-join-accept' ); |
274 | 273 | return false; |
275 | 274 | } |
— | — | @@ -276,9 +275,9 @@ |
277 | 276 | 'edit': { |
278 | 277 | 'condition': function() { |
279 | 278 | // An empty restrictions array means anyone can edit |
280 | | - var restrictions = mediaWiki.config.get( 'wgRestrictionEdit' ); |
| 279 | + var restrictions = mw.config.get( 'wgRestrictionEdit' ); |
281 | 280 | if ( restrictions.length ) { |
282 | | - var groups = mediaWiki.config.get( 'wgUserGroups' ); |
| 281 | + var groups = mw.config.get( 'wgUserGroups' ); |
283 | 282 | // Verify that each restriction exists in the user's groups |
284 | 283 | for ( var i = 0; i < restrictions.length; i++ ) { |
285 | 284 | if ( !$.inArray( restrictions[i], groups ) ) { |
— | — | @@ -294,8 +293,8 @@ |
295 | 294 | // Go to edit page |
296 | 295 | // Track the click through an API redirect |
297 | 296 | window.location = trackClickURL( |
298 | | - mediaWiki.config.get( 'wgScript' ) + '?' + $.param( { |
299 | | - 'title': mediaWiki.config.get( 'wgPageName' ), |
| 297 | + mw.config.get( 'wgScript' ) + '?' + $.param( { |
| 298 | + 'title': mw.config.get( 'wgPageName' ), |
300 | 299 | 'action': 'edit', |
301 | 300 | 'clicktrackingsession': $.cookie( 'clicktracking-session' ), |
302 | 301 | 'clicktrackingevent': prefix( 'pitch-edit-save' ) |
— | — | @@ -311,13 +310,12 @@ |
312 | 311 | } |
313 | 312 | }; |
314 | 313 | |
315 | | -/* Load at the bottom of the article */ |
316 | | -$( '#catlinks' ).before( $( '<div id="mw-articlefeedback"></div>' ).articleFeedback( config ) ); |
| 314 | +/* Load at the bottom of the article |
| 315 | +$( '<div id="mw-articlefeedback"></div>' );.articleFeedback( config ).insertBefore( '#catlinks' );*/ |
317 | 316 | |
318 | | -/* Add link so users can navigate to the feedback tool from the toolbox */ |
319 | | -$( '#p-tb ul' ) |
320 | | - .append( '<li id="t-articlefeedback"><a href="#mw-articlefeedback"></a></li>' ) |
321 | | - .find( '#t-articlefeedback a' ) |
| 317 | +/* Add link so users can navigate to the feedback tool from the toolbox |
| 318 | +var $tbAft = $( '<li id="t-articlefeedback"><a href="#mw-articlefeedback"></a></li>') |
| 319 | + .find( 'a' ) |
322 | 320 | .text( mw.msg( 'articlefeedback-form-switch-label' ) ) |
323 | 321 | .click( function() { |
324 | 322 | // Click tracking |
— | — | @@ -336,7 +334,8 @@ |
337 | 335 | clearInterval( interval ); |
338 | 336 | } |
339 | 337 | }, 200 ); |
340 | | - return true; |
341 | | - } ); |
342 | | - |
343 | | -} )( jQuery, mediaWiki ); |
| 338 | + } ) |
| 339 | + .end(); |
| 340 | +$( '#p-tb' ).find( 'ul' ).append( $tbAft ); |
| 341 | + */ |
| 342 | +} )( jQuery ); |
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.startup.js |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | * Script for Article Feedback Extension |
4 | 4 | */ |
5 | 5 | |
6 | | -jQuery(document).ready( function( $ ) { |
| 6 | +jQuery( function( $ ) { |
7 | 7 | if ( |
8 | 8 | // Main namespace articles |
9 | 9 | mw.config.get( 'wgNamespaceNumber' ) === 0 |