Sfoglia il codice sorgente

hice algunos comments

carlos.diaz44 4 anni fa
parent
commit
781502b725
3 ha cambiato i file con 150 aggiunte e 86 eliminazioni
  1. 4
    20
      .idea/workspace.xml
  2. 56
    29
      platforms/android/app/src/main/assets/www/index.html
  3. 90
    37
      www/index.html

+ 4
- 20
.idea/workspace.xml Vedi File

@@ -3,23 +3,7 @@
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="eb079ee0-6a1e-46bc-8208-93306bafc623" name="Default Changelist" comment="">
5 5
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
6
-      <change beforePath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/artesano.html" beforeDir="false" afterPath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/artesano.html" afterDir="false" />
7
-      <change beforePath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/img/Barro.jpg" beforeDir="false" />
8
-      <change beforePath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/img/Cristal.jpg" beforeDir="false" />
9
-      <change beforePath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/img/Cuero.jpg" beforeDir="false" />
10
-      <change beforePath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/img/Fibras.jpg" beforeDir="false" />
11
-      <change beforePath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/img/Higüera.jpg" beforeDir="false" />
12
-      <change beforePath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/img/Instrumento musical.jpg" beforeDir="false" />
13
-      <change beforePath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/img/Juguetes tradicional.jpg" beforeDir="false" />
14
-      <change beforePath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/img/Labores en aguja.jpg" beforeDir="false" />
15
-      <change beforePath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/img/Madera.jpg" beforeDir="false" />
16
-      <change beforePath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/img/Metal.jpg" beforeDir="false" />
17
-      <change beforePath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/img/Tabacos.jpg" beforeDir="false" />
18
-      <change beforePath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/img/Textiles.jpg" beforeDir="false" />
19 6
       <change beforePath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/index.html" afterDir="false" />
20
-      <change beforePath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/js/load.js" beforeDir="false" afterPath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/js/load.js" afterDir="false" />
21
-      <change beforePath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/js/renglones.js" beforeDir="false" afterPath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/js/renglones.js" afterDir="false" />
22
-      <change beforePath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/js/saveLocal.js" beforeDir="false" afterPath="$PROJECT_DIR$/platforms/android/app/src/main/assets/www/js/saveLocal.js" afterDir="false" />
23 7
       <change beforePath="$PROJECT_DIR$/www/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/www/index.html" afterDir="false" />
24 8
     </list>
25 9
     <option name="SHOW_DIALOG" value="false" />
@@ -96,14 +80,14 @@
96 80
     <servers />
97 81
   </component>
98 82
   <component name="WindowStateProjectService">
99
-    <state x="1060" y="100" width="721" height="853" key="com.android.tools.idea.avdmanager.AvdListDialog" timestamp="1601055392605">
83
+    <state x="1060" y="100" width="721" height="853" key="com.android.tools.idea.avdmanager.AvdListDialog" timestamp="1601912501124">
100 84
       <screen x="0" y="0" width="1920" height="1053" />
101 85
     </state>
102
-    <state x="1060" y="100" width="721" height="853" key="com.android.tools.idea.avdmanager.AvdListDialog/0.0.1920.1053@0.0.1920.1053" timestamp="1601055392605" />
103
-    <state x="1103" y="354" key="com.intellij.ide.util.TipDialog" timestamp="1601055351725">
86
+    <state x="1060" y="100" width="721" height="853" key="com.android.tools.idea.avdmanager.AvdListDialog/0.0.1920.1053@0.0.1920.1053" timestamp="1601912501124" />
87
+    <state x="1103" y="354" key="com.intellij.ide.util.TipDialog" timestamp="1601912489271">
104 88
       <screen x="0" y="0" width="1920" height="1053" />
105 89
     </state>
106
-    <state x="1103" y="354" key="com.intellij.ide.util.TipDialog/0.0.1920.1053@0.0.1920.1053" timestamp="1601055351725" />
90
+    <state x="1103" y="354" key="com.intellij.ide.util.TipDialog/0.0.1920.1053@0.0.1920.1053" timestamp="1601912489271" />
107 91
     <state x="632" y="275" key="run.anything.popup" timestamp="1601055384225">
108 92
       <screen x="0" y="0" width="1920" height="1053" />
109 93
     </state>

+ 56
- 29
platforms/android/app/src/main/assets/www/index.html Vedi File

@@ -6,7 +6,7 @@
6 6
     regarding copyright ownership.  The ASF licenses this file
7 7
     to you under the Apache License, Version 2.0 (the
8 8
     "License"); you may not use this file except in compliance
9
-    with the License.  You may obtain a copy of the License at
9
+n't h    with the License.  You may obtain a copy of the License at
10 10
 
11 11
     http://www.apache.org/licenses/LICENSE-2.0
12 12
 
@@ -55,12 +55,14 @@
55 55
 
56 56
 
57 57
 
58
-
58
+            <!--the toolbar is where it will have the main name of the app and the ICP logo (top center)-->
59 59
            <ons-page>
60 60
             <ons-toolbar>
61 61
                 <div class="center">Artesanias PR</div>
62 62
                 <div class="right"><img class="list-item__thumbnail" src="img/ICP.png"></div>
63 63
             </ons-toolbar>
64
+            <!--The tabbar is the place where the user can get acces to the different sections of the app-->
65
+            <!--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-->
64 66
             <ons-tabbar swipeable position="bottom" modifier="autogrow">
65 67
                 <ons-tab page="home.html" label="Hogar" active></ons-tab>
66 68
                 <ons-tab page="renglones.html" label="Artesanías"></ons-tab>
@@ -83,7 +85,8 @@
83 85
                     <!--<div class="title" id="Title"></div>-->
84 86
                     <div id="image"></div><br>
85 87
                     <div class="content" id="Content"></div>
86
-
88
+                    <!--This javascript will randomly choose an image and information of a certain type of artesania used by a certain artists-->
89
+                    <!--For now all this information is stored inside a .csv file-->
87 90
                     <script type="text/javascript" src="js/azar.js"> </script>
88 91
 
89 92
                 </ons-card>
@@ -94,10 +97,10 @@
94 97
         </template>
95 98
 
96 99
 <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------- -->
97
-
100
+        <!--Here it's in the artesanos tab-->
98 101
         <template id="artesanos.html">
99 102
             <ons-page id="artesanos">
100
-
103
+                <!-- This button lets the user go back to the previous page-->
101 104
                 <ons-toolbar>
102 105
                     <div class="left"><ons-back-button>Atrás</ons-back-button></div>
103 106
                     <div class="center"></div>
@@ -107,12 +110,13 @@
107 110
                     <ons-icon id="pull-hook-icon" size="22px" class="pull-hook-content" icon="fa-arrow-down"></ons-icon>
108 111
                 </ons-pull-hook>
109 112
 
113
+                
110 114
                 <ons-list id="artesanos-list" src="">
111 115
                     <ons-list-header>Artesanos</ons-list-header>
112 116
                 </ons-list>
113 117
 
114 118
                 <script>
115
-
119
+                    
116 120
                     ons.getScriptPage().onInit = function () {
117 121
                         this.querySelector('ons-toolbar div.center').textContent = this.data.title;
118 122
 
@@ -411,26 +415,33 @@
411 415
 
412 416
 <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------- -->
413 417
 <!----------------------------------------------------------------------------------->
418
+        <!-->
419
+            The searchfunctions.js file is just a file that has all the definitions of the functions used later on in the switch
420
+        <!-->
414 421
         <script src = "js/searchfunctions.js"></script>
415 422
         <script>
416
-            //JSON file that has all the artesanos
423
+            //all_artesanos is the JSON file that has all the artesanos
417 424
             var all_artesanos = JSON.parse(window.localStorage.getItem("TODOS"));
425
+
418 426
             function filter(){
427
+                //finds the values of the search bar which are sent from the block of code after this script
428
+                //input is the one you use to filter by any parameter
429
+                //inputarte is the one you use to filter by the type of art the artists make
430
+                //inputmuni is the one you use to filter by municipio
431
+                //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")
419 432
                 var input = document.getElementById('searchbar').value;
420 433
                 var inputarte = document.getElementById('searchartesania').value;
421 434
                 var inputmuni = document.getElementById('searchbarmunicipio').value;
422
-                var x = document.getElementsByClassName('artists');
423
-                //making sure they're all in the same format
424
-                input = input.trim().toLowerCase();
425
-                inputarte = inputarte.trim().toLowerCase();
426
-                inputmuni = inputmuni.trim().toLowerCase();
427
-                input = acento_replace(input);
428
-                inputarte = acento_replace(inputarte);
429
-                inputmuni = acento_replace(inputmuni);
430
-                //default case is where evey one of them has nothing or less than 3 characters (displays every artist)
435
+                var informacion = document.getElementsByClassName('artists');
436
+                //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)
437
+                //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)
438
+                input = acento_replace(input.trim().toLowerCase());
439
+                inputarte = acento_replace(inputarte.trim().toLowerCase());
440
+                inputmuni = acento_replace(inputmuni.trim().toLowerCase());
441
+                //default case is where evey one of them has nothing or less than 3 characters (displays every artist until it passes that length)
431 442
                 if (input.length <= 3 && inputarte.length <= 3 && inputmuni.length <= 3){
432 443
                     for (var i = 0; all_artesanos.length; i++){
433
-                        x[i].style.display = "list-item";
444
+                        informacion[i].style.display = "list-item";
434 445
                     }
435 446
                 }
436 447
                 else{
@@ -438,7 +449,7 @@
438 449
                     cases = getcasenum(input,inputarte,inputmuni);
439 450
                     //take every one of them out first (dont display any)
440 451
                     for (var i = 0; i < all_artesanos.length; i++){
441
-                        x[i].style.display = "none";
452
+                        informacion[i].style.display = "none";
442 453
                     }
443 454
                     switch(cases){
444 455
                         //cases == 1 when only inputmuni has been writen on
@@ -477,6 +488,12 @@
477 488
         <template id="search.html">
478 489
           <ons-navigator swipeable animation="slide" id="SNavigator">
479 490
             <ons-page id="Buscar">
491
+                <!--
492
+                    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)
493
+                    The first search bar is to find by any information related to the artist
494
+                    The second searchbar is to find by the type of artwork they work on
495
+                    The third searchbar is to find by the municipio where the artists works or lives?
496
+                -->
480 497
                 <p style="text-align: center; margin-top: 10px;">
481 498
                     <ons-search-input placeholder="Busqueda en cualquiera" id = "searchbar"
482 499
                         onkeyup = "filter()"></ons-search-input>
@@ -490,16 +507,13 @@
490 507
                 </ons-list>
491 508
 
492 509
                 <script>
510
+                    //This is basically declaring what we refer to as informacion in the filter() function
511
+                    //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. 
493 512
                     for (i = 0; i < all_artesanos.length;i++){
494 513
                         var artesano = ons.createElement(`<ons-list-item class = "artists"
495 514
                         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>
496 515
                         <div>${all_artesanos[i].Nombre}</div>
497 516
                     </ons-list-item>`);
498
-                        // var artesano = ons.createElement(`
499
-                        //   <ons-list-item class = "artists">
500
-                        //     <div class="center" >${all_artesanos[i].Nombre}</div>
501
-                        //   </ons-list-item>`
502
-                        // );
503 517
                         document.getElementById('results').appendChild(artesano);
504 518
                     }
505 519
                 </script>
@@ -508,17 +522,20 @@
508 522
         </template>
509 523
 
510 524
         <!-- ---------------------------------------------------------------------------------------------------------------------------------------- -->
511
-
525
+        <!--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-->
512 526
         <template id= "artesano.html">
513 527
             <ons-page id = "artesano">
514 528
                 <ons-toolbar>
529
+                    <!-- Pretty self explanatory, its a button that goes back to the previous page -->
515 530
                     <div class = "left"> <ons-back-button> Atras </ons-back-button></div>
516 531
                     <div class = "center"></div>
517 532
                 </ons-toolbar>
518 533
                 <body>
534
+                    <!-- This is where we'll put all the information of that artsts -->
519 535
                     <ons-card id="all"></ons-card>
520 536
                 </body>
521 537
                 <script>
538
+                    //when it opens this page this function starts to run, it first recieves the information that was sent to "artesano.html"
522 539
                     ons.getScriptPage().onInit = function () {
523 540
                         this.querySelector('ons-toolbar div.center').textContent = this.data.title;
524 541
 
@@ -529,7 +546,12 @@
529 546
                             esp = this.data.esp,
530 547
                             redes = this.data.redes;
531 548
 
549
+                        //here the email is the string made from the start to where the '#' is.
532 550
                         email = em.slice(0, em.search("#"));
551
+
552
+                        //Here it's dividing all the especificaciones and writing them into the page (data) and then goes to the next line
553
+                        //if it has many especificaciones then it will replace all the ';' in it with ',' and writes it into the page
554
+                        //but if theres only one then you just write it into the page
533 555
                         if(esp.trim() != ""){
534 556
                             if(esp.includes(";", 0)){
535 557
                                 esp=esp.replace(/;/g,", ");
@@ -542,25 +564,30 @@
542 564
 
543 565
                         //console.log("Las redes son..."+this.data.redes);
544 566
 
567
+                        //Here it's writing their municipio into the page
545 568
                         if(mun.trim() != ""){
546 569
                             data+='Municipio: '+ mun +'<br>';
547 570
                         }
548 571
 
572
+                        //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
573
+                        //Whenever the variable is empty or if it has "NO TIENE" then it doesnt write anything
549 574
                         if(email.trim() != "" & email.toUpperCase().trim() != "NO TIENE"){
550 575
                             data+='Correo Electr\u00f3nico: <a style="color:blue" href="mailto: '+email+'"><u>'+email+'</u></a><br>';
551 576
                         }
552 577
 
553
-                        //Underlined <u></u>
554
-                        //Color blue <p style="color:blue"></p>
555
-
578
+                        //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
556 579
                         if(tel.trim() != "" ){
557 580
                             data+='Tel\u00e9fono: <a style="color:blue" href="tel: '+ tel +'"><u>'+ tel +'</u></a><br>';
558 581
                         }
559 582
 
560 583
                         console.log("Redes: "+redes);
561 584
 
585
+                        //Here it has to decide what to do depending on the links they give to their social media pages
586
+                        //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.
587
+                        //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
588
+                        //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.
589
+                        //If it's none of them then it will not display anything.
562 590
                         if(redes.includes("facebook")){
563
-
564 591
                             console.log(redes.substring(1,redes.length-2));
565 592
                             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>';
566 593
                         }
@@ -584,7 +611,7 @@
584 611
                             console.log("no tiene nada");
585 612
                         }
586 613
 
587
-
614
+                        //This is the part that allows eveything (data) to be displayed
588 615
                         document.getElementById("all").innerHTML = `${data}`;
589 616
 
590 617
                     }

+ 90
- 37
www/index.html Vedi File

@@ -6,7 +6,7 @@
6 6
     regarding copyright ownership.  The ASF licenses this file
7 7
     to you under the Apache License, Version 2.0 (the
8 8
     "License"); you may not use this file except in compliance
9
-    with the License.  You may obtain a copy of the License at
9
+n't h    with the License.  You may obtain a copy of the License at
10 10
 
11 11
     http://www.apache.org/licenses/LICENSE-2.0
12 12
 
@@ -55,12 +55,14 @@
55 55
 
56 56
 
57 57
 
58
-
58
+            <!--the toolbar is where it will have the main name of the app and the ICP logo (top center)-->
59 59
            <ons-page>
60 60
             <ons-toolbar>
61 61
                 <div class="center">Artesanias PR</div>
62 62
                 <div class="right"><img class="list-item__thumbnail" src="img/ICP.png"></div>
63 63
             </ons-toolbar>
64
+            <!--The tabbar is the place where the user can get acces to the different sections of the app-->
65
+            <!--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-->
64 66
             <ons-tabbar swipeable position="bottom" modifier="autogrow">
65 67
                 <ons-tab page="home.html" label="Hogar" active></ons-tab>
66 68
                 <ons-tab page="renglones.html" label="Artesanías"></ons-tab>
@@ -83,7 +85,8 @@
83 85
                     <!--<div class="title" id="Title"></div>-->
84 86
                     <div id="image"></div><br>
85 87
                     <div class="content" id="Content"></div>
86
-
88
+                    <!--This javascript will randomly choose an image and information of a certain type of artesania used by a certain artists-->
89
+                    <!--For now all this information is stored inside a .csv file-->
87 90
                     <script type="text/javascript" src="js/azar.js"> </script>
88 91
 
89 92
                 </ons-card>
@@ -94,39 +97,50 @@
94 97
         </template>
95 98
 
96 99
 <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------- -->
97
-
100
+        <!-- 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 the
101
+            artists that work with that type of material
102
+        -->
98 103
         <template id="artesanos.html">
99 104
             <ons-page id="artesanos">
100
-
105
+                <!-- This button lets the user go back to the previous page of the artesanias tab-->
101 106
                 <ons-toolbar>
102 107
                     <div class="left"><ons-back-button>Atrás</ons-back-button></div>
103 108
                     <div class="center"></div>
104 109
                 </ons-toolbar>
105 110
 
111
+                <!--Not sure what this does....-->
112
+                <!-- when you pull down and are already at the top of the artesanos list then you see that fa-arrow-down on the top-->
106 113
                 <ons-pull-hook id="pull-hook" threshold-height="120px">
107 114
                     <ons-icon id="pull-hook-icon" size="22px" class="pull-hook-content" icon="fa-arrow-down"></ons-icon>
108 115
                 </ons-pull-hook>
109 116
 
117
+                <!--This is where it will make the list, so the function that puts the artists here should reference this -->
110 118
                 <ons-list id="artesanos-list" src="">
111 119
                     <ons-list-header>Artesanos</ons-list-header>
112 120
                 </ons-list>
113 121
 
114 122
                 <script>
115
-
123
+                    
116 124
                     ons.getScriptPage().onInit = function () {
125
+                        //not sure what this does, because I dont really know what this.data.title have inside 
126
+                        //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
117 127
                         this.querySelector('ons-toolbar div.center').textContent = this.data.title;
118 128
 
119
-
120
-                        //var File = this.data.title.toUpperCase() + '.json' ;
129
+                        //var File = this.data.title.toUpperCase() + '.json' 
130
+                        //seperates all types of especificaciones
121 131
                         var Esp = this.data.esp.split(', ');
132
+                        //Puts the json file of all the artesanos into this variable
122 133
                         var artesanos_json = this.data.json;
123 134
 
124
-
135
+                        //Turns the first character into an upper case
125 136
                         //Convertir en mayuscula primera letra del string.
126 137
                         for(var i=0; i<Esp.length; i++) {
127 138
                             Esp[i] = Esp[i].charAt(0).toUpperCase() + Esp[i].slice(1);
128 139
                         };
129 140
 
141
+                        //This is what happens when you putt the list of names down when its already at the top
142
+                        //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
143
+                        //or if their finger goes back down.
130 144
                         var pullHook = document.getElementById('pull-hook');
131 145
                         var icon = document.getElementById('pull-hook-icon');
132 146
                         pullHook.addEventListener('changestate', function (event) {
@@ -149,12 +163,17 @@
149 163
                             }
150 164
                         });
151 165
 
166
+                        //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
167
+                        //Then it finds and copies all the information of the artists that work on that type of artesania
168
+                        //It ends up returning the especificacion in 'name' and retuns all the names and municipios of the artists that it found in 'artesan'                                                
152 169
                         var getArtesania = function (num) {
153
-
170
+                            //First it empty in case we dont find anyone, this is the variable where the information of the artist's name and municipio qill be sent
154 171
                             var Artesanos = ``;
155 172
 
156 173
                             console.log('Filtrado de ',Esp[num])
157 174
 
175
+                            //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.
176
+                            //I dont think its using 'searchVal' for anything....
158 177
                             var results = [];
159 178
                             var searchVal = "my Name";
160 179
                             for (var i=0 ; i < artesanos_json.length ; i++)
@@ -167,7 +186,8 @@
167 186
           /*var arr1=artesanos_json.filter(function(item){
168 187
               return item.Nombre=="Ana";
169 188
           });*/
170
-
189
+                            //Arfter going through the whole json file
190
+                            //It adds the names and municipios of the ones found and later stored in 'results' to the 'Artesanos' variable
171 191
                             for(var i=0; i<results.length; i++) {
172 192
 
173 193
                                 //if(Esp[num] in artesanos_json.) {}
@@ -175,13 +195,16 @@
175 195
                                 //`<a id='home.html'>${Artesania.artesano} | ${Artesania.municipio}</a> `
176 196
                             }
177 197
 
178
-
198
+                            //Then this function returns the name of the Especificacion that was searched in 'name'
199
+                            //And it also returns all the names and municipios of the artesanos that work with that especificacion
179 200
                             return {
180 201
                                 name: Esp[num],
181 202
                                 artesan: Artesanos
182 203
                             };
183 204
                         };
184 205
 
206
+                        //This function will iterate through all the especificaciones that you listed at the start of the artesanos page
207
+                        //It will iterate throuhg each one and it will recieve the names, and municipios of the arteanos that were found to work witht that especificacion.
185 208
                         var getData = function () {
186 209
                             const data = [];
187 210
                             for (var i = 0; i < Esp.length; i++) {
@@ -190,7 +213,8 @@
190 213
                             return data;
191 214
                         };
192 215
 
193
-
216
+                        //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
217
+                        //This will create a new tab with the information of the arteanos?
194 218
                         var createArtesano = function (Artesano) {
195 219
 
196 220
                             return ons.createElement(`
@@ -207,12 +231,15 @@
207 231
                         //var Artesanias = getData();
208 232
                         //artesanos_json
209 233
 
234
+                        //
210 235
                         for (Artesano of artesanos_json) {
211 236
 
212 237
                             var cont = 0;
213 238
                             var lista = document.getElementById('artesanos-list');
214 239
 
215 240
                             //Recopilar datos no vacios.
241
+                            //Counts all the tyoes of data that the artists don't have
242
+                            //Later on, if you discover that they didn't have 'municipios', telephone numbers, emails and especificaciones then you wont display it.
216 243
                             if (Artesano.Municipio.trim().length != 0) {
217 244
                                 cont ++;
218 245
                             }
@@ -229,11 +256,14 @@
229 256
 
230 257
                             //info a pasar
231 258
                             //'title':'${Artesano.Nombre}','esp': '${info}'
259
+                            //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)
260
+                            //And puts this into the 'item' variable
232 261
                             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>
233 262
                         <div class="title">${Artesano.Nombre}</div>
234 263
                     </ons-list-item>`);
235 264
 
236
-
265
+                            //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')
266
+                            //If it found that it has at least one of them then it will include it into the list.
237 267
                             if(cont == 0){
238 268
                                 console.log(Artesano.Nombre+' no tiene ningun tipo de informacion.');
239 269
                                 //return ons.createElement(``);
@@ -411,26 +441,33 @@
411 441
 
412 442
 <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------- -->
413 443
 <!----------------------------------------------------------------------------------->
444
+        <!-->
445
+            The searchfunctions.js file is just a file that has all the definitions of the functions used later on in the switch
446
+        <!-->
414 447
         <script src = "js/searchfunctions.js"></script>
415 448
         <script>
416
-            //JSON file that has all the artesanos
449
+            //all_artesanos is the JSON file that has all the artesanos
417 450
             var all_artesanos = JSON.parse(window.localStorage.getItem("TODOS"));
451
+
418 452
             function filter(){
453
+                //finds the values of the search bar which are sent from the block of code after this script
454
+                //input is the one you use to filter by any parameter
455
+                //inputarte is the one you use to filter by the type of art the artists make
456
+                //inputmuni is the one you use to filter by municipio
457
+                //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")
419 458
                 var input = document.getElementById('searchbar').value;
420 459
                 var inputarte = document.getElementById('searchartesania').value;
421 460
                 var inputmuni = document.getElementById('searchbarmunicipio').value;
422
-                var x = document.getElementsByClassName('artists');
423
-                //making sure they're all in the same format
424
-                input = input.trim().toLowerCase();
425
-                inputarte = inputarte.trim().toLowerCase();
426
-                inputmuni = inputmuni.trim().toLowerCase();
427
-                input = acento_replace(input);
428
-                inputarte = acento_replace(inputarte);
429
-                inputmuni = acento_replace(inputmuni);
430
-                //default case is where evey one of them has nothing or less than 3 characters (displays every artist)
461
+                var informacion = document.getElementsByClassName('artists');
462
+                //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)
463
+                //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)
464
+                input = acento_replace(input.trim().toLowerCase());
465
+                inputarte = acento_replace(inputarte.trim().toLowerCase());
466
+                inputmuni = acento_replace(inputmuni.trim().toLowerCase());
467
+                //default case is where evey one of them has nothing or less than 3 characters (displays every artist until it passes that length)
431 468
                 if (input.length <= 3 && inputarte.length <= 3 && inputmuni.length <= 3){
432 469
                     for (var i = 0; all_artesanos.length; i++){
433
-                        x[i].style.display = "list-item";
470
+                        informacion[i].style.display = "list-item";
434 471
                     }
435 472
                 }
436 473
                 else{
@@ -438,7 +475,7 @@
438 475
                     cases = getcasenum(input,inputarte,inputmuni);
439 476
                     //take every one of them out first (dont display any)
440 477
                     for (var i = 0; i < all_artesanos.length; i++){
441
-                        x[i].style.display = "none";
478
+                        informacion[i].style.display = "none";
442 479
                     }
443 480
                     switch(cases){
444 481
                         //cases == 1 when only inputmuni has been writen on
@@ -477,6 +514,12 @@
477 514
         <template id="search.html">
478 515
           <ons-navigator swipeable animation="slide" id="SNavigator">
479 516
             <ons-page id="Buscar">
517
+                <!--
518
+                    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)
519
+                    The first search bar is to find by any information related to the artist
520
+                    The second searchbar is to find by the type of artwork they work on
521
+                    The third searchbar is to find by the municipio where the artists works or lives?
522
+                -->
480 523
                 <p style="text-align: center; margin-top: 10px;">
481 524
                     <ons-search-input placeholder="Busqueda en cualquiera" id = "searchbar"
482 525
                         onkeyup = "filter()"></ons-search-input>
@@ -490,16 +533,13 @@
490 533
                 </ons-list>
491 534
 
492 535
                 <script>
536
+                    //This is basically declaring what we refer to as informacion in the filter() function
537
+                    //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. 
493 538
                     for (i = 0; i < all_artesanos.length;i++){
494 539
                         var artesano = ons.createElement(`<ons-list-item class = "artists"
495 540
                         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>
496 541
                         <div>${all_artesanos[i].Nombre}</div>
497 542
                     </ons-list-item>`);
498
-                        // var artesano = ons.createElement(`
499
-                        //   <ons-list-item class = "artists">
500
-                        //     <div class="center" >${all_artesanos[i].Nombre}</div>
501
-                        //   </ons-list-item>`
502
-                        // );
503 543
                         document.getElementById('results').appendChild(artesano);
504 544
                     }
505 545
                 </script>
@@ -508,17 +548,20 @@
508 548
         </template>
509 549
 
510 550
         <!-- ---------------------------------------------------------------------------------------------------------------------------------------- -->
511
-
551
+        <!--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-->
512 552
         <template id= "artesano.html">
513 553
             <ons-page id = "artesano">
514 554
                 <ons-toolbar>
555
+                    <!-- Pretty self explanatory, its a button that goes back to the previous page -->
515 556
                     <div class = "left"> <ons-back-button> Atras </ons-back-button></div>
516 557
                     <div class = "center"></div>
517 558
                 </ons-toolbar>
518 559
                 <body>
560
+                    <!-- This is where we'll put all the information of that artsts -->
519 561
                     <ons-card id="all"></ons-card>
520 562
                 </body>
521 563
                 <script>
564
+                    //when it opens this page this function starts to run, it first recieves the information that was sent to "artesano.html"
522 565
                     ons.getScriptPage().onInit = function () {
523 566
                         this.querySelector('ons-toolbar div.center').textContent = this.data.title;
524 567
 
@@ -529,7 +572,12 @@
529 572
                             esp = this.data.esp,
530 573
                             redes = this.data.redes;
531 574
 
575
+                        //here the email is the string made from the start to where the '#' is.
532 576
                         email = em.slice(0, em.search("#"));
577
+
578
+                        //Here it's dividing all the especificaciones and writing them into the page (data) and then goes to the next line
579
+                        //if it has many especificaciones then it will replace all the ';' in it with ',' and writes it into the page
580
+                        //but if theres only one then you just write it into the page
533 581
                         if(esp.trim() != ""){
534 582
                             if(esp.includes(";", 0)){
535 583
                                 esp=esp.replace(/;/g,", ");
@@ -542,25 +590,30 @@
542 590
 
543 591
                         //console.log("Las redes son..."+this.data.redes);
544 592
 
593
+                        //Here it's writing their municipio into the page
545 594
                         if(mun.trim() != ""){
546 595
                             data+='Municipio: '+ mun +'<br>';
547 596
                         }
548 597
 
598
+                        //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
599
+                        //Whenever the variable is empty or if it has "NO TIENE" then it doesnt write anything
549 600
                         if(email.trim() != "" & email.toUpperCase().trim() != "NO TIENE"){
550 601
                             data+='Correo Electr\u00f3nico: <a style="color:blue" href="mailto: '+email+'"><u>'+email+'</u></a><br>';
551 602
                         }
552 603
 
553
-                        //Underlined <u></u>
554
-                        //Color blue <p style="color:blue"></p>
555
-
604
+                        //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
556 605
                         if(tel.trim() != "" ){
557 606
                             data+='Tel\u00e9fono: <a style="color:blue" href="tel: '+ tel +'"><u>'+ tel +'</u></a><br>';
558 607
                         }
559 608
 
560 609
                         console.log("Redes: "+redes);
561 610
 
611
+                        //Here it has to decide what to do depending on the links they give to their social media pages
612
+                        //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.
613
+                        //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
614
+                        //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.
615
+                        //If it's none of them then it will not display anything.
562 616
                         if(redes.includes("facebook")){
563
-
564 617
                             console.log(redes.substring(1,redes.length-2));
565 618
                             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>';
566 619
                         }
@@ -584,7 +637,7 @@
584 637
                             console.log("no tiene nada");
585 638
                         }
586 639
 
587
-
640
+                        //This is the part that allows eveything (data) to be displayed
588 641
                         document.getElementById("all").innerHTML = `${data}`;
589 642
 
590 643
                     }