User:Kakurady/Convention map script

/* OBSOLETE: This powered Kakurady's copy of the map of active conventions.

The current live version is at this one; new data should be added here.

Further experimentation will happen at https://github.com/Kakurady/FurryConventionMap. */

var map = null; var infoWindow = null; var meets = [];

// number of conventions in different areas, displayed in drop down var count = 0; var count_na = 0; var count_eu = 0; var count_oceania = 0; var count_others = 0;

//constants specifying which region is selected in the drop down var FILT_ALL = 0; var FILT_NA = 1; var FILT_EU = 2; var FILT_OCEANIA = 3; var FILT_OTHERS = 4;

//These functions are used to classify conventions into regions //They are hacks; function only be accurate for existing data function is_in_na(lat, lng){ return (lat > 21 && lat < 75 &&                lng > -144 && lng < -48); } function is_in_eu(lat, lng){ return (lat > 36 && lat < 75 &&                lng > -13 && lng < 32); } function is_in_oceania(lat, lng){ return (lat > -50 && lat < -5 &&                lng > 110 && lng < 180); } var is_phone = false; function load { var useragent = navigator.userAgent; is_phone = (useragent.indexOf('iPhone') != -1 || useragent.indexOf('Android') != -1) //TODO support other phones that support tel: protocol? if (useragent.indexOf('iPhone') != -1 || useragent.indexOf('Android') != -1) { //working around Android Browser having no scroll bar (Fennec/Firefox Mobile has no bar, but can scroll inside divs) //document.getElementById("map").style.position="fixed"; //Google Maps will undo this document.getElementById("side").style.height="auto"; document.getElementById("side").style.overflow="auto";

} if (true) {

var mapNode = document.getElementById("map");

markers = [];

// Set initial position // These values are assuming a 1280x800 monitor with 96dpi. // it would be nice to scale this according to client area size var centerLatLng = new google.maps.LatLng(40,-40); var mapOpts = { zoom: 3, center: centerLatLng, mapTypeId: google.maps.MapTypeId.ROADMAP, streetViewControl: true }; // creating map map = new google.maps.Map(mapNode, mapOpts); infoWindow = new google.maps.InfoWindow({}); // Add map points // Format: addLocation(latitude, longitude, 'Name', 'website', 'Place name Street City, State Code Country', 'Phone Number', 'Mon[th] 1-3 20XX', attendance); addLocation(-24.097951,-48.371558, 'Abando', 'abando.com.br', 'São Roque, São Paulo Brazil', '', 'Feb 9-12 2013', 50); //addLocation(-37.891950, -57.832850, 'Animales Sueltos', 'furrycamp.com.ar', 'Camping \'La Serranita\' barrio Colinas Verdes Mar del Plata Argentina', '', 41); addLocation(40.444334, -79.995532, 'Anthrocon', 'www.anthrocon.org', 'Westin Convention Center Pittsburgh 1000 Penn Avenue Pittsburgh, Pennsylvania 15222 USA', '+1 (412) 281-3700', 'Jul 4-7 2013', '5179'); addLocation(52.597652, 13.22226, 'BerliCon', 'www.berlicon.org', 'Zeltlagerplatz e.V. Rallenweg 4,13505 Berlin-Heiligensee Germany', '', 'Jun 21-24 2012', 35); //addLocation(61.599498,  9.750860, 'CabinCon', 'swandog.livejournal.com', 'Vinstra Norway', '');//not on list, website is private addLocation(39.077092, -74.830348, 'Cape May Fur Meet', 'capemayfurmeet.com', 'Middle Township Elementary School #2 101 West Pacific Ave, Cape May Court House Middle, New Jersey 08210 USA', '', 'May 19-20 2012', 3); addLocation(33.679673,-117.852488, 'Califur', 'califur.com', 'Irvine Marriott 18000 Von Karman Avenue Irvine, California, 92614 USA', '+1 (949) 553-0100', 'Jun 1-3 2012', 919); addLocation(43.721056,-121.291552, 'Campfire Tails', 'campfiretails.com', 'Ogden Group Camp C Paulina Lake La Pine, Oregon USA', '', 'Aug 2-6 2012', 100); addLocation(38.9439, -95.3385, 'Central Midwest Furmeet', 'cmfurmeet.webs.com', ' Bloomington West Group Camp at Clinton Lake near Lawrence, Kansas', '', 'Sep 14-16 2012', 22); addLocation(50.176635, 14.355700, 'ČeSFuR', 'www.cesfur.org', 'Hotel Vltava 250 68 Rez u Prahy Czech Republic', '+420 220 940 759', 'Jul 5-8 2012', 86); addLocation(50.94149, 6.94651, 'Cologne Furdance', 'www.cologne-cfd.de', 'Zeughaus24, Zeughausstraße 24, 50667 Köln, Germany', '', 'Nov 10 2012'); //Colonge Fur-Dance, Germany, June/November addLocation(42.930358, -81.218609, 'Condition', 'www.conditionfurry.ca', 'Four Points Sheraton 1150 Wellington Road South London, Ontario N6E 1M3 Canada', '+1 (519) 681-0600', 'Jul 27-29 2012', 251); addLocation(53.415679,	-2.247281, 'ConFuzzled', 'confuzzled.org.uk', 'Britannia Country House Hotel Palatine Road Didsbury Manchester M20 2WG England', 'N/A', 'May 25-28 2012', 725); addLocation(41.80347,-88.120222, 'Duckon', 'www.duckon.org', 'Naperville Holiday Inn Select 1801 Naper Blvd Naperville, IL 60563 United States', '', 'Jun 1-3 2012'); addLocation(51.283333, 11.566667, 'EAST', 'www.east-con.de.vu', , , 'Sep 27-30'); addLocation(28.33704,-81.587777, 'Elliott\'s Live Events', 'ele.furryhost.com', 'Radisson Resort Worldgate 3011 Maingate Lane, Kissimmee, FL 34747, United States','', "Year-round", 215);//May21-23, Aug7-8, Oct30-31 addLocation(50.616714, 10.723858, 'Eurofurence', 'eurofurence.org', 'Ringberg Resort Hotel Ringberg 10 D-98527 Suhl Germany', '+49 36 81/3 89-0', 'Aug 29-Sep 2 2012', 1066); addLocation(40.703546, -74.184279, 'FA: United', 'faunited.org', 'Hanover Marriott 1401 Rt 10 E Whippany, NJ 07981 USA', '+1 (973) 538 8811 ', 'Aug 17-19 2012', 531); addLocation(45.880449, -78.564606, 'Feral!', 'campferal.org', 'Camp Arowhon Algonquin Park, Ontario P1H 2G6 Canada', '+1 (705) 633-5651', 'Aug 24-28 2012', 94); addLocation(62.02209, 30.0185, 'FinFur', 'ffsc.finfur.net', , , 'Jul 11-15'); addLocation(-38.625454,176.090927, 'FurcoNZ', 'www.furconz.org.nz', 'Kiwanis and Huia Lodges, HuiaWaitakere Ranges Regional Park Auckland New Zealand', '', 'Dec 14-17 2012', 50); addLocation(-28.00041, 153.4264, 'FurDU', 'www.furrydownunder.com', 'Vibe Hotel Gold Coast 42 Ferny Avenue, Surfers Paradise, QLD 4217 Australia', '', 'Apr 27-29 2012', 246); addLocation(53.541723, -113.625262, 'Fur-eh!', 'fureh.ca', 'Hilton Garden Inn 17610 Stony Plain Road Edmonton, Alberta, T5S 1A2 Canada', '+1 (780) 443-2233', 'May 4-6 2012', 200); addLocation(41.542706, -72.970258, 'FurFright', 'furfright.org', 'Crowne Plaza Cromwell 100 Berlin Road Cromwell, CT 06416 USA', '+1 (888) 233-9527', 'Oct 26-28 2012', 1485); addLocation(-33.859972, 151.211111, 'FurJam', 'www.furjam.org', ' Forresters Hotel 336 Riley Street Surry Hills NSW 2010 Australia', '(02) 9212 3035', 'Oct 7-9 2012'); addLocation(39.983333, -82.983333, 'Furlaxation', 'furlaxation.org', , , 'Sept 28-30 2012'); addLocation(28.542401, -81.347945, 'Furloween', 'www.furhold.org/furloween', 'Orlando Elks Lodge 12 North Primrose Dr. Orlando, Florida 32803 USA', '+1 (407) 282-3900', 'Oct 29 2011', 148); addLocation(43.689551, -79.586356, 'Furnal Equinox', 'furnalequinox.com', 'Sheraton Toronto Airport Hotel & Conference Centre 801 Dixon Road Toronto, ON M9W 1J3 Canada', '+1 (416) 675-6100', 'Mar 8-10 2013', 651); addLocation(42.441891, -83.434789, 'Furry Connection North', 'furryconnectionnorth.com', 'Shearton Detroit Novi 21111 Haggerty Road Novi, Michigan 48375 USA', '+1 (248) 349-4000', 'Apr 13-15 2012', 1179); addLocation(28.401971, -80.618792, 'Furry Cruise', 'www.furrycruise.com', 'Royal Caribbean\'s Freedom of the Seas Port Canaveral, Florida USA', '+1 (734) 340-4553', 'Dec 2-7 2012', 24); addLocation(32.9455, -96.8398, 'Furry Fiesta', 'www.furryfiesta.org', 'Crowne Plaza Hotel 14315 Midway Road Addison, Texas 75001 USA','+1 (972) 980-8877', 'Feb 22-24 2013', 1210); addLocation(33.626091, -84.451776, 'Furry Weekend Atlanta', 'furryweekend.com', 'Westin Peachtree Plaza 210 Peachtree St Atlanta, GA 30303 USA', '+1 (404) 659-1400', 'Mar 14-17 2012', 1902); addLocation(51.40328, 5.95940, 'Furs on Fire', 'www.fursonfire.eu', 'Evertsoord, The Netherlands', '', 'Dec 29-Jan 1 2013'); addLocation(52.588333, 14.65, 'Furstock', 'www.polfurs.org', , , 'Aug 4-6 2011'); addLocation(57.05, 9.916667, 'Furtastic', 'www.furtastic.dk', 'Denmark', '', 'Jul 2012?'); addLocation(37.330294,-121.888375, 'Further Confusion', 'furtherconfusion.org', 'San Jose Mariott 301 South Market Street San Jose, CA 95113 USA', '+1 408-280-1300', 'Jan 17-21 2013', 3021); addLocation(51.388923,-115.784912, 'Furthest North', 'furthestnorth.ca', 'Deer Creek Provincial Recreation Area Alberta Canada', '+1 (403) 637-2229', 'Aug 3-6 2012', 63); addLocation(51.93180, 19.407, 'Futrzakon', 'www.futrzakon.org', 'Municipal Cultural Center 95-001 Dzierżązna Poland', '42 717 84 66', 'Aug 8-11 2012', 67); addLocation(47.35016, 7.76123, 'Golden Leaves Con', 'glc.furry.ch', 'Baselbieter Chinderhus Bachtalenstrasse 10 4438 Langenbruck Switzerland', '062 390 12 24', 'Nov 15-18 2012');// //addLocation(52.505369, 13.353882, 'Herbstcon', 'herbstcon.de', 'Sozialistische Jugend Deutschlands – Die Falken Haus am Lützowplatz Lützowplatz 9 10785 Berlin Germany', '030-261030-0', 'Oct 11-14 2012', 20);//Invite only addLocation(49.616848,  8.826463, 'H-Con', 'h-con.afc-group.org', 'Gerhart-Hauptmann-Haus Außerhalb 1-3 64689 Grasellenbach-Scharbach Germany', '+49 06 2 07/1 22-1', 'Oct 3-7 2012'); addLocation(49.26716,-123.010021, 'Howloween', 'howloween.org', 'Burnaby Executive Hotel 4201 Lougheed Highway Burnaby, BC Canada', '', '5-6 Nov 2011', 151); addLocation(39.768971, -86.160601, 'IndyFurCon', 'indyfurcon.com', 'Sheraton at Keystone Crossing 8787 Keystone Crossing Indianapolis, IN 46240 USA', '+1 (317) 846-2700', 'Aug 10-12 2012', 369); addLocation(35.694742, 139.816679, 'Kemocon', 'www.kemocon.com', 'Sumida Industrial Centre 〒130-0022 Sumida, Tokyo Japan', '', 'Nov 19 2011', 400); addLocation(47.336284, 12.855555, 'Lakeside Furs', 'lakesidefurs.at', 'Zell am See Talstr. 159, 5700 Thumersbach Austria', '+43 (0)6542/73734', 'Aug 8-11 2012', 20); addLocation(28.333938, -81.587638, 'Megaplex', 'megaplexcon.org', 'Worldgate Resort Hotel 3011 Maingate Lane Kissimmee, FL 34747-2302 USA', '+1 (866) 705-7676', 'Jul 27-29 2012', 553); addLocation(34.966572, -89.791608, 'Mephit Furmeet', 'mephitfurmeet.org', 'Whispering Woods Hotel & Conference Center 11200 Goodman Rd Olive Branch, MS 38654-4212 USA', '+1 (662) 895-2941', 'Aug 31-Sep 2 2012', 546); addLocation(50.825484,  7.887068, 'Mephit Mini Con', 'mmc.furcon.de', 'Freusburg, Seigen Germany', '', 'May 9-12 2013', 200); addLocation(-37.80541, 144.963291, 'MiDFur', 'www.midfur.com.au', 'Arrow on Swanston 488 Swanston Street Carlton, VIC Australia', '(613) 9225 9000', 'Dec 4-8 2012', 372); addLocation(41.981284, -87.859078, 'Midwest FurFest', 'furfest.org', "Hyatt Regency O'Hare 9300 Bryn Mawr Avenue Rosemont, Illinois 60018 USA", '+1 (847) 696-1234', 'Nov 16-18 2012', 2600); addLocation(40.105846, -83.017244, 'Morphicon', 'morphicon.org', 'Holiday Inn Columbus-Worthington 7007 N. High Street Worthington, Ohio 43085 USA', '+1 (614) 436-0700', 'May 3-6 2012', 275); addLocation(39.65924, -75.75286, 'New Year\'s Furry Ball', 'www.ticketderby.com/innerindex.php?eventid=3505', 'Embassy Suites Newark-Wilmington/South 854 S College Ave Newark, DE 19713 USA', '(302) 368-8000', 'Dec 30-Jan 1 2011', 146) // Was replaced by Furstivus in 2012, but planned to resume for 2013 addLocation(35.933888, -98.429604, 'Oklacon', 'oklacon.com', 'Roman Nose State Park Rt 1 Box 2-2 Watonga, Oklahoma 73772 USA', '+1 (580) 623-4215', 'Oct 17-22 2012', 300); addLocation(-31.952222, 115.858889, 'Perthfur Gathering', 'gathering.perthfurs.net', 'Perth, Western Australia', '', 'Aug 13 2011', 76);//"3rd qtr, 2010" addLocation(47.444579,-122.293807, 'RainFurrest', 'rainfurrest.org', 'Hilton Seattle Airport 17620 International Boulevard Seattle, WA 98188 USA', '+1 (206) 244-4800', 'Sep 27-30 2012', 1424); addLocation(-27.467778, 153.027778, 'RivFur', 'www.rivfur.org', 'Brisbane, Queensland, Australia', '', 'June 29-Jul 2 2012', 50); addLocation(34.6701, -86.577759, 'Rocket City FurMeet', 'rcfm.net', 'Hilton Garden Inn Huntsville South 301 Boulevard South SW Huntsville, Alabama 35802 USA', '+1 (256) 881-4170', 'May 25-27 2012', 302); addLocation(39.762235,-104.900293, 'Rocky Mountain Fur Con', 'rockymountainfurcon.org', 'Doubletree Hotel Denver 3203 Quebec Street Denver, Colorado 80207 USA', '+1 (303) 321-3333', 'Aug 10-12 2012', 643); addLocation(55.734529, 36.882262, 'Rusfurrence', 'rusfurrence.ru', 'РАН "Звенигородский" (RAS "Zvenigorodsky") Звенигород (Zvenigorod), Moscow Russian Federation', '', 'Jan 31-Feb 5 2012', 190); addLocation(57.478307, -4.22672, 'ScotiaCon', 'www.scotiacon.com', 'Mercure Inverness Hotel Church Street Inverness, IV1 1QY Inverness-shire, United Kingdom', '', 'Jul 27-30 2012', 123); addLocation(-33.932, 25.571, 'South Afrifur meet', 'forum.zafur.co.za/viewtopic.php?f=53&t=1330', , , 'Dec 2012?'); addLocation(50.456309, 30.504819, 'WUFF (UA Furence)', 'furry.org.ua/index.php?page=meetings', 'Kiev, Ukraine', '', '28 April-2 May 2012', 95) addLocation(49.266323,-123.011509, 'VancouFur', 'vancoufur.ca', 'Executive Hotel & Conference Centre Burnaby 4201 Lougheed Hwy Burnaby, British Columbia, V5C 3Y6 Canada', '', 'March 9–11 2012');//check date, no clue for 2013 addLocation(45.493191,-73.5736397, 'What The Fur', 'whatthefur.ca', 'The Days Hotel & Conference Centre of Montreal 1005 rue Guy, Montréal, QC H3H 2K4, Canada', '514-938-4611', 'May 2013?', 282); addLocation(40.538786, -79.830565, 'Western Pennsylvania Furry Weekend', 'wpafw.org', 'Quality Inn Pittsburgh North 2801 Freeport Road Pittsburgh, Pennsylvania 15238 USA', '+1 (412) 828-9400', 'Sep 28-30 2012', 116); addLocation(35.042611, -95.317672, 'Wild Nights', 'wildnights.org', 'Robbers Cave State Park Wilburton, Oklahoma 74578 USA', '+1 (918) 465-2565', 'Apr 25-29 2013', 122); addLocation(47.405582, 12.040372, 'Zillercon', , 'Wildschönau, Tyrol Austria', , 'Jan 21-28 2012', 40); addLocation(50.773040, 15.311701, 'ZodiaCon', 'zodiacon.org', 'Hotel Emilka Na Novině 401 468 61 Desná III Czech Republic', '+420 483 300 335', 'May 2012?');

// convert textual dates to numbers for sorting. for(var i = 0, meet; meet = meets[i]; i++){ meet.datev=(v=getmonthvalue(meet.date))?v:3000; }

// adds or rearranges meets in the side bar. function refresh(f){ for(var i = 0, meet; meet = meets[i]; i++){ addLocation1(meet, f); } }

// comparison functions, those decide the order meetups are listed function compare_name(a, b){ return a.name?(b.name?a.name.localeCompare(b.name):-1):1; } function compare_date(a,b){ var d = a.datev - b.datev; return (d == 0)? compare_name(a, b) : d; } function compare_attendence(a,b){ if (a.attendence){ if (b.attendence){ return b.attendence - a.attendence; } else { return -1; }	} else { if (b.attendence){ return 1; } else { return compare_name(a,b); }			} } // assigning functionality to sort buttons document.getElementById("bydate").onclick=function{ meets.sort(compare_date); refresh(function(meet){return meet.date?(meet.date + " " + meet.name):meet.name;}); } document.getElementById("byname").onclick=function{ meets.sort(compare_name); refresh; } document.getElementById("byattendence").onclick=function{ meets.sort(compare_attendence); refresh(function (meet){return meet.name + (meet.attendence?" ("+meet.attendence+")":"");}); }

meets.sort(function (a,b){	return a.datev - b.datev;	}) refresh(function(meet){return meet.date?(meet.date + " " + meet.name):meet.name;});

// add drop-down options opt = document.createElement("option"); opt.innerHTML = "All events ("+count+")"; opt.value = FILT_ALL; opt.selected=true;

document.getElementById("filter").appendChild(opt);

opt = document.createElement("option"); opt.innerHTML = "North America ("+count_na+")"; opt.value = FILT_NA;

document.getElementById("filter").appendChild(opt);

opt = document.createElement("option"); opt.innerHTML = "Europe ("+count_eu+")"; opt.value = FILT_EU;

document.getElementById("filter").appendChild(opt);

opt = document.createElement("option"); opt.innerHTML = "Oceania ("+count_oceania+")"; opt.value = FILT_OCEANIA;

document.getElementById("filter").appendChild(opt);

opt = document.createElement("option"); opt.innerHTML = "Rest of the World ("+count_others+")"; opt.value = FILT_OTHERS;

document.getElementById("filter").appendChild(opt);

document.getElementById("filter").onchange = function{ opts = document.getElementById("filter").firstChild; selection = 0; while(opts != null){ if (opts.selected) { selection = opts.value; }       opts = opts.nextSibling; }

filter_func = null; switch(Number(selection)){ case FILT_NA: filter_func = is_in_na; break; case FILT_EU: filter_func = is_in_eu; break; case FILT_OCEANIA: filter_func = is_in_oceania; break; case FILT_OTHERS: filter_func = function(lat, lng){ return !(is_in_na(lat, lng)) && !(is_in_eu(lat, lng)) && !(is_in_oceania(lat, lng)) ;           }            break; case FILT_ALL: default: filter_func = function(lat, lng){return true;} break; }

bounds = null; for(var i = 0, meet; meet = meets[i]; i++){

//only show those that pass filter_func visible = filter_func(meet.lat, meet.lng); meet.marker.setVisible(visible); meet.li.style.display = visible ? "": "none";

if (visible) { if (bounds){ bounds.extend(meet.marker.getPosition); } else { pos = meet.marker.getPosition; bounds = new google.maps.LatLngBounds(pos, pos); }       }    }    if (bounds) {map.fitBounds(bounds);} //zoom to include in the viewport all markers if there are any } } //if (true) footnote = document.createElement("p"); footnote.innerHTML = 'Edit data on WikiFur or discuss'; document.getElementById("side").appendChild(footnote); } //load

// convert textual dates into numbers for sorting // Might benefit from also parsing years. function getmonthvalue(s){ if (!s) {return 4001;}

//automatically generate these for i18n and l10n extensibility? x = /(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)(?: )?([0-9]*)/.exec(s); if (!x || !x[1]) return 4000; day = (v=parseInt(x[2]))?v:0; if (day > 1980) {day = 40;} switch (x[1]){ case "Jan": month = 1; break; case "Feb": month = 2; break; case "Mar": month = 3; break; case "Apr": month = 4; break; case "May": month = 5; break; case "Jun": month = 6; break; case "Jul": month = 7; break; case "Aug": month = 8; break; case "Sep": month = 9; break; case "Oct": month = 10; break; case "Nov": month = 11; break; case "Dec": month = 12; break; default:	month = 20; }//switch return month * 100 + day; }

//returns the text to be displayed in info window function getLocationHTML(name, url, address, tel, date, attendence) { return ' ' + name + '' + (url?(' ' + url + ''):'') + ' ' + address + (tel?		(' Phone: ' + (is_phone? 				('' + tel + '')				:tel))		:'') +

(date?' '+date:'') + (attendence? " Past atnd. "+ attendence:"") + " ";

}

function addLocation(lat, lng, name, url, address, tel, date, attendence){ meets.push({"lat":lat, 'lng': lng, 'name':name, 'url': url, 'address': address, 'tel': tel, 'date':date, 'attendence': attendence}); }

//this is called to add markers as well as to sort markers. //this takes advantage of the fact that when adding a child to a DOM node, if the child is already in the document, it is removed from its original location first. //lat, lng, name, url, address, tel, date function addLocation1(a, f) { if (!f) {f = function(meet){return meet.date? (meet.name + " " + meet.date) : meet.name;}}; if (!a.marker || !a.li){

//make the marker markerOpts = { position: new google.maps.LatLng(a.lat, a.lng), map: map, title: name }       a.marker = new google.maps.Marker(markerOpts); fn = function { infoWindow.setContent(getLocationHTML(a.name, a.url, a.address, a.tel, a.date, a.attendence)); infoWindow.open(map, a.marker); }       google.maps.event.addListener(a.marker, "click",fn); link = document.createElement("A"); link.innerHTML = f(a); link.href = "#"; link.onclick = fn; //clean up this on unload! a.li = document.createElement("LI"); a.li.appendChild(link);

count++; if     (is_in_na(a.lat, a.lng)){ count_na++; } else if (is_in_eu(a.lat, a.lng)) { count_eu++; } else if (is_in_oceania(a.lat, a.lng)){ count_oceania ++; } else { count_others ++; }   } else { //only change the label text a.li.firstChild.innerHTML = f(a); }         //(re)insert the item into list document.getElementById("list").appendChild(a.li);

}

function unload{ for(var i = 0, meet; meet = meets[i]; i++){ meet.marker=null; meet.li=null; }

} //