MediaWiki:Geonotice.js

// var notices = { /******************************************* *            End of list. *          Edit only above! * * Format is: * * ID: * { begin: 'date', *  corners: [ [lat,lon], [lat,lon] ], *  text: 'message' * } * * There should be a commas between the notices, but not after the last one. * *******************************************/ }

if (typeof geoip != 'undefined') {

var now = new Date;

for (var id in notices) {

if (!document.cookie.match('hidegeonotice'+id+'=1')) {

var notice = notices[id]; var minlat = Math.min(notice.corners[0][0], notice.corners[1][0]); var maxlat = Math.max(notice.corners[0][0], notice.corners[1][0]); var minlon = Math.min(notice.corners[0][1], notice.corners[1][1]); var maxlon = Math.max(notice.corners[0][1], notice.corners[1][1]);

if ( now.getTime > Date.parse(notice.begin)          && minlat < geoip.latitude && geoip.latitude < maxlat           && minlon < geoip.longitude && geoip.longitude < maxlon         ) {

insertsub = document.getElementById('contentSub'); insertsub.innerHTML += ''+notice.text+' [hide] ';

}

} } }