Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

index.html 38KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  1. <!DOCTYPE html>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one
  4. or more contributor license agreements. See the NOTICE file
  5. distributed with this work for additional information
  6. regarding copyright ownership. The ASF licenses this file
  7. to you under the Apache License, Version 2.0 (the
  8. "License"); you may not use this file except in compliance
  9. n't h with the License. You may obtain a copy of the License at
  10. http://www.apache.org/licenses/LICENSE-2.0
  11. Unless required by applicable law or agreed to in writing,
  12. software distributed under the License is distributed on an
  13. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. KIND, either express or implied. See the License for the
  15. specific language governing permissions and limitations
  16. under the License.
  17. -->
  18. <html>
  19. <head>
  20. <!--
  21. Customize this policy to fit your own app's needs. For more guidance, see:
  22. https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy
  23. Some notes:
  24. * gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
  25. * https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
  26. * Disables use of inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
  27. * Enable inline JS: add 'unsafe-inline' to default-src
  28. -->
  29. <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' http://* 'unsafe-inline'; script-src 'self' http://* 'unsafe-inline' 'unsafe-eval'" />
  30. <!--these three for the calendar-->
  31. <link href="https://fonts.googleapis.com/css?family=Roboto+Condensed" rel="stylesheet">
  32. <link href="css/robotocondensed.css" rel="stylesheet">
  33. <link rel="stylesheet" href="calendar_files/css/demo.css"/>
  34. <link rel="stylesheet" href="css/file.css"/>
  35. <link rel="stylesheet" href="calendar_files/css/theme1.css"/>
  36. <!--this is for the search bar-->
  37. <link rel = "stylesheet" href = "css/searchbar1.css">
  38. <meta name="format-detection" content="telephone=no">
  39. <meta name="msapplication-tap-highlight" content="no">
  40. <meta name="viewport" content="initial-scale=1, width=device-width, height=device, heigth viewport-fit=cover">
  41. <link rel="stylesheet" type="text/css" href="css/index.css">
  42. <link rel="stylesheet" href="lib/OnsenUI/css/onsenui.css">
  43. <link rel="stylesheet" href="lib/OnsenUI/css/onsen-css-components.min.css">
  44. <script src="lib/OnsenUI/js/onsenui.min.js"></script>
  45. <script src="js/jquery_.js"></script>
  46. </head>
  47. <body>
  48. <script type="text/javascript" src="js/saveLocal.js"></script>
  49. <!--the toolbar is where it will have the main name of the app and the ICP logo (top center)-->
  50. <ons-page>
  51. <ons-toolbar>
  52. <div class="center">Artesanias PR</div>
  53. <div class="right"><img class="list-item__thumbnail" src="img/ICP.png"></div>
  54. </ons-toolbar>
  55. <!--The tabbar is the place where the user can get acces to the different sections of the app-->
  56. <!--Each tab will hace a page name (which we use to reference and define them later one), then we have a laber, this is what will be used as a name for that page in the tabbar-->
  57. <ons-tabbar swipeable position="bottom" modifier="autogrow">
  58. <ons-tab page="home.html" label="Hogar" active></ons-tab>
  59. <ons-tab page="renglones.html" label="Artesanías"></ons-tab>
  60. <ons-tab page ="search.html" label="Buscar"> </ons-tab>
  61. <ons-tab page="ferias.html" label="Eventos"></ons-tab>
  62. <ons-tab page="instituto.html" label="ICP"></ons-tab>
  63. </ons-tabbar>
  64. </ons-page>
  65. </ons-navigator>
  66. <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------- -->
  67. <template id="home.html">
  68. <ons-page id="home" class="red">
  69. <ons-card id="azar">
  70. <!--<div class="title" id="Title"></div>-->
  71. <div id="image"></div><br>
  72. <div class="content" id="Content"></div>
  73. <!--This javascript will randomly choose an image and information of a certain type of artesania used by a certain artists-->
  74. <!--For now all this information is stored inside a .csv file-->
  75. <script type="text/javascript" src="js/azar.js"> </script>
  76. </ons-card>
  77. </ons-page>
  78. </template>
  79. <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------- -->
  80. <!--Here it's in the artesanos tab-->
  81. <template id="artesanos.html">
  82. <ons-page id="artesanos">
  83. <!-- This button lets the user go back to the previous page-->
  84. <ons-toolbar>
  85. <div class="left"><ons-back-button>Atrás</ons-back-button></div>
  86. <div class="center"></div>
  87. </ons-toolbar>
  88. <ons-pull-hook id="pull-hook" threshold-height="120px">
  89. <ons-icon id="pull-hook-icon" size="22px" class="pull-hook-content" icon="fa-arrow-down"></ons-icon>
  90. </ons-pull-hook>
  91. <ons-list id="artesanos-list" src="">
  92. <ons-list-header>Artesanos</ons-list-header>
  93. </ons-list>
  94. <script>
  95. ons.getScriptPage().onInit = function () {
  96. this.querySelector('ons-toolbar div.center').textContent = this.data.title;
  97. //var File = this.data.title.toUpperCase() + '.json' ;
  98. var Esp = this.data.esp.split(', ');
  99. var artesanos_json = this.data.json;
  100. //Convertir en mayuscula primera letra del string.
  101. for(var i=0; i<Esp.length; i++) {
  102. Esp[i] = Esp[i].charAt(0).toUpperCase() + Esp[i].slice(1);
  103. };
  104. var pullHook = document.getElementById('pull-hook');
  105. var icon = document.getElementById('pull-hook-icon');
  106. pullHook.addEventListener('changestate', function (event) {
  107. switch (event.state) {
  108. case 'initial':
  109. icon.setAttribute('icon', 'fa-arrow-down');
  110. icon.removeAttribute('rotate');
  111. icon.removeAttribute('spin');
  112. break;
  113. case 'preaction':
  114. icon.setAttribute('icon', 'fa-arrow-down');
  115. icon.setAttribute('rotate', '180');
  116. icon.removeAttribute('spin');
  117. break;
  118. case 'action':
  119. icon.setAttribute('icon', 'fa-spinner');
  120. icon.removeAttribute('rotate');
  121. icon.setAttribute('spin', true);
  122. break;
  123. }
  124. });
  125. var getArtesania = function (num) {
  126. var Artesanos = ``;
  127. console.log('Filtrado de ',Esp[num])
  128. var results = [];
  129. var searchVal = "my Name";
  130. for (var i=0 ; i < artesanos_json.length ; i++)
  131. {
  132. if (artesanos_json[i].Especificaciones.includes(Esp[num])) {
  133. results.push(artesanos_json[i]);
  134. }
  135. }
  136. /*var arr1=artesanos_json.filter(function(item){
  137. return item.Nombre=="Ana";
  138. });*/
  139. for(var i=0; i<results.length; i++) {
  140. //if(Esp[num] in artesanos_json.) {}
  141. Artesanos=Artesanos+`<a id='home.html'>${results[i].Nombre} | ${results[i].Municipio}<br>`
  142. //`<a id='home.html'>${Artesania.artesano} | ${Artesania.municipio}</a> `
  143. }
  144. return {
  145. name: Esp[num],
  146. artesan: Artesanos
  147. };
  148. };
  149. var getData = function () {
  150. const data = [];
  151. for (var i = 0; i < Esp.length; i++) {
  152. data.push(getArtesania(i));
  153. }
  154. return data;
  155. };
  156. var createArtesano = function (Artesano) {
  157. return ons.createElement(`
  158. <ons-list-item expandable tappable>
  159. <div class="center" >${Artesano.Nombre}</div>
  160. <div class="expandable-content"> Municipio: ${Artesano.Municipio}<br>
  161. Tel\u00e9fono: ${Artesano["Telefono 1"]}<br>
  162. Correo Electr\u00f3nico: ${Artesano["E-mail"]}<br>
  163. </div>
  164. </ons-list-item>`
  165. );
  166. };
  167. //var Artesanias = getData();
  168. //artesanos_json
  169. for (Artesano of artesanos_json) {
  170. var cont = 0;
  171. var lista = document.getElementById('artesanos-list');
  172. //Recopilar datos no vacios.
  173. if (Artesano.Municipio.trim().length != 0) {
  174. cont ++;
  175. }
  176. if (Artesano["Telefono 1"].trim().length != 0) {
  177. cont ++;
  178. }
  179. if (Artesano["E-mail"].trim().length != 0 & Artesano["E-mail"].toUpperCase().trim() != "NO TIENE") {
  180. cont ++;
  181. }
  182. if (Artesano.Especificacion.trim().length != 0) {
  183. cont ++;
  184. }
  185. //info a pasar
  186. //'title':'${Artesano.Nombre}','esp': '${info}'
  187. var item = ons.createElement(`<ons-list-item onclick="myNavigator.pushPage('artesano.html', { data: { title: '${Artesano.Nombre}', mun: '${Artesano.Municipio}', tel: '${Artesano["Telefono 1"]}', email: '${Artesano["E-mail"]}', esp: '${Artesano.Especificacion}', redes: '${Artesano["E-Commerce 1"]}' } })" tappable>
  188. <div class="title">${Artesano.Nombre}</div>
  189. </ons-list-item>`);
  190. if(cont == 0){
  191. console.log(Artesano.Nombre+' no tiene ningun tipo de informacion.');
  192. //return ons.createElement(``);
  193. }
  194. else {
  195. lista.appendChild(item);
  196. }
  197. };
  198. };
  199. </script>
  200. <style>
  201. .pull-hook-content {
  202. color: #333;
  203. transition: transform .25s ease-in-out;
  204. }
  205. </style>
  206. </ons-page>
  207. </template>
  208. <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------- -->
  209. <template id="artesanias.html">
  210. <ons-page id="artesanias">
  211. <ons-toolbar>
  212. <div class="left"><ons-back-button>Atrás</ons-back-button></div>
  213. <div class="center"></div>
  214. </ons-toolbar>
  215. <ons-pull-hook id="pull-hook" threshold-height="120px">
  216. <ons-icon id="pull-hook-icon" size="22px" class="pull-hook-content" icon="fa-arrow-down"></ons-icon>
  217. </ons-pull-hook>
  218. <ons-list id="artesania-list" src="">
  219. <ons-list-header>Artesanias</ons-list-header>
  220. </ons-list>
  221. <script>
  222. ons.getScriptPage().onInit = function () {
  223. this.querySelector('ons-toolbar div.center').textContent = this.data.title;
  224. //var File = this.data.title.toUpperCase() + '.json' ;
  225. var Esp = this.data.esp.split(', ');
  226. var artesanos_json = this.data.json;
  227. //Convertir en mayuscula primera letra del string.
  228. for(var i=0; i<Esp.length; i++) {
  229. Esp[i] = Esp[i].charAt(0).toUpperCase() + Esp[i].slice(1);
  230. };
  231. var pullHook = document.getElementById('pull-hook');
  232. var icon = document.getElementById('pull-hook-icon');
  233. pullHook.addEventListener('changestate', function (event) {
  234. switch (event.state) {
  235. case 'initial':
  236. icon.setAttribute('icon', 'fa-arrow-down');
  237. icon.removeAttribute('rotate');
  238. icon.removeAttribute('spin');
  239. break;
  240. case 'preaction':
  241. icon.setAttribute('icon', 'fa-arrow-down');
  242. icon.setAttribute('rotate', '180');
  243. icon.removeAttribute('spin');
  244. break;
  245. case 'action':
  246. icon.setAttribute('icon', 'fa-spinner');
  247. icon.removeAttribute('rotate');
  248. icon.setAttribute('spin', true);
  249. break;
  250. }
  251. });
  252. var getArtesania = function (num) {
  253. var Artesanos = ``,
  254. ArtesanosInfo = ``;
  255. //console.log('Filtrado de ',Esp[num])
  256. var results = [];
  257. var searchVal = "my Name";
  258. for (var i=0 ; i < artesanos_json.length ; i++)
  259. {
  260. if (artesanos_json[i].Especificacion.includes(Esp[num])) {
  261. results.push(artesanos_json[i]);
  262. }
  263. }
  264. /*var arr1=artesanos_json.filter(function(item){
  265. return item.Nombre=="Ana";
  266. });*/
  267. for(var i=0; i<results.length; i++) {
  268. //if(Esp[num] in artesanos_json.) {}
  269. Artesanos+=`${results[i].Nombre}|`
  270. ArtesanosInfo+=`${results[i].Municipio}|${results[i]["Telefono 1"]}|${results[i]["E-mail"]}|${results[i].Especificacion}&&`
  271. //`<a id='home.html'>${Artesania.artesano} | ${Artesania.municipio}</a> `
  272. }
  273. return {
  274. name: Esp[num],
  275. artesan: Artesanos,
  276. info: ArtesanosInfo
  277. };
  278. };
  279. var getData = function () {
  280. const data = [];
  281. for (var i = 0; i < Esp.length; i++) {
  282. data.push(getArtesania(i));
  283. }
  284. return data;
  285. };
  286. var createArtesania = function (Artesania) {
  287. //console.log('Devuelto elemento')
  288. var listaArt=``;
  289. var arts = Artesania.artesan.split('|');
  290. var artsInfo = Artesania.info.split('&&');
  291. for(var i=0; i<arts.length; i++) {
  292. var lot = artsInfo[i].split('|'),
  293. mun = lot[0],
  294. tel = lot[1],
  295. email = lot[2],
  296. esp = lot[3],
  297. redes = lot[4];
  298. listaArt += `<ons-item tappable onclick="myNavigator.pushPage('artesano.html', {data: {title:'${arts[i]}', mun: '${mun}', tel: '${tel}', email: '${email}', esp: '${esp}', redes: '${redes}'}} )" ><div class="center">`+ arts[i] +`</div></ons-item><br>`;
  299. }
  300. return ons.createElement(`
  301. <ons-list-item expandable tappable>
  302. <div class="center" >${Artesania.name}</div>
  303. <div class="expandable-content">Artesanos que trabajan con ${Artesania.name}
  304. <ons-card>${listaArt}</ons-card></div>
  305. </ons-list-item>`
  306. );
  307. };
  308. var Artesanias = getData();
  309. for (Art of Artesanias) {
  310. var Artesania = createArtesania(Art);
  311. document.getElementById('artesania-list').appendChild(Artesania);
  312. };
  313. pullHook.onAction = function (done) {
  314. setTimeout(function() {
  315. document.getElementById('artesania-list').appendChild(createArtesania(getArtesania()));
  316. done();
  317. }, 400);
  318. }
  319. };
  320. </script>
  321. <style>
  322. .pull-hook-content {
  323. color: #333;
  324. transition: transform .25s ease-in-out;
  325. }
  326. </style>
  327. </ons-page>
  328. </template>
  329. <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------- -->
  330. <!----------------------------------------------------------------------------------->
  331. <!-->
  332. The searchfunctions.js file is just a file that has all the definitions of the functions used later on in the switch
  333. <!-->
  334. <script src = "js/searchfunctions.js"></script>
  335. <script>
  336. //all_artesanos is the JSON file that has all the artesanos
  337. var all_artesanos = JSON.parse(window.localStorage.getItem("TODOS"));
  338. function filter(){
  339. //finds the values of the search bar which are sent from the block of code after this script
  340. //input is the one you use to filter by any parameter
  341. //inputarte is the one you use to filter by the type of art the artists make
  342. //inputmuni is the one you use to filter by municipio
  343. //informacion is the variable that has all the information that will be sent to this tab, what we're going to use here is just to declare which artists are seen (informacion[i].style.display = "list-item") and which are not seen (informacion[i].style.display = "none")
  344. var input = document.getElementById('searchbar').value;
  345. var inputarte = document.getElementById('searchartesania').value;
  346. var inputmuni = document.getElementById('searchbarmunicipio').value;
  347. var informacion = document.getElementsByClassName('artists');
  348. //just making sure everything is at the same format by taking out special characters, trimming it and putting it in lowercase (same thing will be done to the arguments it's being compared to later on)
  349. //acento_replace(): it's a function I made that takes out any special characters of a word and changes them back to the plain ones (quitar acentos o cosas asi)
  350. input = acento_replace(input.trim().toLowerCase());
  351. inputarte = acento_replace(inputarte.trim().toLowerCase());
  352. inputmuni = acento_replace(inputmuni.trim().toLowerCase());
  353. //default case is where evey one of them has nothing or less than 3 characters (displays every artist until it passes that length)
  354. if (input.length <= 3 && inputarte.length <= 3 && inputmuni.length <= 3){
  355. for (var i = 0; all_artesanos.length; i++){
  356. informacion[i].style.display = "list-item";
  357. }
  358. }
  359. else{
  360. var cases = 0;
  361. cases = getcasenum(input,inputarte,inputmuni);
  362. //take every one of them out first (dont display any)
  363. for (var i = 0; i < all_artesanos.length; i++){
  364. informacion[i].style.display = "none";
  365. }
  366. switch(cases){
  367. //cases == 1 when only inputmuni has been writen on
  368. case 1:
  369. filter_municipios(inputmuni);
  370. break;
  371. //cases == 2 when only inputarte has been written on
  372. case 2:
  373. filter_artesanias(inputarte);
  374. break;
  375. //cases == 3 when inputarte and inputmuni has been written on
  376. case 3:
  377. search_art_mun(inputarte,inputmuni);
  378. break;
  379. //cases == 4 when input has been writen on
  380. case 4:
  381. filter_any(input);
  382. break;
  383. //cases == 5 when input and inputmuni has been written on
  384. case 5:
  385. search_any_mun(input,inputmuni);
  386. break;
  387. //cases == 6 when input and inputart has been written on
  388. case 6:
  389. search_any_art(input,inputarte);
  390. break;
  391. //cases == 7 when input, inputart and inputmuni has been writen on
  392. case 7:
  393. search_any_art_mun(input,inputarte,inputmuni);
  394. break;
  395. }
  396. }
  397. }
  398. </script>
  399. <template id="search.html">
  400. <ons-navigator swipeable animation="slide" id="SNavigator">
  401. <ons-page id="Buscar">
  402. <!--
  403. This is the search bars, each time you type a character into any of the search bars, they will run the filter() function with what they all have as arguments (even if the other search bars have nothing in them)
  404. The first search bar is to find by any information related to the artist
  405. The second searchbar is to find by the type of artwork they work on
  406. The third searchbar is to find by the municipio where the artists works or lives?
  407. -->
  408. <p style="text-align: center; margin-top: 10px;">
  409. <ons-search-input placeholder="Busqueda en cualquiera" id = "searchbar"
  410. onkeyup = "filter()"></ons-search-input>
  411. <ons-search-input placeholder="Busqueda por artesanias" id = "searchartesania"
  412. onkeyup = "filter()"></ons-search-input>
  413. <ons-search-input placeholder = "Busqueda por municipio" id = "searchbarmunicipio"
  414. onkeyup = "filter()"></ons-search-input>
  415. </p>
  416. <ons-list id="results" src="">
  417. </ons-list>
  418. <script>
  419. //This is basically declaring what we refer to as informacion in the filter() function
  420. //It iterates though each artists in the all_artesanos json file from before, it displays their name in the "Buscar" page, and it gets prepared so that when its clicked it redirects to the "artesano.html" page with the other aditional information that we have other than the name.
  421. for (i = 0; i < all_artesanos.length;i++){
  422. var artesano = ons.createElement(`<ons-list-item class = "artists"
  423. onclick="SNavigator.pushPage('artesano.html', { data: {title: '${all_artesanos[i].Nombre}', mun: '${all_artesanos[i].Municipio}', tel: '${all_artesanos[i]["Telefono 1"]}', email: '${all_artesanos[i]["E-mail"]}', esp: '${all_artesanos[i].Especificacion}', redes: '${all_artesanos[i]["E-Commerce 1"]}' } })" tappable>
  424. <div>${all_artesanos[i].Nombre}</div>
  425. </ons-list-item>`);
  426. document.getElementById('results').appendChild(artesano);
  427. }
  428. </script>
  429. </ons-page>
  430. </template>
  431. <!-- ---------------------------------------------------------------------------------------------------------------------------------------- -->
  432. <!--This page is used so that we can display the information of a specific artists, and whenever the artists is missing information then we just dont include that in the page-->
  433. <template id= "artesano.html">
  434. <ons-page id = "artesano">
  435. <ons-toolbar>
  436. <!-- Pretty self explanatory, its a button that goes back to the previous page -->
  437. <div class = "left"> <ons-back-button> Atras </ons-back-button></div>
  438. <div class = "center"></div>
  439. </ons-toolbar>
  440. <body>
  441. <!-- This is where we'll put all the information of that artsts -->
  442. <ons-card id="all"></ons-card>
  443. </body>
  444. <script>
  445. //when it opens this page this function starts to run, it first recieves the information that was sent to "artesano.html"
  446. ons.getScriptPage().onInit = function () {
  447. this.querySelector('ons-toolbar div.center').textContent = this.data.title;
  448. var data = '',
  449. mun = this.data.mun,
  450. tel = this.data.tel,
  451. em = this.data.email,
  452. esp = this.data.esp,
  453. redes = this.data.redes;
  454. //here the email is the string made from the start to where the '#' is.
  455. email = em.slice(0, em.search("#"));
  456. //Here it's dividing all the especificaciones and writing them into the page (data) and then goes to the next line
  457. //if it has many especificaciones then it will replace all the ';' in it with ',' and writes it into the page
  458. //but if theres only one then you just write it into the page
  459. if(esp.trim() != ""){
  460. if(esp.includes(";", 0)){
  461. esp=esp.replace(/;/g,", ");
  462. data+='Tipos de artesanias: '+esp+'<br>';
  463. }
  464. else {
  465. data+='Tipo de artesania: '+esp+'<br>';
  466. }
  467. }
  468. //console.log("Las redes son..."+this.data.redes);
  469. //Here it's writing their municipio into the page
  470. if(mun.trim() != ""){
  471. data+='Municipio: '+ mun +'<br>';
  472. }
  473. //Here it's writing their email, in blue color and its used as a link to send one when it's clicked, then it goes to the next line
  474. //Whenever the variable is empty or if it has "NO TIENE" then it doesnt write anything
  475. if(email.trim() != "" & email.toUpperCase().trim() != "NO TIENE"){
  476. data+='Correo Electr\u00f3nico: <a style="color:blue" href="mailto: '+email+'"><u>'+email+'</u></a><br>';
  477. }
  478. //Here it's writing their phone number into the page,its in blue and whenever its clicked the app will redirect the user to call them, then it goes to the next line
  479. if(tel.trim() != "" ){
  480. data+='Tel\u00e9fono: <a style="color:blue" href="tel: '+ tel +'"><u>'+ tel +'</u></a><br>';
  481. }
  482. console.log("Redes: "+redes);
  483. //Here it has to decide what to do depending on the links they give to their social media pages
  484. //if the link is to a facebook, instagram or myspace account then it will show the picture of the social media site, and when you click the picture then the app redirects you to their social media.
  485. //The alt attribute is required for images, it's in case theres no internet connection, then it will display that tet instead, I think screen readers can also read that text
  486. //If the link is to another website (but isn't a mailto link) then it will display a default picture we chose to display a default web browser, like the other ones clikcing on it will take you to the link.
  487. //If it's none of them then it will not display anything.
  488. if(redes.includes("facebook")){
  489. console.log(redes.substring(1,redes.length-2));
  490. data+='<br><a href="'+ redes.substring(1,redes.length-2) + '"><img src="img/facebook.png" alt="Facebook"style="width:35px;height:35px;border:0;"><br>';
  491. }
  492. else if(redes.includes("instagram")){
  493. console.log(redes.substring(1,redes.length-2));
  494. data+='<br><a href="'+ redes.substring(1,redes.length-2) + '"><img src="img/instagram.png" alt="Instagram"style="width:35px;height:35px;border:0;"><br>';
  495. }
  496. else if(redes.includes("myspace")){
  497. console.log(redes.substring(1,redes.length-2));
  498. data+='<br><a href="'+ redes.substring(1,redes.length-2) + '"><img src="img/MySpace.png" alt="MySpace"style="width:35px;height:35px;border:0;"><br>';
  499. }
  500. else if((redes.includes(".org") || redes.includes(".com")) && !redes.includes("mailto")){
  501. redes = redes.substr(redes.indexOf("#")+1,redes.length);
  502. redes = redes.substr(0, redes.length-1);
  503. console.log(redes);
  504. data+='<br><a href="'+ redes + '"><img src="img/internet.jpg" style="width:35px;height:35px;border:0;"><br>';
  505. }
  506. else if(redes.includes("#") || redes.includes("mailto")){
  507. console.log("tiene un disparate");
  508. } else {
  509. console.log("no tiene nada");
  510. }
  511. //This is the part that allows eveything (data) to be displayed
  512. document.getElementById("all").innerHTML = `${data}`;
  513. }
  514. </script>
  515. </ons-page>
  516. </template>
  517. <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------- -->
  518. <template id="renglones.html">
  519. <ons-navigator swipeable animation="slide" id="myNavigator">
  520. <ons-page id="renglones">
  521. <!--div class="search-bar">
  522. <p style="text-align: center; margin-top: 10px;">
  523. <ons-search-input placeholder="Search" onchange="ons.notification.alert('Searched for: ' + this.value)"
  524. style="width: 96%; margin: 6px auto 6px auto;"></ons-search-input>
  525. </p>
  526. </div-->
  527. <ons-card id="list">
  528. <script type="text/javascript" src="js/renglones.js"></script>
  529. </ons-card>
  530. <!--Javascript function to hide other open expandables-->
  531. <script>
  532. const hideAll = () => {
  533. Array.from(document.querySelector('#list').children)
  534. .forEach(item => {
  535. if (item.expanded) {
  536. item.hideExpansion();
  537. }
  538. });
  539. };
  540. </script>
  541. <style>
  542. .intro {
  543. text-align: center;
  544. padding: 20px;
  545. margin-top: 30px;
  546. }
  547. ons-card {
  548. cursor: pointer;
  549. color: #333;
  550. }
  551. .card__title,
  552. .card--material__title {
  553. font-size: 15px;
  554. }
  555. </style>
  556. </ons-page>
  557. </template>
  558. <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------- -->
  559. <template id="ferias.html">
  560. <ons-page id="ferias">
  561. <!--<ons-card>
  562. <div id = "caleandar" class = "calendar" style="margin-top: 20px;">
  563. <script type="text/javascript" src="calendar_files/js/caleandar.js"></script>
  564. <script type="text/javascript" src="calendar_files/js/events.js"></script>
  565. </div>
  566. </ons-card>-->
  567. <br><br><br>
  568. <button onclick="redirect()">Pasar a la pagina de eventos</button>
  569. <script>
  570. function redirect() {
  571. location.replace("https://facebook.com/icppr")
  572. }
  573. </script>
  574. </ons-page>
  575. </template>
  576. <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------- -->
  577. <template id="instituto.html">
  578. <ons-page id="instituto">
  579. <ons-card>
  580. <h1>Instituto de Cultura Puertorriqueña</h1>
  581. <h3>Ven, descubre lo que nuestra riqueza cultural puertorriqueña tiene para tí.<br> Disfrútala, es tu identidad.
  582. </h3>
  583. <body>
  584. <br>
  585. El Instituto de Cultura Puertorriqueña (ICP) tiene como misión investigar, conservar, promover y divulgar la cultura puertorriqueña en su diversidad y complejidad. Con la memoria y la promesa de la cultura, los distintos niveles, sectores, edades e intereses de la comunidad crean el conjunto de modos de vida, costumbres y manifestaciones artísticas que nos identifica como país. El ICP existe para preservar y divulgar estos saberes, difundir internacionalmente nuestro talento y enriquecer el amor a lo propio.
  586. <br><br>
  587. Nuestras tradiciones no son rígidos objetos de museo, sino actividades vivas en constante renovación y reapropiación, según van también desarrollándose nuevas tradiciones. El respeto a la diversidad, a lo híbrido, a lo apropiado y a lo replanteado también son parte esencial de esta institución que busca activamente la colaboración de todos en un quehacer que debe ser siempre compartido de la mano con su ingente diversidad.
  588. <br><br>
  589. Prof. Carlos R. Ruiz Cortés<br>
  590. Director Ejecutivo<br>
  591. Instituto de Cultura Puertorriqueña<br>
  592. Directorio Artesanal Cultural PR <img src="img/gobierno.png" style="width:35px;height:35px;border:0;">
  593. <br><br>
  594. </body>
  595. Visita nuestra <a href="https://www.icp.pr.gov/">Página Web</a> o síguenos en nuestras redes sociales: <br>
  596. <a href="https://twitter.com/icppr"><img src="img/twitter.png" alt="Twitter" style="width:35px;height:35px;border:0;">
  597. </a>
  598. <a href="https://facebook.com/icppr"><img src="img/facebook.png" alt="Facebook" style="width:35px;height:35px;border:0;">
  599. </a>
  600. <a href="https://youtube.com/user/icppr"><img src="img/youtube.png" alt="Youtube" style="width:35px;height:35px;border:0;">
  601. </a>
  602. <a href="https://instagram.com/icppr"><img src="img/instagram.png" alt="Instagram" style="width:35px;height:35px;border:0;">
  603. </a>
  604. <!--</div>
  605. <!--</p>-->
  606. </ons-card>
  607. </ons-page>
  608. </template>
  609. <script src="js/load.js"></script>
  610. <script type="text/javascript" src="cordova.js"></script>
  611. <script type="text/javascript" src="js/index.js"></script>
  612. </body>
  613. </html>