User:Para/geonotice.js

var notices = {

WN_SFMLN:

{ begin: '1 February 2008 00:00 UTC',

corners: [ [39.6,-128.3], [35.7,-115.8] ],

text: 'Bay area Wikipedians may be interested in the wikimedia-sf mailing list.'

},

TEST:

{ begin: '15 March 2009 00:00 UTC',

corners: [ [36,35], [34,32] ],

text: 'Party at Cyprus? Join us!'

},

NYC:

{ begin: '15 March 2009 00:00 UTC',

corners: [ [42,-76], [40,-72] ],

text: 'Wikipedia Takes the Bronx Zoo!'

}

/*******************************************

* End of list.

* Edit only above!

*

* Format is:

*

* ID:

* { begin: 'date',

* corners: [ [lat,lon], [lat,lon] ],

* text: 'message'

* }

*

* Don't forget the comma between notices!

*

*******************************************/

}

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

&& minlon

) {

insertsub = document.getElementById('contentSub');

insertsub.innerHTML += '

';

}

}

}

}