r43606 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43605‎ | r43606 | r43607 >
Date:16:35, 17 November 2008
Author:jojo
Status:ok (Comments)
Tags:
Comment:
use jQuery.noConflict() (e.g. fr.wb defines its own $() function).
Modified paths:
  • /trunk/extensions/Collection/Collection.body.php (modified) (history)
  • /trunk/extensions/Collection/collection/collection.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Collection/collection/collection.js
@@ -36,7 +36,7 @@
3737 * @return String text of elment with ID id
3838 */
3939 function gettext(sel, param/*=null*/) {
40 - var txt = $(sel).html();
 40+ var txt = jQuery(sel).html();
4141 if (param) {
4242 txt = txt.replace(/%PARAM%/g, param);
4343 }
@@ -49,13 +49,13 @@
5050 /******************************************************************************/
5151
5252 function getMWServeStatus() {
53 - $.getJSON(script_url, {
 53+ jQuery.getJSON(script_url, {
5454 'action': 'ajax',
5555 'rs': 'wfAjaxGetMWServeStatus',
5656 'rsargs[]': [collection_id, writer]
5757 }, function(result) {
5858 if (result.state == 'progress' ) {
59 - $('#renderingProgress').html('' + result.status.progress);
 59+ jQuery('#renderingProgress').html('' + result.status.progress);
6060 if (result.status.status) {
6161 var status = result.status.status;
6262 if (result.status.article) {
@@ -63,7 +63,7 @@
6464 } else if (result.status.page) {
6565 status += gettext('#renderingPage', result.status.page);
6666 }
67 - $('#renderingStatus').html(gettext('#renderingStatusText', status));
 67+ jQuery('#renderingStatus').html(gettext('#renderingStatusText', status));
6868 }
6969 setTimeout(getMWServeStatus, 500);
7070 } else {
@@ -117,7 +117,7 @@
118118 function set_titles() {
119119 sajax_request_type = "POST";
120120 sajax_do_call('wfAjaxCollectionSetTitles',
121 - [$('#titleInput').val(), $('#subtitleInput').val()], function() {});
 121+ [jQuery('#titleInput').val(), jQuery('#subtitleInput').val()], function() {});
122122 return false;
123123 }
124124
@@ -128,76 +128,76 @@
129129 }
130130
131131 function update_save_button() {
132 - if (!$('#saveButton').get(0)) {
 132+ if (!jQuery('#saveButton').get(0)) {
133133 return;
134134 }
135 - if ($('#emptyCollection').get(0)) {
136 - $('#saveButton').attr('disabled', 'disabled');
 135+ if (jQuery('#emptyCollection').get(0)) {
 136+ jQuery('#saveButton').attr('disabled', 'disabled');
137137 return;
138138 }
139 - if ($('#personalCollType:checked').val()) {
140 - $('#personalCollTitle').attr('disabled', '');
141 - $('#communityCollTitle').attr('disabled', 'disabled');
142 - if (!$.trim($('#personalCollTitle').val())) {
143 - $('#saveButton').attr('disabled', 'disabled');
 139+ if (jQuery('#personalCollType:checked').val()) {
 140+ jQuery('#personalCollTitle').attr('disabled', '');
 141+ jQuery('#communityCollTitle').attr('disabled', 'disabled');
 142+ if (!jQuery.trim(jQuery('#personalCollTitle').val())) {
 143+ jQuery('#saveButton').attr('disabled', 'disabled');
144144 return;
145145 }
146 - } else if ($('#communityCollType:checked').val()) {
147 - $('#communityCollTitle').attr('disabled', '');
148 - $('#personalCollTitle').attr('disabled', 'disabled');
149 - if (!$.trim($('#communityCollTitle').val())) {
150 - $('#saveButton').attr('disabled', 'disabled');
 146+ } else if (jQuery('#communityCollType:checked').val()) {
 147+ jQuery('#communityCollTitle').attr('disabled', '');
 148+ jQuery('#personalCollTitle').attr('disabled', 'disabled');
 149+ if (!jQuery.trim(jQuery('#communityCollTitle').val())) {
 150+ jQuery('#saveButton').attr('disabled', 'disabled');
151151 return;
152152 }
153153 }
154 - $('#saveButton').attr('disabled', '');
 154+ jQuery('#saveButton').attr('disabled', '');
155155 }
156156
157157 function make_sortable() {
158 - $('#collectionList').sortable({
 158+ jQuery('#collectionList').sortable({
159159 axis: 'y',
160160 update: function(evt, ui) {
161 - set_sorting($('#collectionList').sortable('serialize'));
 161+ set_sorting(jQuery('#collectionList').sortable('serialize'));
162162 }
163163 });
164 - $('#collectionList .sortableitem').css('cursor', 'move');
 164+ jQuery('#collectionList .sortableitem').css('cursor', 'move');
165165 }
166166
167167 function refresh_list(xhr) {
168 - $('#collectionListContainer').html(xhr.responseText);
169 - $('.makeVisible').css('display', 'inline');
 168+ jQuery('#collectionListContainer').html(xhr.responseText);
 169+ jQuery('.makeVisible').css('display', 'inline');
170170 make_sortable();
171 - if ($('#emptyCollection').get(0)) {
172 - $('#downloadButton').attr('disabled', 'disabled');
173 - $('input.order').attr('disabled', 'disabled');
 171+ if (jQuery('#emptyCollection').get(0)) {
 172+ jQuery('#downloadButton').attr('disabled', 'disabled');
 173+ jQuery('input.order').attr('disabled', 'disabled');
174174 } else {
175 - $('#downloadButton').attr('disabled', '');
176 - $('input.order').attr('disabled', '');
 175+ jQuery('#downloadButton').attr('disabled', '');
 176+ jQuery('input.order').attr('disabled', '');
177177 }
178178 update_save_button();
179179 }
180180
181 -$(function() {
 181+jQuery(function() {
182182 if (requiredVersion != wgCollectionVersion) {
183183 alert('ERROR: Version mismatch between Javascript and PHP code. Contact admin to fix the installation of Collection extension for MediaWiki.');
184184 return;
185185 }
186 - if ($('#collectionList').get(0)) {
187 - $('.makeVisible').css('display', 'inline');
 186+ if (jQuery('#collectionList').get(0)) {
 187+ jQuery('.makeVisible').css('display', 'inline');
188188 window.coll_create_chapter = create_chapter;
189189 window.coll_remove_item = remove_item;
190190 window.coll_rename_chapter = rename_chapter;
191191 window.coll_clear_collection = clear_collection;
192192 update_save_button();
193193 make_sortable();
194 - $('#personalCollTitle').keyup(update_save_button);
195 - $('#personalCollTitle').change(update_save_button);
196 - $('#communityCollTitle').keyup(update_save_button);
197 - $('#communityCollTitle').change(update_save_button);
198 - $('#personalCollType').change(update_save_button);
199 - $('#communityCollType').change(update_save_button);
200 - $('#titleInput').change(set_titles);
201 - $('#subtitleInput').change(set_titles);
 194+ jQuery('#personalCollTitle').keyup(update_save_button);
 195+ jQuery('#personalCollTitle').change(update_save_button);
 196+ jQuery('#communityCollTitle').keyup(update_save_button);
 197+ jQuery('#communityCollTitle').change(update_save_button);
 198+ jQuery('#personalCollType').change(update_save_button);
 199+ jQuery('#communityCollType').change(update_save_button);
 200+ jQuery('#titleInput').change(set_titles);
 201+ jQuery('#subtitleInput').change(set_titles);
202202 }
203203 if (typeof collection_rendering != 'undefined') {
204204 getMWServeStatus();
Index: trunk/extensions/Collection/Collection.body.php
@@ -218,6 +218,7 @@
219219 $wgOut->addInlineScript( "var wgCollectionVersion = \"$wgCollectionVersion\";" );
220220 $wgOut->addScript( "<script type=\"$wgJsMimeType\" src=\"$wgScriptPath/extensions/Collection/collection/jquery.js?$wgCollectionStyleVersion\"></script>" );
221221 $wgOut->addScript( "<script type=\"$wgJsMimeType\" src=\"$wgScriptPath/extensions/Collection/collection/jquery.ui.js?$wgCollectionStyleVersion\"></script>" );
 222+ $wgOut->addInlineScript( "jQuery.noConflict();" );
222223 $wgOut->addScript( "<script type=\"$wgJsMimeType\" src=\"$wgScriptPath/extensions/Collection/collection/collection.js?$wgCollectionStyleVersion\"></script>" );
223224
224225 $template = new CollectionPageTemplate();

Follow-up revisions

RevisionCommit summaryAuthorDate
r43610Per r43606: Bump $wgCollectionStyleVersionraymond17:26, 17 November 2008

Comments

#Comment by Raymond (talk | contribs)   17:29, 17 November 2008

Changes to .js files need bumping $wgCollectionStyleVersion. Done with r43610.

Status & tagging log