Index: trunk/extensions/ArticleFeedback/SpecialArticleFeedback.php |
— | — | @@ -153,7 +153,7 @@ |
154 | 154 | array( |
155 | 155 | 'title' => 'Main Page', |
156 | 156 | // List of differences for each rating in the past 7 days |
157 | | - 'differnces' => array( 1, -2, 0, 0 ), |
| 157 | + 'differences' => array( 1, -2, 0, 0 ), |
158 | 158 | ) |
159 | 159 | ); |
160 | 160 | } |
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.hooks.php |
— | — | @@ -85,8 +85,6 @@ |
86 | 86 | 'articlefeedback-report-empty', |
87 | 87 | 'articlefeedback-report-ratings', |
88 | 88 | 'parentheses', |
89 | | - 'email-address-validity-valid', |
90 | | - 'email-address-validity-invalid', |
91 | 89 | ), |
92 | 90 | 'dependencies' => array( |
93 | 91 | 'jquery.tipsy', |
Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | * Script for Article Feedback Plugin |
4 | 4 | */ |
5 | 5 | |
6 | | -( function( $, mw ) { |
| 6 | +( function( $ ) { |
7 | 7 | |
8 | 8 | // Only track users who have been assigned to the tracking group |
9 | 9 | var tracked = 'track' === mw.user.bucket( |
— | — | @@ -30,19 +30,19 @@ |
31 | 31 | */ |
32 | 32 | var updateMailValidityLabel = function( mail, context ) { |
33 | 33 | var isValid = mw.util.validateEmail( mail ), |
34 | | - $label = context.$ui.find( '.articleFeedback-helpimprove-email-validity' ); |
| 34 | + $that = context.$ui.find( '.articleFeedback-helpimprove-email' ); |
35 | 35 | |
36 | 36 | // We allow empty address |
37 | 37 | if( isValid === null ) { |
38 | | - $label.text( '' ).removeClass( 'valid invalid' ); |
| 38 | + $that.removeClass( 'valid invalid' ); |
39 | 39 | |
40 | 40 | // Valid |
41 | 41 | } else if ( isValid ) { |
42 | | - $label.text( mw.msg( 'email-address-validity-valid' ) ).addClass( 'valid' ).removeClass( 'invalid' ); |
| 42 | + $that.addClass( 'valid' ).removeClass( 'invalid' ); |
43 | 43 | |
44 | 44 | // Not valid |
45 | 45 | } else { |
46 | | - $label.text( mw.msg( 'email-address-validity-invalid' ) ).addClass( 'invalid' ).removeClass( 'valid' ); |
| 46 | + $that.addClass( 'invalid' ).removeClass( 'valid' ); |
47 | 47 | } |
48 | 48 | }; |
49 | 49 | |
— | — | @@ -71,17 +71,12 @@ |
72 | 72 | <div><input type="checkbox" value="profession" /><label><html:msg key="form-panel-expertise-profession" /></label></div>\ |
73 | 73 | <div><input type="checkbox" value="hobby" /><label><html:msg key="form-panel-expertise-hobby" /></label></div>\ |
74 | 74 | <div><input type="checkbox" value="other" /><label><html:msg key="form-panel-expertise-other" /></label></div>\ |
| 75 | + <div class="articleFeedback-helpimprove"><input type="checkbox" value="helpimprove-email" /><label><html:msg key="form-panel-helpimprove" /><input type="text" placeholder="" class="articleFeedback-helpimprove-email" />\ |
| 76 | + <div class="articleFeedback-helpimprove-note"></div>\ |
| 77 | + </label></div>\ |
75 | 78 | </div>\ |
76 | 79 | </div>\ |
77 | 80 | <div style="clear:both;"></div>\ |
78 | | - <div class="articleFeedback-helpimprove articleFeedback-visibleWith-form" >\ |
79 | | - <input type="checkbox" value="on" disabled="disabled" /><label class="articleFeedback-helpimprove-disabled"><html:msg key="form-panel-helpimprove" /></label>\ |
80 | | - <div class="articleFeedback-helpimprove-options">\ |
81 | | - <div><input type="text" placeholder="" class="articleFeedback-helpimprove-email" /></div>\ |
82 | | - <div class="articleFeedback-helpimprove-note"></div>\ |
83 | | - </div>\ |
84 | | - </div>\ |
85 | | - <div style="clear:both;"></div>\ |
86 | 81 | </div>\ |
87 | 82 | <button class="articleFeedback-submit articleFeedback-visibleWith-form" type="submit" disabled="disabled"><html:msg key="form-panel-submit" /></button>\ |
88 | 83 | <div class="articleFeedback-success articleFeedback-visibleWith-form"><span><html:msg key="form-panel-success" /></span></div>\ |
— | — | @@ -173,14 +168,6 @@ |
174 | 169 | .find( '.articleFeedback-expertise-disabled' ) |
175 | 170 | .removeClass( 'articleFeedback-expertise-disabled' ); |
176 | 171 | }, |
177 | | - 'enableHelpimprove': function( $helpimprove ) { |
178 | | - $helpimprove |
179 | | - .find( 'input:checkbox[value=on]' ) |
180 | | - .removeAttr( 'disabled' ) |
181 | | - .end() |
182 | | - .find( '.articleFeedback-helpimprove-disabled' ) |
183 | | - .removeClass( 'articleFeedback-helpimprove-disabled' ); |
184 | | - }, |
185 | 172 | 'submit': function() { |
186 | 173 | var context = this; |
187 | 174 | $.articleFeedback.fn.enableSubmission.call( context, false ); |
— | — | @@ -228,12 +215,12 @@ |
229 | 216 | } ); |
230 | 217 | // Build data from form values for 'action=emailcapture' |
231 | 218 | // Ignore if email was invalid |
232 | | - if ( context.$ui.find( '.articleFeedback-helpimprove-email-validity.valid' ).length |
| 219 | + if ( context.$ui.find( '.articleFeedback-helpimprove-email.valid' ).length |
233 | 220 | // Ignore if email field was empty (it's optional) |
234 | 221 | && !$.isEmpty( context.$ui.find( '.articleFeedback-helpimprove-email' ).val() ) |
235 | 222 | // Ignore if checkbox was unchecked (ie. user can enter and then decide to uncheck, |
236 | 223 | // field fades out, then we shouldn't submit) |
237 | | - && $( '#articleFeedback-expertise-on:checked' ).length |
| 224 | + && context.$ui.find('.articleFeedback-helpimprove input:checked' ).length |
238 | 225 | ) { |
239 | 226 | $.ajax( { |
240 | 227 | 'url': mw.config.get( 'wgScriptPath' ) + '/api.php', |
— | — | @@ -256,7 +243,7 @@ |
257 | 244 | if ( 'error' in data ) { |
258 | 245 | mw.log( 'EmailCapture: Form submission error' ); |
259 | 246 | mw.log( data.error ); |
260 | | - updateMailValidityLabel( 'triggererror' ); |
| 247 | + updateMailValidityLabel( 'triggererror', context ); |
261 | 248 | |
262 | 249 | } else { |
263 | 250 | // Hide helpimprove-email for when user returns to Rate-view |
— | — | @@ -278,13 +265,14 @@ |
279 | 266 | // If something was invalid, reset the helpimprove-email part of the form. |
280 | 267 | // When user returns from submit, it will be clean |
281 | 268 | } else { |
282 | | - $( '#articleFeedback-expertise-on' ).removeAttr('checked').change(); |
283 | 269 | context.$ui |
284 | | - .find( '.articleFeedback-helpimprove-email' ) |
285 | | - .val('') |
286 | | - .end() |
287 | | - .find( '.articleFeedback-helpimprove-email-validity' ) |
288 | | - .remove(); |
| 270 | + .find( '.articleFeedback-helpimprove' ) |
| 271 | + .find( 'input:checkbox' ) |
| 272 | + .removeAttr( 'checked' ) |
| 273 | + .end() |
| 274 | + .find( '.articleFeedback-helpimprove-email' ) |
| 275 | + .val( '' ) |
| 276 | + .removeClass( 'valid invalid' ); |
289 | 277 | } |
290 | 278 | }, |
291 | 279 | 'executePitch': function( action ) { |
— | — | @@ -370,16 +358,14 @@ |
371 | 359 | |
372 | 360 | var showHelpimprove = true; |
373 | 361 | |
374 | | - // @XXX: Insert bucket thing override here |
375 | | - // bucket thing will set it to false when needed, default is true |
376 | | - |
377 | 362 | if ( $.cookie( prefix( 'helpimprove-email' ) ) == 'hide' |
378 | 363 | || !mw.user.anonymous() ) { |
379 | 364 | showHelpimprove = false; |
380 | 365 | } |
381 | 366 | |
382 | | - // true: show, false: hide |
383 | | - $helpimprove.toggle( showHelpimprove ); |
| 367 | + if ( !showHelpimprove ) { |
| 368 | + $helpimprove.hide(); |
| 369 | + } |
384 | 370 | |
385 | 371 | // Index rating data by rating ID |
386 | 372 | var ratings = {}; |
— | — | @@ -558,34 +544,29 @@ |
559 | 545 | } |
560 | 546 | } ) |
561 | 547 | .end() |
562 | | - .find( '.articleFeedback-helpimprove' ) |
563 | | - .find( '.articleFeedback-helpimprove-note' ) |
564 | | - // Can't use .text() with mw.message(, /* $1 */ link).toString(), |
565 | | - // because 'link' should not be re-escaped (which would happen if done by mw.message) |
566 | | - .html( function(){ |
567 | | - var link = mw.html.element( |
568 | | - 'a', { |
569 | | - href: mw.util.wikiGetlink( mw.msg('articlefeedback-form-panel-helpimprove-privacylink') ) |
570 | | - }, mw.msg('articlefeedback-form-panel-helpimprove-privacy') |
571 | | - ); |
572 | | - return mw.html.escape( mw.msg( 'articlefeedback-form-panel-helpimprove-note') ) |
573 | | - .replace( /\$1/, mw.message( 'parentheses', link ).toString() ); |
574 | | - }) |
575 | | - .end() |
576 | | - .find( '.articleFeedback-helpimprove-email' ) |
577 | | - .attr( 'placeholder', mw.msg( 'articlefeedback-form-panel-helpimprove-email-placeholder' ) ) |
578 | | - .placeholder() // back. compat. for older browsers |
579 | | - .one( 'blur', function() { |
580 | | - var $el = $(this); |
581 | | - if ( context.$ui.find( '.articleFeedback-helpimprove-email-validity' ).length === 0 ) { |
582 | | - $el.after( '<div class="articleFeedback-helpimprove-email-validity"></div>' ); |
583 | | - } |
| 548 | + .find( '.articleFeedback-helpimprove-note' ) |
| 549 | + // Can't use .text() with mw.message(, /* $1 */ link).toString(), |
| 550 | + // because 'link' should not be re-escaped (which would happen if done by mw.message) |
| 551 | + .html( function(){ |
| 552 | + var link = mw.html.element( |
| 553 | + 'a', { |
| 554 | + href: mw.util.wikiGetlink( mw.msg('articlefeedback-form-panel-helpimprove-privacylink') ) |
| 555 | + }, mw.msg('articlefeedback-form-panel-helpimprove-privacy') |
| 556 | + ); |
| 557 | + return mw.html.escape( mw.msg( 'articlefeedback-form-panel-helpimprove-note') ) |
| 558 | + .replace( /\$1/, mw.message( 'parentheses', link ).toString() ); |
| 559 | + }) |
| 560 | + .end() |
| 561 | + .find( '.articleFeedback-helpimprove-email' ) |
| 562 | + .attr( 'placeholder', mw.msg( 'articlefeedback-form-panel-helpimprove-email-placeholder' ) ) |
| 563 | + .placeholder() // back. compat. for older browsers |
| 564 | + .one( 'blur', function() { |
| 565 | + var $el = $(this); |
| 566 | + updateMailValidityLabel( $el.val(), context ); |
| 567 | + $el.keyup( function() { |
584 | 568 | updateMailValidityLabel( $el.val(), context ); |
585 | | - $el.keyup( function() { |
586 | | - updateMailValidityLabel( $el.val(), context ); |
587 | | - } ); |
588 | | - } ) |
589 | | - .end() |
| 569 | + } ); |
| 570 | + } ) |
590 | 571 | .end() |
591 | 572 | .localize( { 'prefix': 'articlefeedback-' } ) |
592 | 573 | // Activate tooltips |
— | — | @@ -630,16 +611,6 @@ |
631 | 612 | .next() |
632 | 613 | .attr( 'for', id ); |
633 | 614 | }) |
634 | | - .change( function() { |
635 | | - var $options = context.$ui.find( '.articleFeedback-helpimprove-options' ); |
636 | | - if ( $(this).is( ':checked' ) ) { |
637 | | - $options.slideDown( 'fast' ); |
638 | | - } else { |
639 | | - $options.slideUp( 'fast', function() { |
640 | | - $options.find( 'input:checkbox' ).attr( 'checked', false ); |
641 | | - } ); |
642 | | - } |
643 | | - } ) |
644 | 615 | .end() |
645 | 616 | // Buttonify the button |
646 | 617 | .find( '.articleFeedback-submit' ) |
— | — | @@ -740,11 +711,7 @@ |
741 | 712 | .each( function() { |
742 | 713 | $.articleFeedback.fn.enableExpertise( $(this) ); |
743 | 714 | } ) |
744 | | - .end() |
745 | | - .find( '.articleFeedback-helpimprove' ) |
746 | | - .each( function() { |
747 | | - $.articleFeedback.fn.enableHelpimprove( $(this) ); |
748 | | - } ); |
| 715 | + .end(); |
749 | 716 | $(this) |
750 | 717 | .closest( '.articleFeedback-rating' ) |
751 | 718 | .addClass( 'articleFeedback-rating-new' ) |
— | — | @@ -822,4 +789,4 @@ |
823 | 790 | return $(this); |
824 | 791 | }; |
825 | 792 | |
826 | | -} )( jQuery, mediaWiki ); |
| 793 | +} )( jQuery ); |
Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.css |
— | — | @@ -293,16 +293,14 @@ |
294 | 294 | margin-top: 0.75em; |
295 | 295 | } |
296 | 296 | |
297 | | -.articleFeedback-expertise input, |
298 | | -.articleFeedback-helpimprove input { |
| 297 | +.articleFeedback-expertise input { |
299 | 298 | float: left; |
300 | 299 | margin-bottom: 0.5em; |
301 | 300 | clear: both; |
302 | 301 | cursor: pointer; |
303 | 302 | } |
304 | 303 | |
305 | | -.articleFeedback-expertise label, |
306 | | -.articleFeedback-helpimprove label { |
| 304 | +.articleFeedback-expertise label { |
307 | 305 | margin-left: 0.25em; |
308 | 306 | margin-bottom: 0.5em; |
309 | 307 | float: left; |
— | — | @@ -310,8 +308,7 @@ |
311 | 309 | cursor: pointer; |
312 | 310 | } |
313 | 311 | |
314 | | -.articleFeedback-expertise-options, |
315 | | -.articleFeedback-helpimprove-options { |
| 312 | +.articleFeedback-expertise-options { |
316 | 313 | clear: both; |
317 | 314 | display: none; |
318 | 315 | } |
— | — | @@ -320,35 +317,24 @@ |
321 | 318 | margin-left: 2em; |
322 | 319 | } |
323 | 320 | |
324 | | -.articleFeedback-helpimprove-options input { |
325 | | - margin-left: 2em; |
| 321 | +.articleFeedback-expertise-options .articleFeedback-helpimprove-email { |
| 322 | + clear: none; |
| 323 | + float: none; |
| 324 | + width: 20em; |
| 325 | + margin-left: 0.25em; |
326 | 326 | } |
327 | 327 | |
328 | 328 | .articleFeedback-helpimprove-note { |
329 | | - margin-left: 2em; |
330 | 329 | font-size: 0.8em; |
331 | 330 | clear: both; |
332 | 331 | } |
333 | 332 | |
334 | | -.articleFeedback-helpimprove-email { |
335 | | - width: 20em; |
336 | | -} |
337 | | - |
338 | | -.articleFeedback-helpimprove-email-validity { |
339 | | - float: left; |
340 | | - padding: 2px 0.5em; |
341 | | -} |
342 | | - |
343 | | -.articleFeedback-helpimprove-email-validity.valid { |
344 | | - border: 1px solid #80FF80; |
| 333 | +.articleFeedback-helpimprove-email.valid { |
345 | 334 | background-color: #C0FFC0; |
346 | | - color: black; |
347 | 335 | } |
348 | 336 | |
349 | | -.articleFeedback-helpimprove-email-validity.invalid { |
350 | | - border: 1px solid #FF8080; |
| 337 | +.articleFeedback-helpimprove-email.invalid { |
351 | 338 | background-color: #FFC0C0; |
352 | | - color: black; |
353 | 339 | } |
354 | 340 | |
355 | 341 | .articleFeedback-success { |
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.startup.js |
— | — | @@ -2,12 +2,12 @@ |
3 | 3 | * Script for Article Feedback Extension |
4 | 4 | */ |
5 | 5 | |
6 | | -$(document).ready( function() { |
| 6 | +jQuery(document).ready( function( $ ) { |
7 | 7 | if ( |
8 | 8 | // Main namespace articles |
9 | | - mw.config.get( 'wgNamespaceNumber', false ) === 0 |
| 9 | + mw.config.get( 'wgNamespaceNumber' ) === 0 |
10 | 10 | // View pages |
11 | | - && mw.config.get( 'wgAction', false ) === 'view' |
| 11 | + && mw.config.get( 'wgAction' ) === 'view' |
12 | 12 | // Current revision |
13 | 13 | && mw.util.getParamValue( 'diff' ) === null |
14 | 14 | && mw.util.getParamValue( 'oldid' ) === null |