MediaWiki:Gadget-geonotice-list.js: Difference between revisions
Appearance
Content deleted Content added
Andrew Gray (talk | contribs) fiddle Oxford |
Andrew Gray (talk | contribs) Seattle |
||
Line 14: | Line 14: | ||
text : "Join one of two Contribution Month in Canada events at London Central Library on 24 and 27 April - [[Wikipedia talk:Contribution Month in Canada#London, Ontario|sign up here]]!" |
text : "Join one of two Contribution Month in Canada events at London Central Library on 24 and 27 April - [[Wikipedia talk:Contribution Month in Canada#London, Ontario|sign up here]]!" |
||
}, |
}, |
||
Seattle May13: |
|||
{ begin : '12 May 2013 00:00 UTC', |
|||
end : '15 May 2013 00:00 UTC', |
|||
corners : [ [47.8,-122.8], [47.2,-121.8] ], |
|||
text : "Join the monthly Wikipedia meetup at Café Allegro in University District, Seattle, at 7pm on Tuesday, May 14, 2013! [[Wikipedia:Meetup/Seattle#Tuesday 14 May 2013|RSVP here!]]. (Note new day - now on the second Tuesday of the month.)" |
|||
}, |
|||
WalsallApril13: |
WalsallApril13: |
Revision as of 21:23, 12 May 2013
var notices = {
WiknicUS:
{ begin: '7 May 2013 00:00 UTC',
end: '23 June 2013 00:00 UTC',
corners: [ [22.8,-69], [48.8,-125.0] ],
text: 'Join the [[Wikipedia:Wiknic|Great American Wiknic]], a Wiki-Picnic being celebrated in 10+ US cities around June 22!'
},
LondonONApril13:
{ begin : '15 April 2013 00:00 UTC',
end : '25 April 2013 00:00 UTC',
corners : [ [42.5,-80.75], [43.5,-81.75] ],
text : "Join one of two Contribution Month in Canada events at London Central Library on 24 and 27 April - [[Wikipedia talk:Contribution Month in Canada#London, Ontario|sign up here]]!"
},
Seattle May13:
{ begin : '12 May 2013 00:00 UTC',
end : '15 May 2013 00:00 UTC',
corners : [ [47.8,-122.8], [47.2,-121.8] ],
text : "Join the monthly Wikipedia meetup at Café Allegro in University District, Seattle, at 7pm on Tuesday, May 14, 2013! [[Wikipedia:Meetup/Seattle#Tuesday 14 May 2013|RSVP here!]]. (Note new day - now on the second Tuesday of the month.)"
},
WalsallApril13:
{
begin: '16 April 2013 12:00 UTC',
end: '1 June 2013 12:00 UTC',
corners:[ [51,-5], [55, 1] ],
text: "A series of [[Wikipedia:GLAM/NAGW|backstage pass tours and editathons]] will be held at The New Art Gallery, Walsall, throughout May and early June 2013. All welcome, but booking essential!"
},
OxfordJournals13:
{
begin: '12 May 2013 12:00 UTC',
end: '24 May 2013 16:00 UTC',
corners:[ [50,1.5], [54,-3] ],
text: "An editathon [[Wikipedia:WikiProject University of Oxford/QueenVictoriasJournals|focusing on the journals of Queen Victoria]] will be held at the Radcliffe Science Library, Oxford, on 24 May. All welcome, but please sign up!"
},
DCGWApril13:
{ begin : '16 April 2013 00:00 UTC',
end : '21 April 2013 00:00 UTC',
corners : [ [40.2, -74.6], [37.3, -78.3] ],
text : "On Saturday, April 20, Wikimedia DC is partnering with the George Washington University to host the [[Wikipedia:Meetup/DC/All Things GW|All Things GW editathon]] at the Teamsters Labor History Research Center. Please join us for behind-the-scenes tours of the University Archives and help edit articles about GWU and DC history."
},
UK130512: /* last 6 chars of ID is date of last amendment in YYMMDD format - change this if making major amendment or adding a meetup; leave alone if minor amendment or removing a meetup */
{
begin: '11 May 2013 12:00 UTC',
end: '9 June 2013 15:00 UTC', /* set this to date of last meetup shown */
corners:[ [60,-9], [50, 2] ],
text: "Interested in having a chat with fellow Wikipedians? There are forthcoming meetups in: [[m:Meetup/Cambridge/18|Cambridge, 18 May]]; [[m:Meetup/Liverpool 8|Liverpool, 18 May]]; and [[m:Meetup/Oxford/5|Oxford, 2 June]]!" /* try to limit this to four meetups, no more than one per town/city, and no more than four weeks in advance; shorten month names to three letters if four meetups are shown */
}
/*******************************************
* End of list.
* Edit only above!
*tt
* Format is:
*
* ID:
* { begin: 'date',
* end: 'date',
* corners: [ [lat,lon], [lat,lon] ],
* text: 'message'
* }
*
* There should be commas between the notices, but not after the last one. BE SURE TO ESCAPE YOUR APOSTROPHES (put a backslash in front of it, like this: \')!
* Use [[meta:w:en:link|link]] format for internal links, so that they work properly on the other projects where the geonotice is displayed.
*
*******************************************/
};
function geoWikiLinker (str, page, text) {
text = text || page;
return mw.html.element(
'a', {
href: mw.util.wikiGetlink( page ),
title: page
}, text
);
}
if ( Geo !== undefined ) {
var now = new Date(),
id, notice, insertsub, minlat, maxlat, minlon, maxlon, firstnotice=true,
regexForInternalLinks = /\[\[([^{|}\[\]\n]+)(?:\|(.*?))?\]\]/g;
for (id in notices) {
if (!document.cookie.match('hidegeonotice'+id+'=1')) {
notice = notices[id];
if (!notice || !notice.corners) {
continue;
}
minlat = Math.min(notice.corners[0][0], notice.corners[1][0]);
maxlat = Math.max(notice.corners[0][0], notice.corners[1][0]);
minlon = Math.min(notice.corners[0][1], notice.corners[1][1]);
maxlon = Math.max(notice.corners[0][1], notice.corners[1][1]);
if ( now.getTime() > Date.parse(notice.begin)
&& now.getTime() < Date.parse(notice.end)
&& minlat<Geo.lat && Geo.lat<maxlat
&& minlon<Geo.lon && Geo.lon<maxlon
) {
if (firstnotice) {
firstnotice = false;
$('#watchlist-message').prepend('<hr>');
mw.util.addCSS( [
'#watchlist-message .geonotice {',
'width:98%;',
'background:transparent;',
'text-align:left;',
'line-height:1.8em;',
'}',
'#watchlist-message .geonotice span {',
'font-size:144.5%;',
'}',
'#watchlist-message .geonotice small {',
'font-style:italic;',
'}'
].join( ' ' ) );
}
$('#watchlist-message').prepend(
'<li class="geonotice plainlinks" id="geonotice'+id+'">'+
'<span>'+notice.text.replace( regexForInternalLinks, geoWikiLinker )+'</span> '+
'<small>['+
'<a href="#" onClick="'+
'var date = new Date();'+
'date.setTime(date.getTime()+8640000000);'+
'document.cookie = \'hidegeonotice'+id+'=1;'+
'expires=\' + date.toGMTString() + \';'+
'path=/\';'+
'document.getElementById(\'geonotice'+id+'\').style.visibility = \'hidden\';'+
'return false;'+
'">hide</a>'+
']</small></li>');
}
}
}
}