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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952
  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. 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. <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"/>
  29. -->
  30. <meta http-equiv="Content-Security-Policy" content="style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com;">
  31. <!--these three for the calendar-->
  32. <link href="https://fonts.googleapis.com/css?family=Roboto+Condensed" rel="stylesheet">
  33. <!-- <link href="css/robotocondensed.css" rel="stylesheet"> -->
  34. <link rel="stylesheet" href="calendar_files/css/demo.css"/>
  35. <link rel="stylesheet" href="css/file.css"/>
  36. <link rel="stylesheet" href="calendar_files/css/theme1.css"/>
  37. <!--this is for the search bar-->
  38. <link rel = "stylesheet" href = "css/searchbar1.css">
  39. <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover">
  40. <meta name="format-detection" content="telephone=no">
  41. <meta name="msapplication-tap-highlight" content="no">
  42. <meta charset="UTF-8">
  43. <link rel="stylesheet" type="text/css" href="css/index.css">
  44. <link rel="stylesheet" href="lib/OnsenUI/css/onsenui.css">
  45. <link rel="stylesheet" href="lib/OnsenUI/css/onsen-css-components.min.css">
  46. <script src="lib/OnsenUI/js/onsenui.min.js"></script>
  47. <script src="js/jquery_.js"></script>
  48. <script type="text/javascript" src="js/saveLocal.js"></script>
  49. </head>
  50. <body>
  51. <script>
  52. </script>
  53. <!--the toolbar is where it will have the main name of the app and the ICP logo (top center)-->
  54. <ons-page>
  55. <ons-toolbar>
  56. <div class="center">ArtesaníasICP</div>
  57. <div class="right"><img class="list-item__thumbnail" src="img/ICP.png"></div>
  58. </ons-toolbar>
  59. <!--The tabbar is the place where the user can get acces to the different sections of the app-->
  60. <!--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-->
  61. <ons-tabbar swipeable position="bottom" modifier="autogrow">
  62. <ons-tab page="home.html" label="Hogar" icon = "md-home" active></ons-tab>
  63. <ons-tab page="renglones.html" label="Artesanías" icon = "md-brush"></ons-tab>
  64. <ons-tab page ="search.html" label="Buscar" icon = "md-search"> </ons-tab>
  65. <ons-tab page ="ferias.html" label="Eventos" icon = "md-calendar-alt"> </ons-tab>
  66. <ons-tab page="colaboradores.html" label="Colab" icon = "md-mood"></ons-tab>
  67. </ons-tabbar>
  68. </ons-page>
  69. <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------- -->
  70. <template id="home.html">
  71. <ons-page id="home" class="red">
  72. <ons-card id="azar">
  73. <!--<div class="title" id="Title"></div>-->
  74. <div id="image"></div><br>
  75. <div class="content" id="Content"></div>
  76. <!--This javascript will randomly choose an image and information of a certain type of artesania used by a certain artists-->
  77. <!--For now all this information is stored inside a .csv file-->
  78. <script type="text/javascript" src="js/azar.js"> </script>
  79. </ons-card>
  80. </ons-page>
  81. </template>
  82. <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------- -->
  83. <!-- This is the page that's accesed when someone clicks on a renglon (tipo de material usado) and then artesanos, it will show a list of all theartists that work with that type of material
  84. -->
  85. <template id="artesanos.html">
  86. <ons-page id="artesanos">
  87. <!-- This button lets the user go back to the previous page of the artesanias tab-->
  88. <ons-toolbar>
  89. <div class="left"><ons-back-button>Atrás</ons-back-button></div>
  90. <div class="center"></div>
  91. </ons-toolbar>
  92. <!--Not sure what this does....-->
  93. <!-- when you pull down and are already at the top of the artesanos list then you see that fa-arrow-down on the top-->
  94. <ons-pull-hook id="pull-hook" threshold-height="120px">
  95. <ons-icon id="pull-hook-icon" size="22px" class="pull-hook-content" icon="md-long-arrow-down"></ons-icon>
  96. </ons-pull-hook>
  97. <!--This is where it will make the list, so the function that puts the artists here should reference this -->
  98. <ons-list id="artesanos-list" src="">
  99. <ons-list-header>Artesanos</ons-list-header>
  100. </ons-list>
  101. <script>
  102. ons.getScriptPage().onInit = function () {
  103. //not sure what this does, because I dont really know what this.data.title have inside
  104. //But I think what it has is the renglon that the user chose in the previous tab, and then using it as the title on this page
  105. this.querySelector('ons-toolbar div.center').textContent = this.data.title;
  106. //var File = this.data.title.toUpperCase() + '.json' ;
  107. //seperates all different types of especificaciones
  108. var Esp = this.data.esp.split(', ');
  109. //Puts the json file of all the artesanos into this variable
  110. var artesanos_json = this.data.json;
  111. //Turns the first character into an upper case
  112. //Convertir en mayuscula primera letra del string.
  113. for(var i=0; i<Esp.length; i++) {
  114. Esp[i] = Esp[i].charAt(0).toUpperCase() + Esp[i].slice(1);
  115. };
  116. //This is what happens when you scroll the list of names down when its already at the top
  117. //First the arrow faces down, at some point it spins and points to the top, right before the user's finger stops touching the screen
  118. //or if their finger goes back down.
  119. var pullHook = document.getElementById('pull-hook');
  120. var icon = document.getElementById('pull-hook-icon');
  121. pullHook.addEventListener('changestate', function (event) {
  122. switch (event.state) {
  123. case 'initial':
  124. icon.setAttribute('icon', 'md-long-arrow-down');
  125. icon.removeAttribute('rotate');
  126. icon.removeAttribute('spin');
  127. break;
  128. case 'preaction':
  129. icon.setAttribute('icon', 'md-long-arrow-down');
  130. icon.setAttribute('rotate', '180');
  131. icon.removeAttribute('spin');
  132. break;
  133. case 'action':
  134. icon.setAttribute('icon', 'md-spinner');
  135. icon.removeAttribute('rotate');
  136. icon.setAttribute('spin', true);
  137. break;
  138. }
  139. });
  140. //This function recieves a number that is tied to a specific Especificacion (type of artesania that artist make like: boligrafos,figuras...) in the variable Esp declared beforehand
  141. //Then it finds and copies all the information of the artists that work on that type of artesania
  142. //It ends up returning the especificacion in 'name' and retuns all the names and municipios of the artists that it found in 'artesan'
  143. var getArtesania = function (num) {
  144. //First it empty in case we dont find anyone, this is the variable where the information of the artist's name and municipio will be sent
  145. var Artesanos = ``;
  146. console.log('Filtrado de ',Esp[num])
  147. //results: This variable will have all the information about the artists who work with that especificacion, it will look for this in the artesanos_json that has the whole json file of artesanos.
  148. //I dont think its using 'searchVal' for anything....
  149. var results = [];
  150. var searchVal = "my Name";
  151. for (var i=0 ; i < artesanos_json.length ; i++)
  152. {
  153. if (artesanos_json[i].Especificaciones.includes(Esp[num])) {
  154. results.push(artesanos_json[i]);
  155. }
  156. }
  157. /*var arr1=artesanos_json.filter(function(item){
  158. return item.Nombre=="Ana";
  159. });*/
  160. //After going through the whole json file
  161. //It adds the names and municipios of the ones found and later stored in 'results' to the 'Artesanos' variable
  162. for(var i=0; i<results.length; i++) {
  163. //if(Esp[num] in artesanos_json.) {}
  164. Artesanos=Artesanos+`<a id='home.html'>${results[i].Nombre} | ${results[i].Municipio}<br>`
  165. //`<a id='home.html'>${Artesania.artesano} | ${Artesania.municipio}</a> `
  166. }
  167. return {
  168. name: Esp[num],
  169. artesan: Artesanos
  170. };
  171. };
  172. //Then this function returns the name of the Especificacion that was searched in 'name'
  173. //And it also returns all the names and municipios of the artesanos that work with that especificacion
  174. var getData = function () {
  175. const data = [];
  176. for (var i = 0; i < Esp.length; i++) {
  177. data.push(getArtesania(i));
  178. }
  179. return data;
  180. };
  181. //not sure what this does because the element is also created later on, with even more information so idk if this one is just wrong
  182. //This will create a new tab with the information of the arteanos?
  183. var createArtesano = function (Artesano) {
  184. return ons.createElement(`
  185. <ons-list-item expandable tappable>
  186. <div class="center" >${Artesano.Nombre}</div>
  187. <div class="expandable-content"> Municipio: ${Artesano.Municipio}<br>
  188. Tel\u00e9fono: ${Artesano["Telefono 1"]}<br>
  189. Correo Electr\u00f3nico: ${Artesano["Email"]}<br>
  190. </div>
  191. </ons-list-item>`
  192. );
  193. };
  194. //var Artesanias = getData();
  195. //artesanos_json
  196. for (Artesano of artesanos_json) {
  197. var cont = 0;
  198. var lista = document.getElementById('artesanos-list');
  199. //Recopilar datos no vacios.
  200. //Counts all the tyoes of data that the artists don't have
  201. //Later on, if you discover that they didn't have 'municipios', telephone numbers, emails and especificaciones then you wont display it.
  202. if (Artesano.Municipio.trim().length != 0) {
  203. cont ++;
  204. }
  205. if (Artesano["Telefono 1"].trim().length != 0) {
  206. cont ++;
  207. }
  208. if (Artesano["Email"].trim().length != 0 & Artesano["Email"].toUpperCase().trim() != "NO TIENE") {
  209. cont ++;
  210. }
  211. if (Artesano.Especificacion.trim().length != 0) {
  212. cont ++;
  213. }
  214. Artesano.Nombre = Artesano.Nombre + " " + Artesano["Apellido Paterno"] + " " + Artesano["Apellido Materno"];
  215. //info a pasar
  216. //'title':'${Artesano.Nombre}','esp': '${info}'
  217. //Tries to pass all the info of each artesano into a new page, the page that display this information is 'artesano.html', not to be confused with 'artesanias.html' or 'artesanos.html'(current page)
  218. //And puts this into the 'item' variable
  219. var item = ons.createElement(`<ons-list-item onclick="myNavigator.pushPage('artesano.html', { data: { title: '${Artesano.Nombre.replace(/"/g, " ")}', mun: '${Artesano.Municipio}', tel: '${Artesano["Telefono 1"]}', email: '${Artesano["Email"]}', esp: '${Artesano.Especificacion}', red1: '${Artesano["Red Social 1"]}', red2: '${Artesano["Red Social 2"]}', ecom: '${Artesano["E-Commerce 1"]}', tecnicas: '${Artesano["Tecnica"]}' } })" tappable>
  220. <div class="title">${Artesano.Nombre}</div>
  221. </ons-list-item>`);
  222. //If it didn't find 'municipios', telephone numbers, emails and 'especificaciones' of that artists then it wont include it on the 'artesanos-list' (variable: 'lista')
  223. //If it found that it has at least one of them then it will include it into the list.
  224. if(cont == 0){
  225. //console.log(Artesano.Nombre+' no tiene ningun tipo de informacion.');
  226. //return ons.createElement(``);
  227. }
  228. else {
  229. lista.appendChild(item);
  230. }
  231. };
  232. };
  233. </script>
  234. <style>
  235. .pull-hook-content {
  236. color: #333;
  237. transition: transform .25s ease-in-out;
  238. }
  239. </style>
  240. </ons-page>
  241. </template>
  242. <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------- -->
  243. <template id="artesanias.html">
  244. <ons-page id="artesanias">
  245. <ons-toolbar>
  246. <div class="left"><ons-back-button>Atrás</ons-back-button></div>
  247. <div class="center"></div>
  248. </ons-toolbar>
  249. <ons-pull-hook id="pull-hook" threshold-height="120px">
  250. <ons-icon id="pull-hook-icon" size="22px" class="pull-hook-content" icon="md-long-arrow-down"></ons-icon>
  251. </ons-pull-hook>
  252. <ons-list id="artesania-list" src="">
  253. <ons-list-header>Artesanias</ons-list-header>
  254. </ons-list>
  255. <script>
  256. ons.getScriptPage().onInit = function () {
  257. this.querySelector('ons-toolbar div.center').textContent = this.data.title;
  258. //var File = this.data.title.toUpperCase() + '.json' ;
  259. var Esp = this.data.esp.split(', ');
  260. var artesanos_json = this.data.json;
  261. //Convertir en mayuscula primera letra del string.
  262. for(var i=0; i<Esp.length; i++) {
  263. Esp[i] = Esp[i].charAt(0).toUpperCase() + Esp[i].slice(1);
  264. };
  265. var pullHook = document.getElementById('pull-hook');
  266. var icon = document.getElementById('pull-hook-icon');
  267. pullHook.addEventListener('changestate', function (event) {
  268. switch (event.state) {
  269. case 'initial':
  270. icon.setAttribute('icon', 'md-long-arrow-down');
  271. icon.removeAttribute('rotate');
  272. icon.removeAttribute('spin');
  273. break;
  274. case 'preaction':
  275. icon.setAttribute('icon', 'md-long-arrow-down');
  276. icon.setAttribute('rotate', '180');
  277. icon.removeAttribute('spin');
  278. break;
  279. case 'action':
  280. icon.setAttribute('icon', 'md-spinner');
  281. icon.removeAttribute('rotate');
  282. icon.setAttribute('spin', true);
  283. break;
  284. }
  285. });
  286. var getArtesania = function (num) {
  287. var Artesanos = ``,
  288. ArtesanosInfo = ``;
  289. //console.log('Filtrado de ',Esp[num])
  290. var results = [];
  291. var searchVal = "my Name";
  292. for (var i=0 ; i < artesanos_json.length ; i++)
  293. {
  294. if (artesanos_json[i].Especificacion.includes(Esp[num])) {
  295. results.push(artesanos_json[i]);
  296. }
  297. }
  298. /*var arr1=artesanos_json.filter(function(item){
  299. return item.Nombre=="Ana";
  300. });*/
  301. for(var i=0; i<results.length; i++) {
  302. //if(Esp[num] in artesanos_json.) {}
  303. //results[i].Nombre = results[i].Nombre + " " + results[i]["Apellido Paterno"] + " " + results[i]["Apellido Materno"]
  304. ANombre = results[i].Nombre + " " + results[i]["Apellido Paterno"] + " " + results[i]["Apellido Materno"]
  305. Artesanos+=`${ANombre}|`
  306. ArtesanosInfo+=`${results[i].Municipio}|${results[i]["Telefono 1"]}|${results[i]["Email"]}|${results[i].Especificacion}|${results[i]["E-Commerce 1"]}|${results[i]["Red Social 1"]}|${results[i]["Red Social 2"]}|${results[i]["Tecnica"]}&&`
  307. //`<a id='home.html'>${Artesania.artesano} | ${Artesania.municipio}</a> `
  308. }
  309. return {
  310. name: Esp[num],
  311. artesan: Artesanos,
  312. info: ArtesanosInfo
  313. };
  314. };
  315. var getData = function () {
  316. const data = [];
  317. for (var i = 0; i < Esp.length; i++) {
  318. data.push(getArtesania(i));
  319. }
  320. return data;
  321. };
  322. var createArtesania = function (Artesania) {
  323. //console.log('Devuelto elemento')
  324. var listaArt=``;
  325. var arts = Artesania.artesan.split('|');
  326. var artsInfo = Artesania.info.split('&&');
  327. for(var i=0; i<arts.length; i++) {
  328. var lot = artsInfo[i].split('|'),
  329. mun = lot[0],
  330. tel = lot[1],
  331. email = lot[2],
  332. esp = lot[3],
  333. ecom = lot[4],
  334. red1 = lot[5];
  335. red2 = lot[6];
  336. tecnicas = lot[7]
  337. console.log(lot)
  338. listaArt += `<ons-item tappable onclick="myNavigator.pushPage('artesano.html', {data: {title:'${arts[i].replace(/"/g, " ")}', mun: '${mun}', tel: '${tel}', email: '${email}', esp: '${esp}', red1: '${red1}', red2: '${red2}', ecom: '${ecom}', tecnicas: '${tecnicas}' }} )" ><div class="center">`+ arts[i] +`</div></ons-item><br>`;
  339. }
  340. if (Artesania.name == "Figuras y simbolos indigenas") {
  341. Artesania.name = "Figuras y símbolos indígenas";
  342. }
  343. return ons.createElement(`
  344. <ons-list-item expandable tappable>
  345. <div class="center" >${Artesania.name}</div>
  346. <div class="expandable-content">Artesanos que trabajan con ${Artesania.name}
  347. <ons-card>${listaArt}</ons-card></div>
  348. </ons-list-item>`
  349. );
  350. };
  351. var Artesanias = getData();
  352. for (Art of Artesanias) {
  353. var Artesania = createArtesania(Art);
  354. document.getElementById('artesania-list').appendChild(Artesania);
  355. };
  356. pullHook.onAction = function (done) {
  357. setTimeout(function() {
  358. document.getElementById('artesania-list').appendChild(createArtesania(getArtesania()));
  359. done();
  360. }, 400);
  361. }
  362. };
  363. </script>
  364. <style>
  365. .pull-hook-content {
  366. color: #333;
  367. transition: transform .25s ease-in-out;
  368. }
  369. </style>
  370. </ons-page>
  371. </template>
  372. <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------- -->
  373. <!----------------------------------------------------------------------------------->
  374. <!--
  375. The searchfunctions.js file is just a file that has all the definitions of the functions used later on in the switch
  376. -->
  377. <script src = "js/searchfunctions.js"></script>
  378. <script>
  379. //'all_artesanos' is the variable containing the JSON file that has all the artesanos with their data
  380. var all_artesanos = JSON.parse(window.localStorage.getItem('TODOS'));
  381. function filter(){
  382. //finds the values of the search bar which are sent from the block of code after this script
  383. //input is the one you use to filter by any parameter
  384. //inputarte is the one you use to filter by the type of art the artists make
  385. //inputmuni is the one you use to filter by municipio
  386. //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")
  387. var input = document.getElementById('searchbar').value;
  388. var inputarte = document.getElementById('searchartesania').value;
  389. var inputmuni = document.getElementById('searchbarmunicipio').value;
  390. var x = document.getElementsByClassName('artists');
  391. //validating input so that its not as easy to attack
  392. //no acepta strings mayores que 40 caracteres y no acepta '>' o '<' en el string
  393. input = input_validation(input);
  394. inputarte = input_validation(inputarte);
  395. inputmuni = input_validation(inputmuni);
  396. //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)
  397. //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)
  398. input = input.trim().toLowerCase();
  399. inputarte = inputarte.trim().toLowerCase();
  400. inputmuni = inputmuni.trim().toLowerCase();
  401. input = acento_replace(input);
  402. inputarte = acento_replace(inputarte);
  403. inputmuni = acento_replace(inputmuni);
  404. //default case is where evey one of them has nothing or less than 3 characters (displays every artist until it passes that length)
  405. if (input.length <= 3 && inputarte.length <= 3 && inputmuni.length <= 3){
  406. for (var i = 0; all_artesanos.length; i++){
  407. x[i].style.display = "list-item";
  408. }
  409. }
  410. else{
  411. var cases = 0;
  412. cases = getcasenum(input,inputarte,inputmuni);
  413. //take every one of them out first (dont display any)
  414. for (var i = 0; i < all_artesanos.length; i++){
  415. x[i].style.display = "none";
  416. }
  417. switch(cases){
  418. //cases == 1 when only inputmuni has been writen on
  419. case 1:
  420. filter_municipios(inputmuni);
  421. break;
  422. //cases == 2 when only inputarte has been written on
  423. case 2:
  424. filter_artesanias(inputarte);
  425. break;
  426. //cases == 3 when inputarte and inputmuni has been written on
  427. case 3:
  428. search_art_mun(inputarte,inputmuni);
  429. break;
  430. //cases == 4 when input has been writen on
  431. case 4:
  432. filter_any(input);
  433. break;
  434. //cases == 5 when input and inputmuni has been written on
  435. case 5:
  436. search_any_mun(input,inputmuni);
  437. break;
  438. //cases == 6 when input and inputart has been written on
  439. case 6:
  440. search_any_art(input,inputarte);
  441. break;
  442. //cases == 7 when input, inputart and inputmuni has been writen on
  443. case 7:
  444. search_any_art_mun(input,inputarte,inputmuni);
  445. break;
  446. }
  447. }
  448. }
  449. </script>
  450. <template id="search.html">
  451. <ons-navigator swipeable animation="slide" id="SNavigator">
  452. <ons-page id="Buscar">
  453. <!--
  454. 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)
  455. The first search bar is to find by any information related to the artist
  456. The second searchbar is to find by the type of artwork they work on
  457. The third searchbar is to find by the municipio where the artists works or lives
  458. -->
  459. <p style="text-align: center; margin-top: 10px;background-color: white">
  460. <ons-search-input placeholder="Búsqueda con cualquier término" id = "searchbar"
  461. onkeyup = "filter()" style = "width: 300px;" ></ons-search-input>
  462. <ons-search-input placeholder="Búsqueda por artesanías" id = "searchartesania"
  463. onkeyup = "filter()" style = "width: 300px;"></ons-search-input>
  464. <ons-search-input placeholder = "Búsqueda por municipio" id = "searchbarmunicipio"
  465. onkeyup = "filter()" style = "width: 300px;"></ons-search-input>
  466. </p>
  467. <ons-list id="results" src="">
  468. </ons-list>
  469. <script>
  470. //This is basically declaring what we refer to as informacion in the filter() function
  471. //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.
  472. for (i = 0; i < all_artesanos.length;i++){
  473. all_artesanos[i].Nombre = all_artesanos[i].Nombre + " " + all_artesanos[i]["Apellido Paterno"] + " " + all_artesanos[i]["Apellido Materno"];
  474. var artesano = ons.createElement(`<ons-list-item class = "artists"
  475. onclick="SNavigator.pushPage('artesano_s.html', { data: {title: '${all_artesanos[i].Nombre.replace(/"/g, " ")}', mun: '${all_artesanos[i].Municipio}', tel: '${all_artesanos[i]["Telefono 1"]}', email: '${all_artesanos[i]["Email"]}', esp: '${all_artesanos[i].Especificacion}', red1: '${all_artesanos[i]["Red Social 1"]}', red2: '${all_artesanos[i]["Red Social 2"]}', ecom: '${all_artesanos[i]["E-Commerce 1"]}', tecnicas: '${all_artesanos[i]["Tecnica"]}' } })" tappable>
  476. <div>${all_artesanos[i].Nombre}</div>
  477. </ons-list-item>`);
  478. document.getElementById('results').appendChild(artesano);
  479. }
  480. </script>
  481. </ons-page>
  482. </ons-navigator>
  483. </template>
  484. <!-- ---------------------------------------------------------------------------------------------------------------------------------------- -->
  485. <!--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-->
  486. <template id= "artesano.html">
  487. <ons-page id = "artesano">
  488. <ons-toolbar>
  489. <!-- Pretty self explanatory, its a button that goes back to the previous page -->
  490. <div class = "left"> <ons-back-button> Atras </ons-back-button></div>
  491. <div class = "center"></div>
  492. </ons-toolbar>
  493. <body>
  494. <font size="+1">
  495. <!-- This is where we'll put all the information of that artsts -->
  496. <ons-card id="all"></ons-card>
  497. </font>
  498. </body>
  499. <script>
  500. //when it opens this page this function starts to run, it first recieves the information that was sent to "artesano.html"
  501. ons.getScriptPage().onInit = function () {
  502. this.querySelector('ons-toolbar div.center').textContent = this.data.title;
  503. var data = '',
  504. mun = this.data.mun,
  505. tel = this.data.tel,
  506. em = this.data.email,
  507. esp = this.data.esp,
  508. red1 = this.data.red1,
  509. red2 = this.data.red2,
  510. ecom = this.data.ecom,
  511. tecnicas = this.data.tecnicas;
  512. //here the email is the string made from the start to where the '#' is.
  513. //Here it's dividing all the especificaciones and writing them into the page (data) and then goes to the next line
  514. //if it has many especificaciones then it will replace all the ';' in it with ',' and writes it into the page
  515. //but if theres only one then you just write it into the page
  516. if(esp.trim() != ""){
  517. //Fixes phrase error in json
  518. if(esp.includes("Figuras y simbolos indigenas")) {
  519. esp = esp.replace("Figuras y simbolos indigenas", "Figuras y símbolos indígenas")
  520. }
  521. if(esp.includes(";", 0)){
  522. esp=esp.replace(/;/g,", ");
  523. data+='Tipos de artesanías: '+esp+'<br>';
  524. }
  525. else {
  526. data+='Tipo de artesanía: '+esp+'<br>';
  527. }
  528. }
  529. if(tecnicas.trim() != ''){
  530. if(tecnicas.includes(";", 0)){
  531. tecnicas = tecnicas.replace(/;/g,", ");
  532. data+='Técnicas que usan: '+tecnicas+'<br>';
  533. }
  534. else {
  535. data+='Técnicas que usan: '+tecnicas+'<br>';
  536. }
  537. }
  538. //console.log("Las redes son..."+this.data.redes);
  539. //Here it's making sure theres something in municipio and writing their municipio into the page
  540. if(mun.trim() != ""){
  541. data+='Municipio: '+ mun +'<br>';
  542. }
  543. //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
  544. //Whenever the variable is empty or if it has "NO TIENE" then it doesnt write anything
  545. if(em.trim() != "" & em.toUpperCase().trim() != "NO TIENE"){
  546. data+='Correo Electr\u00f3nico: <a style="color:blue" href="mailto: '+em+'"><u>'+em+'</u></a><br>';
  547. }
  548. //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
  549. if(tel.trim() != "" ){
  550. data+='Tel\u00e9fono: <a style="color:blue" href="tel: '+ tel +'"><u>'+ tel +'</u></a><br>';
  551. }
  552. //Here it has to decide what to do depending on the links they give to their social media pages
  553. //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.
  554. //If it's none of them then it will not display anything
  555. //First Social Media
  556. if(red1.includes("facebook")){
  557. data+='<a style="margin-right:10px;" href="'+ red1 + '"><img src="img/facebook.png" alt="Facebook"style="width:35px;height:35px;border:0;">';
  558. }
  559. else if(red1.includes("instagram")){
  560. data+='<a style="margin-right:10px;" href="'+ red1 + '"><img src="img/instagram.png" alt="Instagram"style="width:35px;height:35px;border:0;">';
  561. }
  562. else if(red1.includes("myspace")){
  563. data+='<a style="margin-right:10px;" href="'+ red1 + '"><img src="img/MySpace.png" alt="MySpace"style="width:35px;height:35px;border:0;">';
  564. }
  565. //Second Social Media
  566. if(red2.includes("facebook")){
  567. data+='<a style="margin-right:10px;" href="'+ red2 + '"><img src="img/facebook.png" alt="Facebook"style="width:35px;height:35px;border:0;">';
  568. }
  569. else if(red2.includes("instagram")){
  570. data+='<a style="margin-right:10px;" href="'+ red2 + '"><img src="img/instagram.png" alt="Instagram"style="width:35px;height:35px;border:0;">';
  571. }
  572. else if(red2.includes("myspace")){
  573. data+='<a style="margin-right:10px;" href="'+ red2 + '"><img src="img/MySpace.png" alt="MySpace"style="width:35px;height:35px;border:0;">';
  574. }
  575. //E-commerce
  576. if ((ecom.includes(".org") || ecom.includes(".com")) && !ecom.includes("mailto")){
  577. ecom = ecom.substr(ecom.indexOf("#")+1,ecom.length);
  578. // ecom = ecom.substr(0, ecom.length-1);
  579. console.log(ecom);
  580. data+='<a target="_blank" href="https://'+ ecom + '"><img src="img/internet.jpg" style="width:35px;height:35px;border:0;">';
  581. }
  582. //This is the part that allows eveything (data) to be displayed
  583. document.getElementById("all").innerHTML = `${data}`;
  584. }
  585. </script>
  586. </ons-page>
  587. </template>
  588. <template id= "artesano_s.html">
  589. <ons-page id = "artesano_s">
  590. <ons-toolbar>
  591. <!-- Pretty self explanatory, its a button that goes back to the previous page -->
  592. <div class = "left"> <ons-back-button> Atras </ons-back-button></div>
  593. <div class = "center"></div>
  594. </ons-toolbar>
  595. <body>
  596. <!-- This is where we'll put all the information of that artsts -->
  597. <font size="+1">
  598. <ons-card id="all2"></ons-card>
  599. </font>
  600. </body>
  601. <script>
  602. //when it opens this page this function starts to run, it first recieves the information that was sent to "artesano.html"
  603. ons.getScriptPage().onInit = function () {
  604. this.querySelector('ons-toolbar div.center').textContent = this.data.title;
  605. var data = '',
  606. mun = this.data.mun,
  607. tel = this.data.tel,
  608. em = this.data.email,
  609. esp = this.data.esp,
  610. red1 = this.data.red1,
  611. red2 = this.data.red2,
  612. ecom = this.data.ecom,
  613. tecnicas = this.data.tecnicas;
  614. //here the email is the string made from the start to where the '#' is.
  615. //Here it's dividing all the especificaciones and writing them into the page (data) and then goes to the next line
  616. //if it has many especificaciones then it will replace all the ';' in it with ',' and writes it into the page
  617. //but if theres only one then you just write it into the page
  618. if(esp.trim() != ""){
  619. if(esp.includes("Figuras y simbolos indigenas")) {
  620. esp = esp.replace("Figuras y simbolos indigenas", "Figuras y símbolos indígenas")
  621. }
  622. if(esp.includes(";", 0)){
  623. esp=esp.replace(/;/g,", ");
  624. data+='Tipos de artesanías: '+esp+'<br>';
  625. }
  626. else {
  627. data+='Tipo de artesanía: '+esp+'<br>';
  628. }
  629. }
  630. if(tecnicas.trim() != ''){
  631. if(tecnicas.includes(";", 0)){
  632. tecnicas = tecnicas.replace(/;/g,", ");
  633. data+='Técnicas que usan: '+tecnicas+'<br>';
  634. }
  635. else {
  636. data+='Técnicas que usan: '+tecnicas+'<br>';
  637. }
  638. }
  639. //console.log("Las redes son..."+this.data.redes);
  640. //Here it's making sure theres something in municipio and writing their municipio into the page
  641. if(mun.trim() != ""){
  642. data+='Municipio: '+ mun +'<br>';
  643. }
  644. //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
  645. //Whenever the variable is empty or if it has "NO TIENE" then it doesnt write anything
  646. if(em.trim() != "" & em.toUpperCase().trim() != "NO TIENE"){
  647. data+='Correo Electr\u00f3nico: <a style="color:blue" href="mailto: '+em+'"><u>'+em+'</u></a><br>';
  648. }
  649. //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
  650. if(tel.trim() != "" ){
  651. data+='Tel\u00e9fono: <a style="color:blue" href="tel: '+ tel +'"><u>'+ tel +'</u></a><br>';
  652. }
  653. //Here it has to decide what to do depending on the links they give to their social media pages
  654. //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.
  655. //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
  656. //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.
  657. //If it's none of them then it will not display anything
  658. if(red1.includes("facebook")){
  659. data+='<a style="margin-right:10px;" href="'+ red1 + '"><img src="img/facebook.png" alt="Facebook"style="width:35px;height:35px;border:0;">';
  660. }
  661. else if(red1.includes("instagram")){
  662. data+='<a style="margin-right:10px;" href="'+ red1 + '"><img src="img/instagram.png" alt="Instagram"style="width:35px;height:35px;border:0;">';
  663. }
  664. else if(red1.includes("myspace")){
  665. data+='<a style="margin-right:10px;" href="'+ red1 + '"><img src="img/MySpace.png" alt="MySpace"style="width:35px;height:35px;border:0;">';
  666. }
  667. //Second Social Media
  668. if(red2.includes("facebook")){
  669. data+='<a style="margin-right:10px;" href="'+ red2 + '"><img src="img/facebook.png" alt="Facebook"style="width:35px;height:35px;border:0;">';
  670. }
  671. else if(red2.includes("instagram")){
  672. data+='<a style="margin-right:10px;" href="'+ red2 + '"><img src="img/instagram.png" alt="Instagram"style="width:35px;height:35px;border:0;">';
  673. }
  674. else if(red2.includes("myspace")){
  675. data+='<a style="margin-right:10px;" href="'+ red2 + '"><img src="img/MySpace.png" alt="MySpace"style="width:35px;height:35px;border:0;">';
  676. }
  677. if((ecom.includes(".org") || ecom.includes(".com")) && !ecom.includes("mailto")){
  678. ecom = ecom.substr(ecom.indexOf("#")+1,ecom.length);
  679. // ecom = ecom.substr(0, ecom.length-1);
  680. console.log(ecom);
  681. data+='<a target="_blank" href="https://'+ ecom + '"><img src="img/internet.jpg" style="width:35px;height:35px;border:0;">';
  682. }
  683. //This is the part that allows eveything (data) to be displayed
  684. document.getElementById("all2").innerHTML = `${data}`;
  685. }
  686. </script>
  687. </ons-page>
  688. </template>
  689. <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------- -->
  690. <template id="renglones.html">
  691. <ons-navigator swipeable animation="slide" id="myNavigator">
  692. <ons-page id="renglones">
  693. <ons-card id="list">
  694. <script type="text/javascript" src="js/renglones.js"></script>
  695. </ons-card>
  696. <!--Javascript function to hide other open expandables-->
  697. <script>
  698. const hideAll = () => {
  699. Array.from(document.querySelector('#list').children)
  700. .forEach(item => {
  701. if (item.expanded) {
  702. item.hideExpansion();
  703. }
  704. });
  705. };
  706. </script>
  707. <style>
  708. .intro {
  709. text-align: center;
  710. padding: 20px;
  711. margin-top: 30px;
  712. }
  713. ons-card {
  714. cursor: pointer;
  715. color: #333;
  716. }
  717. .card__title,
  718. .card--material__title {
  719. font-size: 15px;
  720. }
  721. </style>
  722. </ons-page>
  723. </ons-navigator>
  724. </template>
  725. <!-- -------------------------------------------------------------------------------------------------------------------------------------------------------
  726. -->
  727. <template id="ferias.html">
  728. <ons-page id="ferias">
  729. <ons-card>
  730. <div id="logo" style="text-align: center">
  731. <img src="img/culturalpr1800x3200-2-01.png" style="width:150px;height:100px">
  732. </div>
  733. <br><br>
  734. <div id="button" style="text-align: center">
  735. <ons-button onclick="redirect()" modifier="large" style="background-color: #00abc1;"> Pasar a la página de eventos </ons-button>
  736. </div>
  737. <br><br>
  738. <div id="Mensaje">
  739. El Instituto de Cultura Puertorriqueña, el Gobierno de Puerto Rico, los Colaboradores de esta aplicación, así como los funcionarios, empleados y contratistas de los anteriores, no se hacen responsables de los mensajes, imágenes, opiniones, servicios, declaraciones, representaciones o cualquier forma de contenido incluido en cualquiera de los enlaces accesibles, vinculados o referidos a través de ArtesaníasICP.
  740. </div>
  741. </ons-card>
  742. <script>
  743. function redirect() {
  744. location.replace("https://culturalpr.com/")
  745. }
  746. </script>
  747. </ons-page>
  748. </template>
  749. <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------- -->
  750. <template id="colaboradores.html">
  751. <ons-page id="colaboradores">
  752. <ons-card>
  753. <h1>Colaboradores</h1>
  754. <style>
  755. .column {
  756. float: left;
  757. width: 50%;
  758. }
  759. .row {
  760. width: 100%;
  761. }
  762. </style>
  763. <h2>SINFINESPR</h2>
  764. <div class = "column">
  765. SINFINESPR es un programa de Titín Foundation que responde a nuestro interés y compromiso con el fortalecimiento del tercer sector.
  766. <br><br>
  767. En esta plataforma agrupamos herramientas que permitirán que tu organización adquiera mayor visibilidad, recursos, conexiones, capacidad para una operación más eficiente y efectiva.
  768. </div>
  769. <div class = "column">
  770. <img src="img/sfpr.svg" style="width:150px;height:100px">
  771. </div>
  772. <br><br><br><br><br><br><br><br><br><br><br><br><br><br>
  773. Visita nuesta Página Web o siguenos en nuestras redes sociales <br> <br>
  774. <a href="https://twitter.com/SINFINESPR"><img src="img/twitter.png" alt="Twitter" style="width:35px;height:35px;border:0;">
  775. </a>
  776. <a href="https://www.facebook.com/sinfinespr"><img src="img/facebook.png" alt="Facebook" style="width:35px;height:35px;border:0;">
  777. </a>
  778. <a href="https://www.linkedin.com/company/sinfinespr/"><img src="img/linkedin.png" alt="Linkedin" style="width:35px;height:35px;border:0;">
  779. </a>
  780. <a href="https://www.instagram.com/sinfinespr/"><img src="img/instagram.png" alt="Instagram" style="width:35px;height:35px;border:0;">
  781. </a>
  782. <br><br>
  783. <h2>Centro de Desarrollo y Consultoría Computacional</h2>
  784. El Centro de Desarrollo y Consultoría Computacional está compuesto por profesores y estudiantes del departamento de Ciencia de Cómputos de la Universidad de Puerto Rico Recinto de Río Piedras. Nuestra meta es aportar al desarrollo computacional de la Universidad y de Puerto Rico al proveer servicios al día, de calidad y con precios accesibles, a la misma vez que se le ofrece experiencias prácticas a los estudiantes del departamento de Ciencia de Cómputos.
  785. <br><br>
  786. <img src="img/logo_cdcc.png" style="width: 150px; height: 100px">
  787. <br><br>
  788. Si tiene alguna duda nos puede contactar por:
  789. <br>
  790. Teléfono: 787-764-0000 Ext. 88341, 88349
  791. <br>
  792. Correo electrónico: <a href = "mailto:carlos.corrada2@upr.edu" style ="color:#0000EE;text-decoration: underline;">carlos.corrada2@upr.edu</a>
  793. </ons-card>
  794. </ons-page>
  795. </template>
  796. <script src="js/load.js"></script>
  797. <script type="text/javascript" src="cordova.js"></script>
  798. <script type="text/javascript" src="js/index.js"></script>
  799. </body>
  800. </html>