Repositorio del curso CCOM4030 el semestre B91 del proyecto Paz para la Mujer

index.js 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. var iconBase = 'https://developers.google.com/maps/documentation/javascript/examples/full/images/';
  2. var data = [
  3. {
  4. position: {lng: -66.056812, lat: 18.415312},
  5. title: "Centro de Ayuda a Víctimas de Violación"
  6. },
  7. {
  8. position: {lng: -66.227438, lat: 18.218187},
  9. title: "Casa Juana Colón"
  10. },
  11. {
  12. position: {lng: -66.265938, lat: 18.140312},
  13. title: "Envejecer en Armonía"
  14. },
  15. {
  16. position: {lng: -66.703438, lat: 18.265812},
  17. title: "Fundación Alas a la Mujer"
  18. },
  19. {
  20. position: {lng: -66.740563, lat: 18.444438},
  21. title: "Oficina para Promoción y Desarrollo Humano"
  22. },
  23. {
  24. position: {lng: -66.051063, lat: 18.219813},
  25. title: "Centro Salud Justicia de Puerto Rico"
  26. },
  27. {
  28. position: {lng: -66.051687, lat: 18.412188},
  29. title: "Centro Comunitario LGBT"
  30. },
  31. {
  32. position: {lng: -65.833312, lat: 18.422687},
  33. title: "Taller Salud"
  34. },
  35. {
  36. position: {lng: -66.075187, lat: 18.399687},
  37. title: "Profamilias"
  38. },
  39. {
  40. position: {lng: -66.056437, lat: 18.402188},
  41. title: "Instituto del Hogar Celia y Harrys Bunker, Proyecto Criando para la Paz"
  42. },
  43. {
  44. position: {lng: -66.052188, lat: 18.403937},
  45. title: "Centro de Apoyo para Víctimas el Crimen"
  46. },
  47. {
  48. position: {lng: -66.058062, lat: 18.427938},
  49. title: "Oficina de la Procuradora de las Mujeres"
  50. },
  51. {
  52. position: {lng: -66.074562, lat: 18.396437},
  53. title: "Instituto de Deficiencias en el Desarrollo, UPR RCM"
  54. },
  55. {
  56. position: {lng: -67.139813, lat: 18.212188},
  57. title: "Proyecto Apoyo a Mujeres Sobrevivientes de Violencia Doméstica, Siempre Vivas, UPRM"
  58. }
  59. ];
  60. var app = {
  61. // Application Constructor
  62. initialize: function() {
  63. document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
  64. },
  65. // deviceready Event Handler
  66. //
  67. // Bind any cordova events here. Common events are:
  68. // 'pause', 'resume', etc.
  69. onDeviceReady: function() {
  70. this.receivedEvent('deviceready');
  71. },
  72. // Update DOM on a Received Event
  73. receivedEvent: function(id) {
  74. navigator.geolocation.getCurrentPosition(onMapSuccess, onMapError, { enableHighAccuracy: true });
  75. }
  76. };
  77. app.initialize();
  78. // Success callback for get geo coordinates
  79. var onMapSuccess = function (position) {
  80. Latitude = position.coords.latitude;
  81. Longitude = position.coords.longitude;
  82. getMap(Latitude, Longitude);
  83. }
  84. function getMap(Latitude, Longitude){
  85. var latLong = new google.maps.LatLng(Latitude, Longitude);
  86. var mapOptions = {
  87. center: latLong,
  88. zoom: 8,
  89. mapTypeId: google.maps.MapTypeId.ROADMAP
  90. };
  91. //MAPA
  92. var map = new google.maps.Map(document.getElementById("map"), mapOptions);
  93. //MARKERS
  94. var contentString = '<div id="content">'+
  95. '<div id="siteNotice">'+
  96. '</div>'+
  97. '<h1 id="firstHeading" class="firstHeading">Centro de Ayuda a Víctimas de Violación</h1>'+
  98. '<p>Attribution: Uluru, <a href="https://www.google.com/maps/dir/?api=1&origin=' + latLong + '&destination=' + data[0]['title'] + '>"'
  99. 'Get Directions</a> '+
  100. '(last visited June 22, 2009).</p>'+
  101. '</div>';
  102. var infowindow = new google.maps.InfoWindow({
  103. content: contentString,
  104. maxWidth: 200
  105. });
  106. var marker = new google.maps.Marker({position: data[0]['position'], title: data[0]['title'], map: map});
  107. marker.addListener('click', function() {
  108. infowindow.open(map, marker);
  109. });
  110. /////////////////////////////////////////////////////////////////////////////
  111. var contentString1 = '<div id="content">'+
  112. '<div id="siteNotice">'+
  113. '</div>'+
  114. '<h1 id="firstHeading" class="firstHeading">Casa Juana Colón</h1>'+
  115. '<div id="bodyContent">'+
  116. '<p>Attribution: Uluru, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
  117. 'https://en.wikipedia.org</a> '+
  118. '(last visited June 22, 2009).</p>'+
  119. '</div>';
  120. var infowindow1 = new google.maps.InfoWindow({
  121. content: contentString1,
  122. maxWidth: 200
  123. });
  124. var marker1 = new google.maps.Marker({position: data[1]['position'], title: data[1]['title'],map: map});
  125. marker1.addListener('click', function() {
  126. infowindow1.open(map, marker1);
  127. });
  128. ////////////////////////////////////////////////////////////////////////////////
  129. var contentString2 = '<div id="content">'+
  130. '<div id="siteNotice">'+
  131. '</div>'+
  132. '<h1 id="firstHeading" class="firstHeading">Envejecer en Armonía</h1>'+
  133. '<div id="bodyContent">'+
  134. '<p>Attribution: Uluru, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
  135. 'https://en.wikipedia.org</a> '+
  136. '(last visited June 22, 2009).</p>'+
  137. '</div>';
  138. var infowindow2 = new google.maps.InfoWindow({
  139. content: contentString2,
  140. maxWidth: 200
  141. });
  142. var marker2 = new google.maps.Marker({position: data[2]['position'], title: data[2]['title'],map: map});
  143. marker2.addListener('click', function() {
  144. infowindow2.open(map, marker2);
  145. });
  146. /////////////////////////////////////////////////////////////////////////////////
  147. var contentString3 = '<div id="content">'+
  148. '<div id="siteNotice">'+
  149. '</div>'+
  150. '<h1 id="firstHeading" class="firstHeading">Fundación Alas a la Mujer</h1>'+
  151. '<div id="bodyContent">'+
  152. '<p>Attribution: Uluru, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
  153. 'https://en.wikipedia.org</a> '+
  154. '(last visited June 22, 2009).</p>'+
  155. '</div>';
  156. var infowindow3 = new google.maps.InfoWindow({
  157. content: contentString3,
  158. maxWidth: 200
  159. });
  160. var marker3 = new google.maps.Marker({position: data[3]['position'], title: data[3]['title'],map: map});
  161. marker3.addListener('click', function() {
  162. infowindow3.open(map, marker3);
  163. });
  164. ////////////////////////////////////////////////////////////////////////////////////
  165. var contentString4 = '<div id="content">'+
  166. '<div id="siteNotice">'+
  167. '</div>'+
  168. '<h1 id="firstHeading" class="firstHeading">Oficina para Promoción y Desarrollo Humano</h1>'+
  169. '<div id="bodyContent">'+
  170. '<p>Attribution: Uluru, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
  171. 'https://en.wikipedia.org</a> '+
  172. '(last visited June 22, 2009).</p>'+
  173. '</div>';
  174. var infowindow4 = new google.maps.InfoWindow({
  175. content: contentString4,
  176. maxWidth: 200
  177. });
  178. var marker4 = new google.maps.Marker({position: data[4]['position'], title: data[4]['title'],map: map});
  179. marker4.addListener('click', function() {
  180. infowindow4.open(map, marker4);
  181. });
  182. //////////////////////////////////////////////////////////////////////////////////
  183. var contentString5 = '<div id="content">'+
  184. '<div id="siteNotice">'+
  185. '</div>'+
  186. '<h1 id="firstHeading" class="firstHeading">Centro Salud Justicia de Puerto Rico</h1>'+
  187. '<div id="bodyContent">'+
  188. '<p>Attribution: Uluru, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
  189. 'https://en.wikipedia.org</a> '+
  190. '(last visited June 22, 2009).</p>'+
  191. '</div>';
  192. var infowindow5 = new google.maps.InfoWindow({
  193. content: contentString5,
  194. maxWidth: 200
  195. });
  196. var marker5 = new google.maps.Marker({position: data[5]['position'], title: data[5]['title'],map: map});
  197. marker5.addListener('click', function() {
  198. infowindow5.open(map, marker5);
  199. });
  200. //////////////////////////////////////////////////////////////////////////////////
  201. var contentString6 = '<div id="content">'+
  202. '<div id="siteNotice">'+
  203. '</div>'+
  204. '<h1 id="firstHeading" class="firstHeading">Centro Comunitario LGBT</h1>'+
  205. '<div id="bodyContent">'+
  206. '<p>Attribution: Uluru, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
  207. 'https://en.wikipedia.org</a> '+
  208. '(last visited June 22, 2009).</p>'+
  209. '</div>';
  210. var infowindow6 = new google.maps.InfoWindow({
  211. content: contentString6,
  212. maxWidth: 200
  213. });
  214. var marker6 = new google.maps.Marker({position: data[6]['position'], title: data[6]['title'],map: map});
  215. marker6.addListener('click', function() {
  216. infowindow6.open(map, marker6);
  217. });
  218. //////////////////////////////////////////////////////////////////////////////////
  219. var contentString7 = '<div id="content">'+
  220. '<div id="siteNotice">'+
  221. '</div>'+
  222. '<h1 id="firstHeading" class="firstHeading">Taller Salud</h1>'+
  223. '<div id="bodyContent">'+
  224. '<p>Attribution: Uluru, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
  225. 'https://en.wikipedia.org</a> '+
  226. '(last visited June 22, 2009).</p>'+
  227. '</div>';
  228. var infowindow7 = new google.maps.InfoWindow({
  229. content: contentString7,
  230. maxWidth: 200
  231. });
  232. var marker7 = new google.maps.Marker({position: data[7]['position'], title: data[7]['title'],map: map});
  233. marker7.addListener('click', function() {
  234. infowindow7.open(map, marker7);
  235. });
  236. //////////////////////////////////////////////////////////////////////////////////
  237. var contentString8 = '<div id="content">'+
  238. '<div id="siteNotice">'+
  239. '</div>'+
  240. '<h1 id="firstHeading" class="firstHeading">Profamilias</h1>'+
  241. '<div id="bodyContent">'+
  242. '<p>Attribution: Uluru, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
  243. 'https://en.wikipedia.org</a> '+
  244. '(last visited June 22, 2009).</p>'+
  245. '</div>';
  246. var infowindow8 = new google.maps.InfoWindow({
  247. content: contentString8,
  248. maxWidth: 200
  249. });
  250. var marker8 = new google.maps.Marker({position: data[8]['position'], title: data[8]['title'],map: map});
  251. marker8.addListener('click', function() {
  252. infowindow8.open(map, marker8);
  253. });
  254. //////////////////////////////////////////////////////////////////////////////////
  255. var contentString9 = '<div id="content">'+
  256. '<div id="siteNotice">'+
  257. '</div>'+
  258. '<h1 id="firstHeading" class="firstHeading">Instituto del Hogar Celia y Harrys Bunker, Proyecto Criando para la Paz</h1>'+
  259. '<div id="bodyContent">'+
  260. '<p>Attribution: Uluru, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
  261. 'https://en.wikipedia.org</a> '+
  262. '(last visited June 22, 2009).</p>'+
  263. '</div>';
  264. var infowindow9 = new google.maps.InfoWindow({
  265. content: contentString9,
  266. maxWidth: 200
  267. });
  268. var marker9 = new google.maps.Marker({position: data[9]['position'], title: data[9]['title'],map: map})
  269. marker9.addListener('click', function() {
  270. infowindow9.open(map, marker9);
  271. });
  272. /////////////////////////////////////////////////////////////////////////////////////
  273. var contentString10 = '<div id="content">'+
  274. '<div id="siteNotice">'+
  275. '</div>'+
  276. '<h1 id="firstHeading" class="firstHeading">Centro de Apoyo para Víctimas el Crimen</h1>'+
  277. '<div id="bodyContent">'+
  278. '<p>Attribution: Uluru, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
  279. 'https://en.wikipedia.org</a> '+
  280. '(last visited June 22, 2009).</p>'+
  281. '</div>';
  282. var infowindow10 = new google.maps.InfoWindow({
  283. content: contentString10,
  284. maxWidth: 200
  285. });
  286. var marker10 = new google.maps.Marker({position: data[10]['position'], title: data[10]['title'],map: map})
  287. marker10.addListener('click', function() {
  288. infowindow10.open(map, marker10);
  289. });
  290. ////////////////////////////////////////////////////////////////////////////////////////
  291. var contentString11 = '<div id="content">'+
  292. '<div id="siteNotice">'+
  293. '</div>'+
  294. '<h1 id="firstHeading" class="firstHeading">Oficina de la Procuradora de las Mujeres</h1>'+
  295. '<div id="bodyContent">'+
  296. '<p>Attribution: Uluru, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
  297. 'https://en.wikipedia.org</a> '+
  298. '(last visited June 22, 2009).</p>'+
  299. '</div>';
  300. var infowindow11 = new google.maps.InfoWindow({
  301. content: contentString11,
  302. maxWidth: 200
  303. });
  304. var marker11 = new google.maps.Marker({position: data[11]['position'], title: data[11]['title'],map: map})
  305. marker11.addListener('click', function() {
  306. infowindow11.open(map, marker11);
  307. });
  308. /////////////////////////////////////////////////////////////////////////////////////////////
  309. var contentString12 = '<div id="content">'+
  310. '<div id="siteNotice">'+
  311. '</div>'+
  312. '<h1 id="firstHeading" class="firstHeading">Instituto de Deficiencias en el Desarrollo, UPR RCM</h1>'+
  313. '<div id="bodyContent">'+
  314. '<p>Attribution: Uluru, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
  315. 'https://en.wikipedia.org</a> '+
  316. '(last visited June 22, 2009).</p>'+
  317. '</div>';
  318. var infowindow12 = new google.maps.InfoWindow({
  319. content: contentString12,
  320. maxWidth: 200
  321. });
  322. var marker12 = new google.maps.Marker({position: data[12]['position'], title: data[12]['title'],map: map})
  323. marker12.addListener('click', function() {
  324. infowindow12.open(map, marker12);
  325. });
  326. //////////////////////////////////////////////////////////////////////////////////////////////
  327. var contentString13 = '<div id="content">'+
  328. '<div id="siteNotice">'+
  329. '</div>'+
  330. '<h1 id="firstHeading" class="firstHeading">Proyecto Apoyo a Mujeres Sobrevivientes de Violencia Doméstica, Siempre Vivas, UPRM</h1>'+
  331. '<div id="bodyContent">'+
  332. '<p>Attribution: Uluru, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
  333. 'https://en.wikipedia.org</a> '+
  334. '(last visited June 22, 2009).</p>'+
  335. '</div>';
  336. var infowindow13 = new google.maps.InfoWindow({
  337. content: contentString13
  338. });
  339. var marker13 = new google.maps.Marker({position: data[13]['position'], title: data[13]['title'],map: map})
  340. marker13.addListener('click', function() {
  341. infowindow13.open(map, marker13);
  342. });
  343. }
  344. // Error callback
  345. function onMapError(error) {
  346. console.log('code: ' + error.code + '\n' +
  347. 'message: ' + error.message + '\n');
  348. }