Jump to content

User:Richardguk/Geonotice.js sandbox

From Wikipedia, the free encyclopedia

//

var notices = {

NYCmail: 
 { begin: "21 March 2010 00:00 UTC",
   end: "1 January 2020 00:00 UTC",
   corners: [ [42,-76], [40,-72] ],
   text: "You are invited to join the  <a href='https://lists.wikimedia.org/mailman/listinfo/wikimedia_nyc'>Wikimedia New York City area mailing list</a>!"
 },

PAmail:
 { begin: "16 November 2009 00:00 UTC",
   end: "1 January 2020 00:00 UTC",
   corners: [ [40.5,-77], [39.5,-73] ],
   text: "You are invited to join the  <a href='https://lists.wikimedia.org/mailman/listinfo/wikimediapa-l'>Philadelphia area and Pennsylvania mailing list</a>!"
 }, 

SyracuseAmbassadors:
 { begin: "24 June 2010 21:45 UTC",
   end: "2 July 2010 00:00 UTC",
   corners: [ [43.5,-76.8], [42.5,-75.4] ],
   text: "Wanted: Wikipedians living near Syracuse University. The Wikimedia Foundation outreach team is recruiting Wikipedia Campus Ambassadors to train students and professors on the basics of the wiki. <a href='http://en.wikipedia.org/wiki/Wikipedia:WikiProject_United_States_Public_Policy/Campus_Ambassadors#Wanted:_Wikipedia_Campus_Ambassadors'>Apply today</a>!"
 },

IndianaAmbassadors:
 { begin: "1 July 2010 00:15 UTC",
   end: "8 July 2010 00:00 UTC",
   corners: [ [40.4,-87.7], [38,-85.3] ],
   text: "Wanted: Wikipedians living near Indiana University Bloomington. The Wikimedia Foundation outreach team is recruiting Wikipedia Campus Ambassadors to train students and professors on the basics of the wiki. <a href='http://en.wikipedia.org/wiki/Wikipedia:WikiProject_United_States_Public_Policy/Campus_Ambassadors#Wanted:_Wikipedia_Campus_Ambassadors'>Apply today</a>!"
 },

HarvardAmbassadors:
 { begin: "1 July 2010 00:15 UTC",
   end: "8 July 2010 00:00 UTC",
   corners: [ [43.2,-72.2], [40.8,-69.8] ],
   text: "Wanted: Wikipedians living near Harvard University. The Wikimedia Foundation outreach team is recruiting Wikipedia Campus Ambassadors to train students and professors on the basics of the wiki. <a href='http://en.wikipedia.org/wiki/Wikipedia:WikiProject_United_States_Public_Policy/Campus_Ambassadors#Wanted:_Wikipedia_Campus_Ambassadors'>Apply today</a>!"
 },

DCAmbassadors:
 { begin: "1 July 2010 00:15 UTC",
   end: "8 July 2010 00:00 UTC",
   corners: [ [40.2,-78.2], [37.8,-75.8] ],
   text: "Wanted: Wikipedians living near Georgetown University and George Washington University. The Wikimedia Foundation outreach team is recruiting Wikipedia Campus Ambassadors to train students and professors on the basics of the wiki. <a href='http://en.wikipedia.org/wiki/Wikipedia:WikiProject_United_States_Public_Policy/Campus_Ambassadors#Wanted:_Wikipedia_Campus_Ambassadors'>Apply today</a>!"
 },

PrincetonAmbassadors:
 { begin: "1 July 2010 00:15 UTC",
   end: "8 July 2010 00:00 UTC",
   corners: [ [41.2,-76.2], [38.8,-73.8] ],
   text: "Wanted: Wikipedians living near Princeton University. The Wikimedia Foundation outreach team is recruiting Wikipedia Campus Ambassadors to train students and professors on the basics of the wiki. <a href='http://en.wikipedia.org/wiki/Wikipedia:WikiProject_United_States_Public_Policy/Campus_Ambassadors#Wanted:_Wikipedia_Campus_Ambassadors'>Apply today</a>!"
 },

LondonWikinotice:
 { begin: "1 July 2010 00:00 UTC",
   end: "4 July 2010 13:00 UTC",
   corners: [ [60,-9], [49,2] ],
   text: "You are invited to the 35<sup>th</sup> <a href='http://meta.wikimedia.org/wiki/Meetup/London/35' title='Meetup/London/35'>London Wikimedia meetup</a> on Sunday 4 July 2010 from 13.00 onwards in Penderel's Oak, Holborn."
 },

Bostonjuly:
 { begin: "1 July 2010 00:00 UTC",
   end: "13 July 2010 01:00 UTC",
   corners: [ [43,-73], [41,-70] ],
   text: "There will be a Wikipedia meetup in Cambridge on July 12 at 7:00 PM. We will meet at Le's Restaurant in Harvard Square. You are invited!  See <a href='http://en.wikipedia.org/wiki/Wikipedia:Meetup/Boston'>our meetup page</a> for more information."
 }

/*******************************************
 *             End of list.
 *           Edit only above!
 *
 * Format is:
 * 
 * ID:
 * { begin: "date",
 *   end: "date",
 *   corners: [ [lat,lon], [lat,lon] ],
 *   text: "message"
 * }[,]
 *
 * Use single quotes for any HTML attributes or \" to escape any double quotes.
 *
 * There should be a comma after each notice except 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)
           && now.getTime() < Date.parse(notice.end)
           && minlat<geoip.latitude && geoip.latitude<maxlat
           && minlon<geoip.longitude && geoip.longitude<maxlon
         ) {

        insertsub = document.getElementById("contentSub");
        insertsub.innerHTML  = "<div class='plainlinks' id='geonotice" id "' style='width:98%; margin:5px auto 0; background:transparent; text-align:left; line-height: 1.8em;'><font size=' 1'>" notice.text "</font> <small><i>[<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>]</i></small></div>";

      }

    }
  }
}


//