Template:Vilnius-Lithuania/InnerPageJS

var team = {

   "Auksė" : { normal: "T--Vilnius-Lithuania--Auks%C4%97.jpg", sleeping: "T--Vilnius-Lithuania--Auks%C4%97-sleeping.jpg"},
   "Dovydas" : { normal: "T--Vilnius-Lithuania--Dovydas.jpg", sleeping: "T--Vilnius-Lithuania--Dovydas-sleeping.jpg"},
   "Gabrielius" : { normal: "T--Vilnius-Lithuania--Gabrielius.jpg", sleeping: "T--Vilnius-Lithuania--Gabrielius-sleeping.jpg"},
   "Hana" : { normal: "T--Vilnius-Lithuania--Hana.jpg", sleeping: "T--Vilnius-Lithuania--Hana.jpg"},
   "Ieva" : { normal: "T--Vilnius-Lithuania--Ieva.jpg", sleeping: "T--Vilnius-Lithuania--Ieva-sleeping.jpg"},
   "Justas" : { normal: "T--Vilnius-Lithuania--Justas.jpg", sleeping: "https://static.igem.org/mediawiki/2018/1/1e/T--Vilnius-Lithuania--Justas-sleeping.mp4"},
   "Kornelija" : { normal: "T--Vilnius-Lithuania--Kornelija.jpg", sleeping: "T--Vilnius-Lithuania--Kornelija-sleeping.jpg"},
   "Kasparas" : { normal: "T--Vilnius-Lithuania--Kasparas.jpg", sleeping: "T--Vilnius-Lithuania--Kasparas.jpg"}, 
   "Kristina" : { normal: "T--Vilnius-Lithuania--Kristina.jpg", sleeping: "T--Vilnius-Lithuania--Kristina-sleeping.jpg"}, 
   "Lina" : { normal: "T--Vilnius-Lithuania--Lina.jpg", sleeping: "T--Vilnius-Lithuania--Lina-sleeping.jpg"}, 
   "Lukas" : { normal: "T--Vilnius-Lithuania--Lukas.jpg", sleeping: "T--Vilnius-Lithuania--Lukas-sleeping.jpg"}, 
   "Miglė" : { normal: "T--Vilnius-Lithuania--Migl%C4%97.jpg", sleeping: "T--Vilnius-Lithuania--Migl%C4%97-sleeping.jpg"}, 
   "Monika" : { normal: "T--Vilnius-Lithuania--Monika.jpg", sleeping: "T--Vilnius-Lithuania--Monika-sleeping.jpg"},
   "Simas" : { normal: "T--Vilnius-Lithuania--Simas.jpg", sleeping: "T--Vilnius-Lithuania--Simas-sleeping.jpg"},  
   "Tomas" : { normal: "T--Vilnius-Lithuania--Tomas.jpg", sleeping: "T--Vilnius-Lithuania--Tomas-sleeping.jpg"}, 
   "Ugnė" : { normal: "T--Vilnius-Lithuania--Ugn%C4%97.jpg", sleeping: "T--Vilnius-Lithuania--Ugn%C4%97-sleeping.jpg"}, 
   "Valentas" : { normal: "T--Vilnius-Lithuania--Integrated-Valentas.jpg", sleeping: "T--Vilnius-Lithuania--Valentas-sleeping.jpg"},
   "LukasŠerelis" : { normal: "T--Vilnius-Lithuania--Lserelis.jpg", sleeping: "T--Vilnius-Lithuania--Lserelis.jpg"},  

}


/* Page navigation state */

var directoryTree = [{

   id: 1,
   name: "project",
   content: [{
       id: 1,
       name: "Description",
       display: "Description",
       active: false
   },
   {
       id: 2,
       name: "Design",
       display: "Design",
       active: false,
       content: [
           {
               id: 1,
               name: "Liposomes",
               title: "Our Tiny Bubbles",
               selector: "Liposomes",
               display: "Liposomes",
               active: false,
               abstract: "Liposomes are at the heart of SynDrop. Unlike cells, these adjustable synthetic containers can be constructed only from well-defined parts and elements that are necessary for a particular experiment, leaving no place for background noise, cross-talk and inconsistencies. Encapsulating transcriptional and translational systems within the liposomes transforms them into effective bioreactors with applications only limited by our own imagination. With the help of microfluidics, extensive modeling and self-made custom software we are able to produce cell-sized, monodisperse and biocompatible liposomes with nearly maximal encapsulation efficiency. With these qualities they are perfectly suitable for membrane protein synthesis, folding and integration into the membrane.",
               inner: true
           },
           {
               id: 2,
               name: "Ribosome modifications",
               title: "Mimicking The Nature",
               selector: "Ribosome_modifications",
               display: "Ribosome modifications",
               active: false,
               abstract: "One of the main potential problems of our system was that if there happened to be no binding to a translocon, membrane protein synthesis could occur anywhere within the liposome matrix - this would most likely lead to irreversible MP aggregation. To avoid this we required a method to localize ribosomes near the membrane, to increase the chance of the hydrophobic peptides interacting with the membrane as well as our MP insertion machinery.",
               inner: true
           },
           {
               id: 3,
               name: "BAM complex",
               title: "Applying The Nature",
               selector: "BAM_complex",
               display: "BAM complex",
               active: false,
               abstract: "In order to improve the method of liposome display, a novel mechanism to facilitate protein insertion into membrane was needed. A logical step was to search for a membrane protein (MP) integration mechanism that would also feature self assembly. Out of all the options, the β-barrel assembly machinery (BAM) complex was chosen as a perfect candidate, as it could be reconstituted from inside of a liposome and facilitate MP insertion with far fewer components than other alternatives.",
               inner: true
           },
           {
               id: 4,
               name: "RNA Thermoswitches",
               title: "Measuring The Temperature",
               selector: "RNA_Thermoswitches",
               display: "RNA Thermoswitches",
               active: false,
               abstract: "Cell-free, synthetic biology systems open new horizons in engineering biomolecular systems which feature complex, cell-like behaviors in the absence of living entities. Having no superior genetic control, user-controllable mechanisms to regulate gene expression are necessary to successfully operate these systems. We have created a small collection of synthetic RNA thermometers that enable temperature-dependent translation of membrane proteins, work well in cells and display great potential to be transferred to any in vitro protein synthesis system.",
               inner: true
           },
           {
               id: 5,
               name: "Mistic fusion protein",
               title: "One Mysterious Protein",
               selector: "Mistic_fusion_protein",
               display: "Mistic fusion protein",
               active: false,
               abstract: "Self-inserting α-helical protein Mistic (MstX) is unique due to its uncommonly hydrophilic surface. Recently it has found a novel application as a fusion tag supporting the recombinant production and bilayer insertion of other membrane proteins. When fused to the N-terminus of integral membrane proteins, MstX enables the cargo proteins to fold into their native conformations in the membrane, thus yielding a high-level expression.",
               inner: true
           },
           {
               id: 6,
               name: "Surface display system",
               title: "Showing The Inside",
               selector: "Surface_display_system",
               display: "Surface display system",
               active: false,
               abstract: "Since liposomes can maintain the genotype-phenotype link, they could potentially be used as tool to perform molecular evolution. To elaborate this perspective, we constructed a bunch of novel and effective membrane protein fusions that could be used to display various epitopes to the surface of liposomes.",
               inner: true
           }
       ]
   },
   {
       id: 3,
       name: "Model",
       display: "Model",
       active: false,
       content: [
           {
               id: 1,
               name: "WaitDrop",
               title: "Waiting for BAM",
               selector: "Edinburgh_model",
               display: "WaitDrop",
               active: false,
               abstract: "Mathematical modeling is an approach to understand the processes that alter behaviors of different systems. Synthetic biology is inescapably involved in modeling as it requires deeper knowledge of how distinct processes form one indispensable system in order to create one. With this knowledge, one can manipulate parameters and design unique system with desired features. During creation of our system we hypothesized that adding target membrane protein messenger RNA (mRNA) would ensure that this protein folds and inserts into liposome membrane correctly as well as enhances other membrane protein expression. Mathematical model for necessity of mRNA addition to IVTT system was generated to compare results primarily across different starting volumes of target protein mRNA. It was done in order to quantify the effectiveness of an initial addition of mRNA ensuring fast expression of target membrane protein for creating more efficient cell-free system for membrane protein research.",
               inner: true
           },
           {
               id: 2,
               name: "eXplaY",
               title: "eXplaY Surface",
               selector: "Groeningen_model",
               display: "eXplaY",
               abstract: "One of our primary objectives while developing SynDrop was to design a liposome-surface display system, that allowed us to display small molecules or even full globular proteins on the surface of liposomes. In theory, the system was capable of coupling genotype to phenotype of particular proteins. One had thought that to attain this goal, simple sequence fusion to a membrane protein gene was enough to make the display system work. In reality though, none of the membrane protein surface display systems work without the help of additional molecular machinery. To better understand the nature of display systems we sought to model one. The iGEM Groningen team played a mentoring role in developing and analyzing a molecular dynamics model which was called eXplaY. The model proved that independent globular protein flipping did not occur through the membrane and evaluated camelid antibodies’ affinity to its ligand in the fused state.",
               active: false,
               inner: true
           },
           {
               id: 3,
               name: "SynFlow",
               title: "Synthetic Flow",
               selector: "COMSOL_model",
               display: "SynFlow",
               abstract: "From the beginning of our project, liposome synthesis was an essential part that kept all the project intact. However, mastering and optimizing this process proved to be from a trivial task, as every experiment cost us valuable materials and loads of time just to adjust a stable productive flow. Moreover, we needed to obtain droplets of predictable and controllable size in order to characterize them precisely and use them in later experiments. For these reasons COMSOL Multiphysics software was utilized to develop a model for liposome size and formation determination. By using phase-field based modeling for multiphase flows, we have gained knowledge on how various parameters of our system impact the process and outcome of the experiment and thus managed to implement this information into our project.",
               active: false,
               inner: true
           },
           {
               id: 4,
               name: "ProSwitch",
               title: "Predicting The Temperature",
               selector: "Thermo_Switches_model",
               display: "ProSwitch",
               abstract: "Together with colleagues from Vienna University we have compiled a simple in silico translation-initiation potential model to quantify the likelihood of translation of a mRNA bearing thermoswitch sequence at varying temperatures. The model resulted in a great number of de novo synthetic thermoswitches and provided theoretical evidence of their behaviour thus allowing us to choose and apply only the best-performing RNA thermometers for the SynDrop system.",
               active: false,
               inner: true
           },
       ]
   },
   {
       id: 4,
       name: "Demonstrate",
       display: "Proof",
       active: false
   },
   {
       id: 5,
       name: "InterLab",
       display: "InterLab",
       active: false
   },
   {
       id: 6,
       name: "Safety",
       display: "Safety",
       active: false
   },
   {
       id: 7,
       name: "Software",
       display: "Software",
       active: false
   }
   ],
   active: false

}, {

   id: 2,
   name: "parts",
   content: [{
       id: 1,
       name: "Overview",
       display: "Overview",
       active: false
   },
   {
       id: 2,
       name: "Basic",
       display: "Basic Parts",
       active: false
   },
   {
       id: 3,
       name: "Composite",
       display: "Composite Parts",
       active: false
   },
   {
       id: 4,
       name: "Collection",
       display: "Part Collection",
       active: false
   }
   ],
   active: false

}, {

   id: 3,
   name: "notebook",
   content: [{
       id: 1,
       name: "LabBook",
       display: "Lab Book",
       active: false
   },
   {
       id: 2,
       name: "Protocols",
       display: "Protocols",
       active: false
   },
   {
       id: 3,
       name: "Medals",
       display: "Medals",
       active: false
   }
   ],
   active: false

}, {

   id: 4,
   name: "hp",
   content: [{
       id: 1,
       name: "Human_Practices",
       display: "Overview",
       active: false,
       content: [
           {
               id: 1,
               name: "Integrated",
               display: "Integrated",
               selector: "Integrated",
               abstract: "Analyzing means to reduce the workload and time consumption while working on our project and wishing to extend our collaboration with current Lithuanian IT leaders, we organized an international life sciences BioHackathon. The successful event resulted in many wet-lab-applicable projects and most importantly, it provided the base for our software tool LipoVision. This software is currently being tested in our University’s research centre, Microfluidics lab, where LipoVision promises to become a daily helper in all liposome synthesis-related experiments.",
               active: false
           },
           {
               id: 2,
               name: "Silver",
               display: "Silver",
               selector: "Silver",
               abstract: "Encouraged by the rapid Life Sciences development in Lithuania and our team’s previous achievements, we decided that it was meaningful to share our experience with the younger generation. Visiting schools, inviting pupils to visit Vilnius University Life Sciences Center and introducing SynDrop to them helped us not only to reveal but also clarify our own attitude towards synthetic biology. The discussion that we have organised during the DNA Day’s celebration has become a great inspiration to search for a creative approach to implement our project’s idea and to make it more public-friendly.",
               active: false
           }            
       ]
   },
   {
       id: 2,
       name: "Public_Engagement",
       display: "Education & PE",
       active: false
   },
   {
       id: 3,
       name: "Collaborations",
       display: "Collaborations",
       active: false
   }
   ],
   active: false

}, {

   id: 5,
   name: "team",
   content: [{
       id: 1,
       name: "Members",
       display: "Members",
       active: false
   },
   {
       id: 2,
       name: "Attributions",
       display: "Attributions",
       active: false
   },
   {
       id: 3,
       name: "Sponsors",
       display: "Sponsors",
       active: false
   }
   ],
   active: false

} ]

/* Get page name part and display active elements accordingly */ function getPageName(url) {

   var index = url.lastIndexOf("/") + 1;
   var filenameWithExtension = url.substr(index);
   var filename = filenameWithExtension.split(".")[0];
   return filename;

}

$(document).ready(function () {

   /* find active top navigation according page */
   directoryTree.forEach(function (element) {
       element.content.forEach(function (innerElement) {
           if (innerElement.name.toLowerCase().indexOf(getPageName(window.location.href).toLowerCase()) != -1) {
               var concatenatedString = "#" + element.name + "-list-item";
               $(concatenatedString).find(".image-container").addClass("is-active")
               element.active = true
               innerElement.active = true
           }
       })
   })
   /* display all third level navigaiton items for each 2nd level nav item */ 
   directoryTree.forEach(function (element) {
       if (element.active) {
           $('.pagination').html("")
           element.content.forEach(function (inner) {
$('.pagination').append('
' +
                  ' <a class="pagination-anchor"> ' +
'
' +
                       ''+ inner.display + '' +
                   '</a>' +
'
')
               if (inner.content && inner.active) {
                   inner.content.forEach(function(innerMost) {
$('.pagination').append('
' +
                       '<a class="pagination-anchor">' +
'
' +
                           ''+ innerMost.display + '' + 
                       '</a> '+ 
'
')
                   })
               }
           })
           element.content.forEach(function (inner) {
               if (inner.active) {
                   $(".pagination-item-wrapper:nth-child("+inner.id+")").find(".pagination-item").addClass("active-item")
               }
           })
       }
   })
   $(".pagination-item-wrapper").click(function (evt) {
       if (!$(this).hasClass("sub-page")) {
       var e = $(this).index()
       directoryTree.forEach(function (element) {
           if (element.active) {
               element.content.forEach(function(inner) {
                   if (evt.currentTarget.innerText.indexOf(inner.display) !== -1) {
                      window.location.replace(inner.name)
                   }
               })
           }
       })
   } else {
       subNavEnter(this)
   }
   })
   function subNavEnter(elem) {
       $(".pagination-item").removeClass("active-item")
       $(elem).find(".pagination-item").addClass("active-item")
       directoryTree.forEach(function(element) {
           if (element.active) {
               element.content.forEach(function(inner) {
                   if (inner.active) {
                       inner.content.forEach(function (innerMost) {
                           innerMost.active = false;
                           if(innerMost.name.indexOf($(elem).find(".pagination-text").text()) != -1) {
                              $(".text-wall-area-box-heading").fadeOut()
                              $(".text-content").fadeOut()
                              $(".text-wall-area-box-heading").html(innerMost.title)
                              $(".text-content").html(innerMost.abstract)                              
                              $(".text-wall-area-box-heading").fadeIn()
                              $(".text-content").fadeIn()
                              innerMost.active = true;
                              $(".read-more-button").unbind()
                              $(".read-more-button").click(function() {
                                   $(".modal").css("visibility","visible")
                                   $(".modal").addClass("active")

console.log(innerMost.selector)

                                   $('.modal').animate({
                                       scrollTop: $("#" + innerMost.selector).offset().top
                                   }, 2000);
                              })
                           }
                       })
                   }
               })
           }
       })
   }
   $(".carrot-anchor").click(function (e) {
       e.preventDefault()
       directoryTree.forEach(function (element) {
           if (element.active) {
               element.content.forEach(function (inner) {
                   if (inner.active && inner.id != element.content.length && !inner.content) {
                       window.location.replace(element.content[inner.id].name)
                   } else {
                       if (inner.active && inner.content) {
                           const as = inner.content.filter(function(x) { return x.active == true})
                           if (as.length == 0) {
                           $(".pagination").find(".sub-page").each(function(element) {
                               if ($(this).find(".pagination-text").text() == inner.content[0].display) {
                                  $(this).find(".pagination-anchor").click()
                                  inner.content[0].active = true
                               }
                           })
                           } else {
                               inner.content.forEach(function(element) {
                                   element.active = false
                               })
                               const values = inner.content.map(function(x){ return x.id})
                               if (as[0].id != Math.max.apply(null,values)) {
                               $(".sub-page").each(function(element) {
                                   if (element == as[0].id) {
                                       $(this).click()
                                   }
                               })
                           } else {
                               if (inner.active && inner.id != element.content.length) {
                                   window.location.replace(element.content[inner.id].name)
                               } 
                           }
                           }
                       }
                   }
               })
           }
       })
   })
   $(".carrot-back").click(function (e) {
       e.preventDefault()
       directoryTree.forEach(function (element) {
           if (element.active) {
               var activeChild = element.content.filter(function(x){return x.active == true})
                   if (activeChild[0].id != 1) {
                       window.location.replace(element.content[activeChild[0].id-2].name)
                   }
           }
       });
   });


   $(".read-more-button").click(function () {
       var e = $('.modal');
       e.css("visibility", "visible")
       e.addClass("active")
   })
   $(".modal-close").click(function () {
       var e = $(this)
       e.parent().removeClass("active")
       e.parent().css("visibility", "hidden")
       $('.modal').animate({
           scrollTop: 0
       }, 100)
   })
   $(".img-expand").click(function() {
       $(this).parent().find(".item-modal").fadeIn().css("display", "flex")
   })
   $(".close-item-modal").click(function() {
       $(this).parent().fadeOut()
   })
   $(".back").show()
   $(".team-profile > img").hover(function(){
       $(this).attr("src", team[$(this).parent().attr("id")].sleeping)
   })
   $(".team-profile > img").mouseleave(function(){
       $(this).attr("src", team[$(this).parent().attr("id")].normal)
   })

})