r72698 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72697‎ | r72698 | r72699 >
Date:01:32, 10 September 2010
Author:kaldari
Status:resolved (Comments)
Tags:
Comment:
building correct bannerlistloader URL
Modified paths:
  • /trunk/extensions/CentralNotice/newCentralNotice.js (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/newCentralNotice.js
@@ -20,6 +20,8 @@
2121 'loadBanner': function( bannerName ) {
2222 // get the requested banner from /centralnotice/banners/<bannername>/<wgUserLanguage>.js
2323 var bannerPage = 'Special:BannerLoader?banner='+bannerName+'&userlang='+wgContentLanguage+'&sitename='+wgNoticeProject;
 24+ //centralized version:
 25+ //var bannerURL = 'http://meta.wikimedia.org/wiki/'+bannerPage;
2426 var bannerURL = wgArticlePath.replace( '$1', bannerPage );
2527 var request = $.ajax( {
2628 url: bannerURL,
@@ -34,10 +36,14 @@
3537 if ( timestamp ) {
3638 listURL = "TBD"
3739 } else {
38 - listURL = "/centralnotice/"+wgNoticeProject+"/"+wgContentLanguage+".js"
 40+ var geoLocation = 'US'; // Hard-coding for now
 41+ var bannerListPage = 'Special:BannerListLoader?language='+wgContentLanguage+'&project='+wgNoticeProject+'&location='+geoLocation;
 42+ //centralized version:
 43+ //var bannerListURL = 'http://meta.wikimedia.org/wiki/'+bannerListPage;
 44+ var bannerListURL = wgArticlePath.replace( '$1', bannerListPage );
3945 }
4046 var request = $.ajax( {
41 - url: listURL,
 47+ url: bannerListURL,
4248 dataType: 'json',
4349 success: function( data ) {
4450 $.centralNotice.fn.chooseBanner( data );

Follow-up revisions

RevisionCommit summaryAuthorDate
r72997fixing incomplete var rename from r72698kaldari17:36, 14 September 2010
r72998fixing incomplete var rename from r72698 (follow-up to r72997)kaldari17:42, 14 September 2010

Comments

#Comment by Catrope (talk | contribs)   15:59, 14 September 2010
+				//centralized version:
+				//var bannerURL = '[http://meta.wikimedia.org/wiki/'+bannerPage; http://meta.wikimedia.org/wiki/'+bannerPage;]

What are these commented-out assignments for?

 				if ( timestamp ) {
 					listURL = "TBD"
 				} else {
[...]
+					var bannerListURL = wgArticlePath.replace( '$1', bannerListPage );
[...]
+					url: bannerListURL,

You can't define listURL in one branch, define and declare (!) bannerListURL in the other, then use bannerListURL outside of the if-else block.

#Comment by Kaldari (talk | contribs)   17:38, 14 September 2010

The commented out stuff has been removed in r72996. The sloppy var names have been fixed in r72997.

#Comment by Kaldari (talk | contribs)   17:43, 14 September 2010

additional var fix in r72998.

Status & tagging log