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

index.html 53KB

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