Jdlrobson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/213986

Change subject: Hygiene: Officially deprecate global functions
......................................................................

Hygiene: Officially deprecate global functions

Change-Id: Idfa3ba83462f955400b07cb9c13a2f5c550c76d6
---
M modules/ext.centralNotice.bannerController/bannerController.js
1 file changed, 10 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralNotice 
refs/changes/86/213986/1

diff --git a/modules/ext.centralNotice.bannerController/bannerController.js 
b/modules/ext.centralNotice.bannerController/bannerController.js
index 5533e59..bec6dc0 100644
--- a/modules/ext.centralNotice.bannerController/bannerController.js
+++ b/modules/ext.centralNotice.bannerController/bannerController.js
@@ -383,7 +383,7 @@
                        // so will force dual-stack users to fall back to IPv4.
                        if ( mw.centralNotice.data.country === 'XX' ) {
                                $.ajax( {
-                                       url: '//geoiplookup.wikimedia.org/',
+                                       url: 'foo',
                                        dataType: 'script',
                                        cache: true
                                } ).always( function () {
@@ -417,8 +417,7 @@
        // banner was specifically requested via banner= the record impression 
call
        // will NOT be made.
        //
-       // TODO: Migrate away from global functions
-       window.insertBanner = function ( bannerJson ) {
+       mw.centralNotice.insertBanner = function ( bannerJson ) {
                var url, targets, durations, cookieName, cookieVal, deleteOld, 
now,
                        parsedCookie, bucket;
 
@@ -541,7 +540,7 @@
        };
 
        // Function for hiding banners when the user clicks the close button
-       window.hideBanner = function () {
+       mw.centralNotice.hideBanner = function () {
                var d = new Date(),
                        cookieVal = {
                                v: 1,
@@ -577,10 +576,15 @@
        };
 
        // This function is deprecated
-       window.toggleNotice = function () {
-               window.hideBanner();
+       mw.centralNotice.toggleNotice = function () {
+               this.hideBanner();
        };
 
+       // Deprecation notices:
+       mw.log.deprecate( window, 'insertBanner', 
mw.centralNotice.insertBanner, 'Use mw.centralNotice method instead' );
+       mw.log.deprecate( window, 'hideBanner', mw.centralNotice.hideBanner, 
'Use mw.centralNotice method instead' );
+       mw.log.deprecate( window, 'toggleNotice', 
mw.centralNotice.toggleNotice, 'Use mw.centralNotice method instead' );
+
        // Initialize CentralNotice
        $( function() {
                mw.centralNotice.initialize();

-- 
To view, visit https://gerrit.wikimedia.org/r/213986
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idfa3ba83462f955400b07cb9c13a2f5c550c76d6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to