Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -3473,9 +3473,6 @@ |
3474 | 3474 | 'ajax-add-category-summary', |
3475 | 3475 | 'ajax-edit-category-summary', |
3476 | 3476 | 'ajax-remove-category-summary', |
3477 | | - 'ajax-add-category-question', |
3478 | | - 'ajax-edit-category-question', |
3479 | | - 'ajax-remove-category-question', |
3480 | 3477 | 'ajax-confirm-actionsummary', |
3481 | 3478 | 'ajax-error-title', |
3482 | 3479 | 'ajax-error-dismiss', |
Index: trunk/phase3/tests/qunit/index.html |
— | — | @@ -47,11 +47,9 @@ |
48 | 48 | <script src="../../resources/jquery/jquery.localize.js"></script> |
49 | 49 | <script src="../../resources/jquery/jquery.tabIndex.js"></script> |
50 | 50 | <script src="../../resources/jquery/jquery.tablesorter.js"></script> |
51 | | - <script src="../../resources/jquery/jquery.suggestions.js"></script> |
52 | 51 | <script src="../../resources/mediawiki/mediawiki.Title.js"></script> |
53 | 52 | <script src="../../resources/mediawiki.special/mediawiki.special.js"></script> |
54 | 53 | <script src="../../resources/mediawiki.special/mediawiki.special.recentchanges.js"></script> |
55 | | - <script src="../../resources/mediawiki.page/mediawiki.page.ajaxCategories.js"></script> |
56 | 54 | |
57 | 55 | <!-- QUnit: Load framework --> |
58 | 56 | <link rel="stylesheet" href="../../resources/jquery/jquery.qunit.css" /> |
— | — | @@ -77,7 +75,6 @@ |
78 | 76 | <script src="suites/resources/jquery/jquery.tablesorter.test.js" charset="UTF-8"></script> |
79 | 77 | <script src="suites/resources/mediawiki/mediawiki.Title.js"></script> |
80 | 78 | <script src="suites/resources/mediawiki.special/mediawiki.special.recentchanges.js"></script> |
81 | | - <!--<script src="suites/resources/mediawiki.page/mediawiki.page.ajaxCategories.js"></script>--> |
82 | 79 | </head> |
83 | 80 | <body> |
84 | 81 | <h1 id="qunit-header">MediaWiki JavaScript Test Suite</h1> |
— | — | @@ -88,7 +85,7 @@ |
89 | 86 | <h2 id="qunit-userAgent"></h2> |
90 | 87 | <ol id="qunit-tests"></ol> |
91 | 88 | |
92 | | -<!-- Scripts inserting stuff here shall remove it themselves! --> |
| 89 | +<!-- Scripts inserting stuff here shall remove it themselfs! --> |
93 | 90 | <div id="content"></div> |
94 | 91 | </body> |
95 | 92 | </html> |
Index: trunk/phase3/tests/qunit/suites/resources/jquery/jquery.localize.js |
— | — | @@ -12,14 +12,16 @@ |
13 | 13 | mw.messages.set( 'basic', 'Basic stuff' ); |
14 | 14 | |
15 | 15 | // Tag: html:msg |
16 | | - html = '<div><span><html:msg key="basic"></span></div>'; |
| 16 | + html = '<div><span><html:msg key="basic"/></span></div>'; |
17 | 17 | $lc = $( html ).localize().find( 'span' ); |
| 18 | + console.log($lc.length); |
18 | 19 | |
19 | 20 | strictEqual( $lc.text(), 'Basic stuff', 'Tag: html:msg' ); |
20 | 21 | |
21 | 22 | // Tag: msg (deprecated) |
22 | | - html = '<div><span><msg key="basic"></span></div>'; |
| 23 | + html = '<div><span><msg key="basic"/></span></div>'; |
23 | 24 | $lc = $( html ).localize().find( 'span' ); |
| 25 | + $('body').append($lc); |
24 | 26 | |
25 | 27 | strictEqual( $lc.text(), 'Basic stuff', 'Tag: msg' ); |
26 | 28 | |
— | — | @@ -46,7 +48,7 @@ |
47 | 49 | // making sure it is actually using text() and attr() (or something with the same effect) |
48 | 50 | |
49 | 51 | // Text escaping |
50 | | - html = '<div><span><html:msg key="properfoo"></span></div>'; |
| 52 | + html = '<div><span><html:msg key="properfoo"/></span></div>'; |
51 | 53 | $lc = $( html ).localize().find( 'span' ); |
52 | 54 | |
53 | 55 | strictEqual( $lc.text(), mw.msg( 'properfoo' ), 'Content is inserted as text, not as html.' ); |
Index: trunk/phase3/tests/qunit/suites/resources/mediawiki.page/mediawiki.page.ajaxCategories.js |
— | — | @@ -33,4 +33,42 @@ |
34 | 34 | equal(ret, true); |
35 | 35 | }); |
36 | 36 | |
| 37 | +})( mediaWiki ); |
| 38 | +console.log('wtf0'); |
| 39 | +(function( mw ) { |
| 40 | + |
| 41 | +console.log('wtf1'); |
| 42 | +module( 'mediawiki.page.ajaxCategories.js' ); |
| 43 | +mw.config.set( 'wgNamespaceIds', {'category' : 14} ); |
| 44 | +test( '-- Initial check', function() { |
| 45 | + expect(1); |
| 46 | + ok( mw.ajaxCategories, 'mw.ajaxCategories defined' ); |
| 47 | +}); |
| 48 | + |
| 49 | +/** |
| 50 | + * Create a category list like the one found below articles. |
| 51 | + * @param {String[]} categories |
| 52 | + * @return jQuery |
| 53 | + */ |
| 54 | +var listCreate = function( categories ) { |
| 55 | + var $container = $('<div id="catlinks" class="catlinks"><div id="mw-normal-catlinks"><ul></ul></div></div>'), |
| 56 | + $ul = $container.find('ul'); |
| 57 | + $.each( categories, function(i, str) { |
| 58 | + var $li = $('<li>'); |
| 59 | + $li.text(str).appendTo($ul); |
| 60 | + }); |
| 61 | + |
| 62 | + return $container; |
| 63 | +}; |
| 64 | +catList1 = ['Earth satellites', 'Space stations', 'astronauts']; |
| 65 | + |
| 66 | +test( 'Testing containsCat', function() { |
| 67 | + expect(1); |
| 68 | + $( 'body' ).append( listCreate(catList1) ); |
| 69 | + mw.ajaxCategories.setup(); |
| 70 | + var ret = mw.ajaxCategories.containsCat('Earth satellites') |
| 71 | + |
| 72 | + equal(ret, true); |
| 73 | +}); |
| 74 | + |
37 | 75 | })( mediaWiki ); |
\ No newline at end of file |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -4602,9 +4602,6 @@ |
4603 | 4603 | 'ajax-add-category-summary' => 'Add category "$1"', |
4604 | 4604 | 'ajax-edit-category-summary' => 'Change category "$1" to "$2"', |
4605 | 4605 | 'ajax-remove-category-summary' => 'Remove category "$1"', |
4606 | | -'ajax-add-category-question' => 'Why do you want to add category "$1"?', |
4607 | | -'ajax-edit-category-question' => 'Why do you want to change category "$1" to "$2"?', |
4608 | | -'ajax-remove-category-question'=> 'Why do you want to remove category "$1"?', |
4609 | 4606 | 'ajax-confirm-actionsummary' => 'Action to take:', |
4610 | 4607 | 'ajax-error-title' => 'Error', |
4611 | 4608 | 'ajax-error-dismiss' => 'OK', |
Index: trunk/phase3/resources/Resources.php |
— | — | @@ -508,9 +508,6 @@ |
509 | 509 | 'ajax-add-category-summary', |
510 | 510 | 'ajax-remove-category-summary', |
511 | 511 | 'ajax-edit-category-summary', |
512 | | - 'ajax-add-category-question', |
513 | | - 'ajax-edit-category-question', |
514 | | - 'ajax-remove-category-question', |
515 | 512 | 'ajax-confirm-actionsummary', |
516 | 513 | 'ajax-error-title', |
517 | 514 | 'ajax-error-dismiss', |
Index: trunk/phase3/resources/mediawiki/mediawiki.util.js |
— | — | @@ -99,12 +99,6 @@ |
100 | 100 | $tocToggleLink.click(); |
101 | 101 | } |
102 | 102 | } |
103 | | - /* Ajax Categories */ |
104 | | - if ( mw.ajaxCategories ) { |
105 | | - // Execute only on doc.ready, so that everyone |
106 | | - // gets a chance to set mw.config.set('disableAJAXCategories') |
107 | | - mw.ajaxCategories.setup() |
108 | | - } |
109 | 103 | } ); |
110 | 104 | |
111 | 105 | return true; |
Index: trunk/phase3/resources/mediawiki.page/mediawiki.page.ajaxCategories.js |
— | — | @@ -85,7 +85,7 @@ |
86 | 86 | // strip out bad characters |
87 | 87 | cat = _stripIllegals ( cat ); |
88 | 88 | |
89 | | - if ( $.isEmpty( cat ) || this.containsCat( cat ) ) { |
| 89 | + if ( $.isEmpty( cat ) || _containsCat( cat ) ) { |
90 | 90 | return; |
91 | 91 | } |
92 | 92 | |
— | — | @@ -157,7 +157,7 @@ |
158 | 158 | * |
159 | 159 | * @return boolean True for exists |
160 | 160 | */ |
161 | | - this.containsCat = function ( cat ) { |
| 161 | + _containsCat = function ( cat ) { |
162 | 162 | return _getCats().filter( function() { return $.ucFirst(this) == $.ucFirst(cat); } ).length !== 0; |
163 | 163 | }; |
164 | 164 | |
— | — | @@ -449,7 +449,7 @@ |
450 | 450 | var category = $( this ).parent().find( '.mw-addcategory-input' ).val(); |
451 | 451 | category = $.ucFirst( category ); |
452 | 452 | |
453 | | - if ( this.containsCat(category) ) { |
| 453 | + if ( _containsCat(category) ) { |
454 | 454 | _showError( mw.msg( 'ajax-category-already-present', category ) ); |
455 | 455 | return; |
456 | 456 | } |
— | — | @@ -463,7 +463,6 @@ |
464 | 464 | }, |
465 | 465 | summary, |
466 | 466 | function() { |
467 | | - $container.find( '#mw-normal-catlinks>.mw-addcategory-prompt' ).toggle(); |
468 | 467 | _insertCatDOM( category, false ); |
469 | 468 | } |
470 | 469 | ); |
— | — | @@ -688,4 +687,8 @@ |
689 | 688 | // Now make a new version |
690 | 689 | mw.ajaxCategories = new ajaxCategories(); |
691 | 690 | |
| 691 | +// Executing only on doc.ready, so that everyone |
| 692 | +// gets a chance to set mw.config.set('disableAJAXCategories') |
| 693 | +$( document ).ready( mw.ajaxCategories.setup() ); |
| 694 | + |
692 | 695 | } )( jQuery, mediaWiki ); |
\ No newline at end of file |