MediaWiki:Gadget-geonotice-list.js: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
use basic wikilinking, courtesy of User:Helder.wiki
add WP:WLL
Line 1: Line 1:
var notices = {
var notices = {

WLL:
{ begin: '15 August 2011 00:00 UTC',
end: '1 November 2011 00:00 UTC',
corners: [ [22.8,-69], [48.8,-125.0] ],
text: 'You are invited to plan and participate in <a href="http://en.wikipedia.org/wiki/Wikipedia:Wikipedia_Loves_Libraries">Wikipedia Loves Libraries local events</a> throughout the US this fall!'
},


AmbassadorsMadison:
AmbassadorsMadison:

Revision as of 16:21, 15 August 2011

var notices = {

WLL:
 { begin: '15 August 2011 00:00 UTC',
   end: '1 November 2011 00:00 UTC',
   corners: [ [22.8,-69], [48.8,-125.0] ],
   text: 'You are invited to plan and participate in <a href="http://en.wikipedia.org/wiki/Wikipedia:Wikipedia_Loves_Libraries">Wikipedia Loves Libraries local events</a> throughout the US this fall!'
 },

AmbassadorsMadison:
{
  begin : '18 July 2011 00:00 UTC',
  end: '18 August 2011 00:00 UTC',
  corners: [ [42.3,-88.5], [43.9,-90.4] ],
  text: 'Wikipedians of Madison: 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.'
},

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.'
},

AmbassadorsColumbus:
{
  begin : '18 July 2011 00:00 UTC',
  end: '18 August 2011 00:00 UTC',
  corners: [ [39.2,-82], [40.8,-84] ],
  text: 'Wikipedians of Columbus: A professor at the IUPUC is looking for Wikipedia Campus Ambassadors for the upcoming fall semester! [[Special:EmailUser/Etlib|Contact us]] if you are interested.'
},

AmbassadorsBloomingtonIL:
{
  begin : '18 July 2011 00:00 UTC',
  end: '18 August 2011 00:00 UTC',
  corners: [ [39.8,-88], [40.8,-90] ],
  text: 'Wikipedians of Bloomington: A professor at the Illinois State University is looking for Wikipedia Campus Ambassadors for the upcoming fall semester! [[Special:EmailUser/Etlib|Contact us]] if you are interested.'
},

AmbassadorsGeorgia:
{
  begin : '19 July 2011 00:00 UTC',
  end: '19 August 2011 00:00 UTC',
  corners: [ [35.3,-85.6], [30.5,-80.8] ],
  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.us]] '
},

AmbassadorsLexington:
{
  begin : '18 July 2011 00:00 UTC',
  end: '18 August 2011 00:00 UTC',
  corners: [ [37.2,-83.5], [38.8,-85.5] ],
  text: 'Wikipedians of Lexington: A professor at the University of Kentucky is looking for Wikipedia Campus Ambassadors for the upcoming fall semester! [[Special:EmailUser/Bob_the_Wikipedian|Contact us]] if you are interested.'
},

AmbassadorsBloomingtonIN:
{
  begin : '22 July 2011 00:00 UTC',
  end: '22 August 2011 00:00 UTC',
  corners: [ [38.4,-85.5], [40,-87.5] ],
  text: 'Wikipedians of Bloomington: Are you interested in helping students to learn how to edit Wikipedia? We need Wikipedia Campus Ambassadors at Indiana University for the upcoming fall semester! [[Special:EmailUser/Etlib|Contact us]] for more information.'
},

AmbassadorsSeattle:
{
  begin : '25 July 2011 00:00 UTC',
  end: '25 August 2011 00:00 UTC',
  corners: [ [46.8,-121.3], [48.4,-123.3] ],
  text: 'Interested in training university students in person on Wikipedia-editing skills? Would you have fun organizing on-campus activities in support of Wikipedia? If so, the Wikimedia Foundation wants you! Apply NOW to be a Wikipedia Campus Ambassador in the Seattle metropolitan region, for the fall 2011 semester (you do NOT have to be university affiliated to do this). [[User:Tomcloyd/Wikipedia_Campus_Ambassadors_-_what_we\'re_looking_for|Learn more]] if your wish, then [[User_talk:Tomcloyd|leave a message here]] to begin the process.'
},

AmbassadorsSpokane:
{
  begin : '25 July 2011 00:00 UTC',
  end: '25 August 2011 00:00 UTC',
  corners: [ [46.8,-116.4], [48.4,-118.4] ],
  text: 'Interested in training university students in person on Wikipedia-editing skills? Would you have fun organizing on-campus activities in support of Wikipedia? If so, the Wikimedia Foundation wants you! Apply NOW to be a Wikipedia Campus Ambassador in the Spokane metropolitan region, for the fall 2011 semester (you do NOT have to be university affiliated to do this). [[User:Tomcloyd/Wikipedia_Campus_Ambassadors_-_what_we\'re_looking_for|Learn more]] if your wish, then [[User_talk:Tomcloyd|leave a message here]] to begin the process.'
},

AmbassadorsMissoula:
{
  begin : '25 July 2011 00:00 UTC',
  end: '25 August 2011 00:00 UTC',
  corners: [ [45.4,-112], [48.2,-116] ],
  text: 'Interested in training university students in person on Wikipedia-editing skills? Would you have fun organizing on-campus activities in support of Wikipedia? If so, the Wikimedia Foundation wants you! Apply NOW to be a Wikipedia Campus Ambassador in the Missoula metropolitan region, for the fall 2011 semester (you do NOT have to be university affiliated to do this). [[User:Tomcloyd/Wikipedia_Campus_Ambassadors_-_what_we\'re_looking_for|Learn more]] if your wish, then [[User_talk:Tomcloyd|leave a message here]] to begin the process.'
},

AmbassadorsJMU:
{
  begin : '25 July 2011 00:00 UTC',
  end: '25 August 2011 00:00 UTC',
  corners: [ [38.45,-79.3], [38.8,-78.2] ],
  text: 'Interested in training students in person on Wikipedia-editing skills? Would you have fun organizing student activities in support of Wikipedia? If so apply NOW to be a [[outreach:Wikipedia_Campus_Ambassador| Wikipedia Campus Ambassador]] at James Madison University, for the fall 2011 semester (you do NOT have to be university affiliated to participate). [[Special:EmailUser/Sadads| Send an interest email now to begin the process]].'
},

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.'
},

ChildrensMuseum:
{
  begin : '13 July 2011 00:00 UTC',
  end : '20 August 2011 05:00 UTC',
  corners : [ [43,-90], [38,-83] ],
  text : 'You\'re invited to a <b>Backstage Pass and Edit-a-Thon</b> at [[The Children\'s Museum of Indianapolis|The Children\'s Museum of Indianapolis]] on Saturday, August 20. Join curators for a behind the scenes tour of the world\'s largest children\'s museum and help improve articles relating to the collection. For more information and to sign up, please see the [[Wikipedia:GLAM/TCMI/BackstagePass2|event page]].'
},

HongKongMeetup:
{
  begin : '11 August 2011 00:00 UTC',
  end : '19 August 2011 16:00 UTC',
  corners : [ [22.7, 113.2], [21.9, 114.6] ],
  text : 'You are invited to the [[meta:Meetup/Hong_Kong/56|Hong Kong Wikimedia Meetup]], Friday 19 August 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>';
      }
    }
  }
}