Page MenuHomeWickedGov Phorge

ext.centralNotice.freegeoipLookup.js
No OneTemporary

Size
774 B
Referenced Files
None
Subscribers
None

ext.centralNotice.freegeoipLookup.js

/**
* Provides a callback that ext.centralNotice.geoIP can use to fetch geo data
* from freegeoip.net. Returns a promise that resolves with this data. If no
* GeoIP cookie is present, mw.geoIP may use the callback, if configured to do
* so.
* TODO Move this out of CentralNotice. See https://phabricator.wikimedia.org/T102848
*/
( function () {
var GEOIP_LOOKUP_URL = '//freegeoip.net/json/';
module.exports = function () {
return $.ajax( {
url: GEOIP_LOOKUP_URL,
dataType: 'jsonp'
} ).then( function ( data ) {
var geo = {
country: data.country_code,
region: data.region_code,
city: data.city,
lat: data.latitude,
lon: data.longitude
};
// This value will be picked up by done() handlers
return geo;
} );
};
}() );

File Metadata

Mime Type
text/plain
Expires
Fri, Jul 3, 19:37 (1 d, 4 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
12/6c/4a031d445831942d46223a63cc5c
Default Alt Text
ext.centralNotice.freegeoipLookup.js (774 B)

Event Timeline