MediaWiki:Gadget-geonotice-list.js: Difference between revisions
Appearance
Content deleted Content added
Killiondude (talk | contribs) slight adjustment per prev edit sum |
Killiondude (talk | contribs) convert url to wikilink |
||
Line 5: | Line 5: | ||
end: '30 August 2011 00:00 UTC', |
end: '30 August 2011 00:00 UTC', |
||
corners: [ [45,-70], [50,-80] ], |
corners: [ [45,-70], [50,-80] ], |
||
text: 'You are invited to participate in |
text: 'You are invited to participate in [[Wikipedia:Wikipedia Takes Montreal|Wikipedia Takes Montreal]], a photo scavenger hunt with more than $1,000 in prizes, on August 28th. Invite your friends to form a team; anyone can participate!' |
||
}, |
}, |
||
Line 12: | Line 12: | ||
end: '1 November 2011 00:00 UTC', |
end: '1 November 2011 00:00 UTC', |
||
corners: [ [19,-50], [84,-165] ], |
corners: [ [19,-50], [84,-165] ], |
||
text: 'You are invited to plan and participate in |
text: 'You are invited to plan and participate in [[Wikipedia:Wikipedia Loves Libraries|Wikipedia Loves Libraries local events]] throughout North America this fall!' |
||
}, |
}, |
||
Revision as of 22:41, 29 August 2011
var notices = {
Montreal:
{ begin: '26 August 2011 00:00 UTC',
end: '30 August 2011 00:00 UTC',
corners: [ [45,-70], [50,-80] ],
text: 'You are invited to participate in [[Wikipedia:Wikipedia Takes Montreal|Wikipedia Takes Montreal]], a photo scavenger hunt with more than $1,000 in prizes, on August 28th. Invite your friends to form a team; anyone can participate!'
},
WLL:
{ begin: '15 August 2011 00:00 UTC',
end: '1 November 2011 00:00 UTC',
corners: [ [19,-50], [84,-165] ],
text: 'You are invited to plan and participate in [[Wikipedia:Wikipedia Loves Libraries|Wikipedia Loves Libraries local events]] throughout North America this fall!'
},
AmbassadorsKenosha:
{
begin : '31 July 2011 00:00 UTC',
end: '31 August 2011 00:00 UTC',
corners: [ [42.4,-86.9], [43.3,-88.0] ],
text: 'Wikipedians of Kenosha: A professor at Carthage is looking for Wikipedia Campus Ambassadors for the upcoming fall semester! [[Special:EmailUser/Bob_the_Wikipedian|Contact us]] if you are interested.'
},
AmbassadorsLaCrosse:
{
begin : '31 July 2011 00:00 UTC',
end: '31 August 2011 00:00 UTC',
corners: [ [43.0,-90.3], [44.6,-92.1] ],
text: 'Wikipedians of La Crosse: A professor at the University of Wisconsin is looking for Wikipedia Campus Ambassadors for the upcoming fall semester! [[Special:EmailUser/Bob_the_Wikipedian|Contact us]] if you are interested.'
},
AmbassadorsBoston:
{ begin: '27 July 2011 00:00 UTC',
end: '27 August 2011 00:00 UTC',
corners: [ [43.2,-71.5], [40.9,-69.5] ],
text: 'Boston Wikipedians: interested in training students in person on Wikipedia-editing skills? If so apply NOW to be a Wikipedia Campus Ambassador. [[Special:EmailUser/Maximilianklein|Contact us if you are interested.]]'
},
AmbassadorsNewOrleans:
{
begin : '2 August 2011 00:00 UTC',
end: '30 August 2011 00:00 UTC',
corners: [ [29.2,-89], [30.8,-91] ],
text: 'Interested in training university students in person on Wikipedia-editing skills? Will you have fun organizing on-campus activities in support of Wikipedia? If so, the Wikimedia Foundation wants you! [[User_talk:Alin_(Public_Policy)#For_Fall_2011|Apply to be a Wikipedia Campus Ambassador in your region for the fall 2011 semester.]]'
},
AmbassadorsStPetersburgFL:
{
begin : '2 August 2011 00:00 UTC',
end: '30 August 2011 00:00 UTC',
corners: [ [27,-81.7], [28.6,-83.7] ],
text: 'Interested in training university students in person on Wikipedia-editing skills? Will you have fun organizing on-campus activities in support of Wikipedia? If so, the Wikimedia Foundation wants you! [[User_talk:Alin_(Public_Policy)#For_Fall_2011|Apply to be a Wikipedia Campus Ambassador in your region for the fall 2011 semester.]]'
},
AmbassadorsTuscaloosaAL:
{
begin : '2 August 2011 00:00 UTC',
end: '30 August 2011 00:00 UTC',
corners: [ [32.4,-86.5], [34,-88.5] ],
text: 'Interested in training university students in person on Wikipedia-editing skills? Will you have fun organizing on-campus activities in support of Wikipedia? If so, the Wikimedia Foundation wants you! [[User_talk:Alin_(Public_Policy)#For_Fall_2011|Apply to be a Wikipedia Campus Ambassador in your region for the fall 2011 semester.]]'
},
AmbassadorsClevelandOH:
{
begin : '3 August 2011 00:00 UTC',
end: '30 August 2011 00:00 UTC',
corners: [ [41,-87.1], [42,-89.1] ],
text: 'Wikipedians of Cleveland: Are you interested in helping students to learn how to edit Wikipedia? We need Wikipedia Campus Ambassadors at Case Western Reserve University for the upcoming fall semester! [[Special:EmailUser/Etlib|Contact us]] for more information.'
},
AmbassadorsChicagoIL:
{
begin : '3 August 2011 00:00 UTC',
end: '30 August 2011 00:00 UTC',
corners: [ [41,-80.7], [42.3,-82] ],
text: 'Chicagoland Wikipedians: Are you interested in helping students to learn how to edit Wikipedia? We need Wikipedia Campus Ambassadors at Lewis University for the upcoming fall semester! [[Special:EmailUser/Etlib|Contact us]] for more information.'
},
HongKongMeetup:
{
begin : '4 September 2011 00:00 UTC',
end : '16 September 2011 16:00 UTC',
corners : [ [22.7, 113.2], [21.9, 114.6] ],
text : 'You are invited to the [[meta:Meetup/Hong_Kong/57|Hong Kong Wikimedia Meetup]], Friday 16 September from 19:00 at Think Cafe, Causeway Bay.'
}
/*******************************************
* End of list.
* Edit only above!
*
* 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.
*
*******************************************/
};
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,
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
) {
insertsub = document.getElementById('contentSub');
mw.util.addCSS( [
'#contentSub .geonotice {',
'width:98%;',
'margin:5px auto 0;',
'background:transparent;',
'text-align:left;',
'line-height:1.8em;',
'}',
'#contentSub .geonotice span {',
'font-size:170%;',
'}',
'#contentSub .geonotice small {',
'font-style:italic;',
'}'
].join( ' ' ) );
insertsub.innerHTML +=
'<div 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></div>';
}
}
}
}