Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js |
— | — | @@ -109,7 +109,7 @@ |
110 | 110 | * Use the mediawiki util resource's config method to find the correct url to |
111 | 111 | * call for all ajax requests. |
112 | 112 | */ |
113 | | - $.articleFeedbackv5.apiUrl = mw.config.get( 'wgScriptPath' ) + '/api.php'; |
| 113 | + $.articleFeedbackv5.apiUrl = mw.util.wikiScript( 'api' ); |
114 | 114 | |
115 | 115 | /** |
116 | 116 | * Is this an anonymous user? |
— | — | @@ -240,7 +240,7 @@ |
241 | 241 | <div class="clear"></div>\ |
242 | 242 | </div>\ |
243 | 243 | <div class="articleFeedbackv5-comment">\ |
244 | | - <textarea id="find-feedback" class="feedback-text" name="comment"></textarea>\ |
| 244 | + <textarea id="articleFeedbackv5-find-feedback" class="feedback-text" name="comment"></textarea>\ |
245 | 245 | </div>\ |
246 | 246 | <div class="articleFeedbackv5-disclosure">\ |
247 | 247 | <!-- <p class="articlefeedbackv5-shared-on-feedback"></p> -->\ |
— | — | @@ -294,7 +294,7 @@ |
295 | 295 | .html( $.articleFeedbackv5.buildLink( |
296 | 296 | 'articlefeedbackv5-transparency-terms', |
297 | 297 | { |
298 | | - href: 'http://wikimediafoundation.org/wiki/Feedback_privacy_statement', |
| 298 | + href: mw.config.get( 'wgArticleFeedbackv5TermsPage' ), |
299 | 299 | text: 'articlefeedbackv5-transparency-terms-linktext', |
300 | 300 | target: '_blank' |
301 | 301 | } ) ); |
— | — | @@ -360,9 +360,6 @@ |
361 | 361 | .keyup ( function () { |
362 | 362 | if( $( this ).val().length > 0 ) { |
363 | 363 | $.articleFeedbackv5.enableSubmission( true ); |
364 | | -// } else { |
365 | | -// $.articleFeedbackv5.enableSubmission( false ); |
366 | | - |
367 | 364 | } |
368 | 365 | } ) |
369 | 366 | .blur( function () { |
— | — | @@ -482,7 +479,7 @@ |
483 | 480 | <div class="clear"></div>\ |
484 | 481 | </div>\ |
485 | 482 | <div class="articleFeedbackv5-comment">\ |
486 | | - <textarea id="find-feedback" class="feedback-text" name="comment"></textarea>\ |
| 483 | + <textarea id="articleFeedbackv5-find-feedback" class="feedback-text" name="comment"></textarea>\ |
487 | 484 | </div>\ |
488 | 485 | <div class="articleFeedbackv5-disclosure">\ |
489 | 486 | <!-- <p class="articlefeedbackv5-shared-on-feedback"></p> -->\ |
— | — | @@ -574,7 +571,7 @@ |
575 | 572 | .html( $.articleFeedbackv5.buildLink( |
576 | 573 | 'articlefeedbackv5-transparency-terms', |
577 | 574 | { |
578 | | - href: mw.util.wikiGetlink( mw.config.get( 'wgArticleFeedbackv5TermsPage' ) ), |
| 575 | + href: mw.config.get( 'wgArticleFeedbackv5TermsPage' ), |
579 | 576 | text: 'articlefeedbackv5-transparency-terms-linktext', |
580 | 577 | target: '_blank' |
581 | 578 | } ) ); |
— | — | @@ -618,9 +615,6 @@ |
619 | 616 | .keyup ( function () { |
620 | 617 | if( $( this ).val().length > 0 ) { |
621 | 618 | $.articleFeedbackv5.enableSubmission( true ); |
622 | | -// } else { |
623 | | -// $.articleFeedbackv5.enableSubmission( false ); |
624 | | - |
625 | 619 | } |
626 | 620 | } ) |
627 | 621 | .blur( function () { |
— | — | @@ -679,7 +673,7 @@ |
680 | 674 | if ( $c.val() == '') { |
681 | 675 | empty = true; |
682 | 676 | } else { |
683 | | - for ( t in $.articleFeedbackv5.currentBucket().commentDefault ) { |
| 677 | + for ( var t in $.articleFeedbackv5.currentBucket().commentDefault ) { |
684 | 678 | if ( $c.val() == $.articleFeedbackv5.currentBucket().commentDefault[t] ) { |
685 | 679 | empty = true; |
686 | 680 | } |
— | — | @@ -709,7 +703,7 @@ |
710 | 704 | var data = {}; |
711 | 705 | data.tag = $.articleFeedbackv5.find( '.articleFeedbackv5-tags input[checked]' ).val(); |
712 | 706 | data.comment = $.articleFeedbackv5.find( '.articleFeedbackv5-comment textarea' ).val(); |
713 | | - for ( t in $.articleFeedbackv5.currentBucket().commentDefault ) { |
| 707 | + for ( var t in $.articleFeedbackv5.currentBucket().commentDefault ) { |
714 | 708 | if ( data.comment == $.articleFeedbackv5.currentBucket().commentDefault[t] ) { |
715 | 709 | data.comment = ''; |
716 | 710 | } |
— | — | @@ -773,7 +767,7 @@ |
774 | 768 | <div class="articleFeedbackv5-rating-label" rel="3"></div>\ |
775 | 769 | <div class="articleFeedbackv5-rating-label" rel="4"></div>\ |
776 | 770 | <div class="articleFeedbackv5-rating-label" rel="5"></div>\ |
777 | | - <div class="articleFeedbackv5-rating-clear" original-title="Remove this rating"></div>\ |
| 771 | + <div class="articleFeedbackv5-rating-clear"></div>\ |
778 | 772 | </div>\ |
779 | 773 | </div>\ |
780 | 774 | <div style="clear:both;"></div>\ |
— | — | @@ -784,7 +778,7 @@ |
785 | 779 | <div class="clear"></div>\ |
786 | 780 | </div>\ |
787 | 781 | <div class="articleFeedbackv5-comment">\ |
788 | | - <textarea id="find-feedback" class="feedback-text" name="comment"></textarea>\ |
| 782 | + <textarea id="articleFeedbackv5-find-feedback" class="feedback-text" name="comment"></textarea>\ |
789 | 783 | </div>\ |
790 | 784 | <div class="articleFeedbackv5-disclosure">\ |
791 | 785 | <!-- <p class="articlefeedbackv5-shared-on-feedback"></p> -->\ |
— | — | @@ -853,7 +847,7 @@ |
854 | 848 | .html( $.articleFeedbackv5.buildLink( |
855 | 849 | 'articlefeedbackv5-transparency-terms', |
856 | 850 | { |
857 | | - href: mw.util.wikiGetlink( mw.config.get( 'wgArticleFeedbackv5TermsPage' ) ), |
| 851 | + href: mw.config.get( 'wgArticleFeedbackv5TermsPage' ), |
858 | 852 | text: 'articlefeedbackv5-transparency-terms-linktext', |
859 | 853 | target: '_blank' |
860 | 854 | } ) ); |
— | — | @@ -947,9 +941,6 @@ |
948 | 942 | .keyup ( function () { |
949 | 943 | if( $( this ).val().length > 0 ) { |
950 | 944 | $.articleFeedbackv5.enableSubmission( true ); |
951 | | -// } else { |
952 | | -// $.articleFeedbackv5.enableSubmission( false ); |
953 | | - |
954 | 945 | } |
955 | 946 | } ) |
956 | 947 | .blur( function () { |
— | — | @@ -1061,7 +1052,7 @@ |
1062 | 1053 | block: '\ |
1063 | 1054 | <div>\ |
1064 | 1055 | <div class="form-row articleFeedbackv5-bucket4-toggle">\ |
1065 | | - <p class="sub-header"><strong><html:msg key="bucket4-subhead"></strong></p>\ |
| 1056 | + <p class="sub-header"><strong><html:msg key="bucket4-subhead" /></strong></p>\ |
1066 | 1057 | <p class="instructions-left"><html:msg key="bucket4-teaser-line1" /><br />\ |
1067 | 1058 | <html:msg key="bucket4-teaser-line2" /></p>\ |
1068 | 1059 | </div>\ |
— | — | @@ -1281,10 +1272,6 @@ |
1282 | 1273 | */ |
1283 | 1274 | buildForm: function () { |
1284 | 1275 | |
1285 | | - // A single rating block |
1286 | | - var rating_tpl = '\ |
1287 | | - '; |
1288 | | - |
1289 | 1276 | // Start up the block to return |
1290 | 1277 | var $block = $( $.articleFeedbackv5.currentBucket().templates.block ); |
1291 | 1278 | |
— | — | @@ -1318,7 +1305,7 @@ |
1319 | 1306 | .html( $.articleFeedbackv5.buildLink( |
1320 | 1307 | 'articlefeedbackv5-bucket5-form-panel-helpimprove-note', |
1321 | 1308 | { |
1322 | | - href: mw.util.wikiGetlink( mw.config.get( 'wgArticleFeedbackv5TermsPage' ) ), // TODO: Make this work |
| 1309 | + href: mw.config.get( 'wgArticleFeedbackv5TermsPage' ), // TODO: Make this work |
1323 | 1310 | text: 'articlefeedbackv5-bucket5-form-panel-helpimprove-privacy' |
1324 | 1311 | } |
1325 | 1312 | ) ); |
— | — | @@ -1622,7 +1609,6 @@ |
1623 | 1610 | 'format': 'json', |
1624 | 1611 | 'list': 'articlefeedbackv5-view-ratings', |
1625 | 1612 | 'afpageid': $.articleFeedbackv5.pageId, |
1626 | | - 'afanontoken': $.articleFeedbackv5.userId, |
1627 | 1613 | 'maxage': 0, |
1628 | 1614 | 'smaxage': mw.config.get( 'wgArticleFeedbackv5SMaxage' ) |
1629 | 1615 | }, |
— | — | @@ -1637,7 +1623,7 @@ |
1638 | 1624 | var msg = mw.msg ( 'articlefeedbackv5-error-response' ); |
1639 | 1625 | if ( 'error' in data && 'info' in data.error ) { |
1640 | 1626 | msg = data.error.info; |
1641 | | - } else { |
| 1627 | + } else if ( typeof console != 'undefined' ) { |
1642 | 1628 | console.log(data); |
1643 | 1629 | } |
1644 | 1630 | $.articleFeedbackv5.markShowstopperError( msg ); |
— | — | @@ -1793,13 +1779,14 @@ |
1794 | 1780 | <div class="articleFeedbackv5-confirmation-panel">\ |
1795 | 1781 | <div class="articleFeedbackv5-panel-leftContent">\ |
1796 | 1782 | <div class="articleFeedbackv5-confirmation-text">\ |
1797 | | - <span class="articleFeedbackv5-confirmation-thanks">' + mw.msg( "articlefeedbackv5-cta1-thanks" ) + '</span> <span class="articleFeedbackv5-confirmation-follow-up">' + mw.msg( "articlefeedbackv5-cta1-confirmation-followup" ) + '</span>\ |
| 1783 | + <span class="articleFeedbackv5-confirmation-thanks"><html:msg key="cta1-thanks" /></span>\ |
| 1784 | + <span class="articleFeedbackv5-confirmation-follow-up"><html:msg key="cta1-confirmation-followup" /></span>\ |
1798 | 1785 | </div>\ |
1799 | | - <h3 class="articleFeedbackv5-confirmation-title">' + mw.msg( "articlefeedbackv5-cta1-confirmation-title" ) + '</h3>\ |
1800 | | - <p class="articleFeedbackv5-confirmation-wikipediaWorks">' + mw.msg( "articlefeedbackv5-cta1-confirmation-call" ) + '</p>\ |
1801 | | - <p class="articleFeedbackv5-confirmation-learnHow"><a target="_blank" href="#">' + mw.msg("articlefeedbackv5-cta1-learn-how") + ' »</a></p>\ |
| 1786 | + <h3 class="articleFeedbackv5-confirmation-title"><html:msg key="cta1-confirmation-title" /></h3>\ |
| 1787 | + <p class="articleFeedbackv5-confirmation-wikipediaWorks"><html:msg key="cta1-confirmation-call" /></p>\ |
| 1788 | + <p class="articleFeedbackv5-confirmation-learnHow"><a target="_blank" href="#"><html:msg key="cta1-learn-how" /> »</a></p>\ |
1802 | 1789 | </div>\ |
1803 | | - <a href="&action=edit" class="articleFeedbackv5-edit-cta-link"><span class="ui-button-text">' + mw.msg( "articlefeedbackv5-cta1-edit-linktext" ) + '</span></a>\ |
| 1790 | + <a href="&action=edit" class="articleFeedbackv5-edit-cta-link"><span class="ui-button-text"><html:msg key="cta1-edit-linktext" /></span></a>\ |
1804 | 1791 | <div class="clear"></div>\ |
1805 | 1792 | </div>\ |
1806 | 1793 | ' |
— | — | @@ -1928,7 +1915,7 @@ |
1929 | 1916 | $.articleFeedbackv5.bucketId, |
1930 | 1917 | { 'expires': cfg.expires, 'path': '/' } |
1931 | 1918 | ); |
1932 | | - if ( $.articleFeedbackv5.debug ) { |
| 1919 | + if ( $.articleFeedbackv5.debug && typeof console != 'undefined' ) { |
1933 | 1920 | console.log( 'Using bucket #' + $.articleFeedbackv5.bucketId ); |
1934 | 1921 | } |
1935 | 1922 | }; |
— | — | @@ -2034,8 +2021,8 @@ |
2035 | 2022 | bucket.enableSubmission( state ); |
2036 | 2023 | } |
2037 | 2024 | $.articleFeedbackv5.submissionEnabled = state; |
2038 | | - $( '#articleFeedbackv5-submit-bttn span' ).html( mw.msg( 'articlefeedbackv5-bucket1-form-submit' ) ); |
2039 | | - $( '#articleFeedbackv5-submit-bttn5 span' ).html( mw.msg( 'articlefeedbackv5-bucket5-form-panel-submit' ) ); |
| 2025 | + $( '#articleFeedbackv5-submit-bttn span' ).text( mw.msg( 'articlefeedbackv5-bucket1-form-submit' ) ); |
| 2026 | + $( '#articleFeedbackv5-submit-bttn5 span' ).text( mw.msg( 'articlefeedbackv5-bucket5-form-panel-submit' ) ); |
2040 | 2027 | }; |
2041 | 2028 | |
2042 | 2029 | // }}} |
— | — | @@ -2262,6 +2249,7 @@ |
2263 | 2250 | if ( 'bindEvents' in cta ) { |
2264 | 2251 | cta.bindEvents( $block ); |
2265 | 2252 | } |
| 2253 | + $block.localize( { 'prefix': 'articlefeedbackv5-' } ); |
2266 | 2254 | if ( 'getTitle' in cta ) { |
2267 | 2255 | if ( $.articleFeedbackv5.inDialog ) { |
2268 | 2256 | $.articleFeedbackv5.$dialog.dialog( 'option', 'title', cta.getTitle() ); |
— | — | @@ -2315,22 +2303,22 @@ |
2316 | 2304 | * @param string message the message to display, if in dev |
2317 | 2305 | */ |
2318 | 2306 | $.articleFeedbackv5.markShowstopperError = function ( message ) { |
2319 | | - console.log( message ); |
2320 | | - var msg_html = mw.msg( 'articlefeedbackv5-error' ); |
2321 | | - if ($.articleFeedbackv5.debug && message) { |
2322 | | - msg_html = message.replace( "\n", '<br />' ); |
| 2307 | + if ( typeof console != 'undefined' ) { |
| 2308 | + console.log( message ); |
2323 | 2309 | } |
2324 | | - $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-error-message' ).html( msg_html ); |
2325 | | - var veil = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-error' ); |
2326 | | - var box = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-panel' ); |
| 2310 | + var $err = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-error-message' ); |
| 2311 | + $err.text( $.articleFeedbackv5.debug && message ? message : mw.msg( 'articlefeedbackv5-error' ) ); |
| 2312 | + $err.html( $err.html().replace( "\n", '<br />' ) ); |
| 2313 | + var $veil = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-error' ); |
| 2314 | + var $box = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-buffer' ); |
2327 | 2315 | // TODO: Make this smarter -- on ubuntu/ff at least, using the |
2328 | 2316 | // offset puts it about 100px down from where it should be; |
2329 | 2317 | // this math corrects for it, but will most likely be wrong on |
2330 | 2318 | // other browsers |
2331 | | - veil.css('top', box.find('.articleFeedbackv5-ui').offset().top / 2 + 10); |
2332 | | - veil.css('width', box.width()); |
2333 | | - veil.css('height', box.height()); |
2334 | | - veil.show(); |
| 2319 | + $veil.css('top', $box.find('.articleFeedbackv5-ui').offset().top / 2 + 10); |
| 2320 | + $veil.css('width', $box.width()); |
| 2321 | + $veil.css('height', $box.height()); |
| 2322 | + $veil.show(); |
2335 | 2323 | }; |
2336 | 2324 | |
2337 | 2325 | // }}} |
— | — | @@ -2368,7 +2356,9 @@ |
2369 | 2357 | } |
2370 | 2358 | } |
2371 | 2359 | if ( $.articleFeedbackv5.debug ) { |
2372 | | - console.log( errors ); |
| 2360 | + if ( typeof console != 'undefined' ) { |
| 2361 | + console.log( errors ); |
| 2362 | + } |
2373 | 2363 | } |
2374 | 2364 | if ( 'markFormErrors' in $.articleFeedbackv5.currentBucket() ) { |
2375 | 2365 | $.articleFeedbackv5.currentBucket().markFormErrors( errors ); |