Difference between revisions of "Template:Virginia/scripts/seqsJS"

Line 40: Line 40:
  
 
fixSeqScrollLauncher = function(){
 
fixSeqScrollLauncher = function(){
   holder = document.getElementById("seqVizViewer");
+
   if(!mobileCheck()){
  holder.addEventListener("mouseover",fixSeqScroll);
+
    holder = document.getElementById("seqVizViewer");
 +
    holder.addEventListener("mouseover",fixSeqScroll);
 +
  }
 +
 
 
}
 
}
 
startupFunctions.push(fixSeqScrollLauncher)
 
startupFunctions.push(fixSeqScrollLauncher)

Revision as of 10:40, 23 October 2020

function disableScroll() {

 html=document.getElementsByTagName('html')[0];
 body=document.getElementsByTagName('body')[0];
 html.style.height = "200%";
 body.style.overflow = "hidden";
 body.style.height = "200%";  
 html.style.padding = "0px 10px 0px 0px"

}

function enableScroll() {

 html=document.getElementsByTagName('html')[0];
 body=document.getElementsByTagName('body')[0];
 html.style.height = "auto";
 body.style.overflow = "auto";
 body.style.height = "auto";
 html.style.padding = "0px"

}

fixSeqScroll = function(){

 //Remove Event Listener
 holder.removeEventListener("mouseover",fixSeqScroll);
 //Grab the plasmid viewer
 plasmidViewer = document.getElementsByClassName('la-vz-viewer-event-router')[0];
 //Disable page scroll on mouse over
 plasmidViewer.addEventListener("mouseover",disableScroll)
 //Re-Enable scroll when mouse leaves 
 plasmidViewer.addEventListener("mouseout",enableScroll)

}

loadSeqViz = function(){

 seqViewer = document.getElementById('seqVizViewer');
 var viewer = seqviz
   .Viewer(seqViewer, {
     file: roligoFlipper,
     style: {width: "100%", height: "100%"},
     copyEvent: (event => event.key === "c" && (event.metaKey || event.ctrlKey))
   });
 viewer.render();

}

fixSeqScrollLauncher = function(){

 if(!mobileCheck()){
   holder = document.getElementById("seqVizViewer");
   holder.addEventListener("mouseover",fixSeqScroll);
 }

} startupFunctions.push(fixSeqScrollLauncher)

//Make first function to run on page load startupFunctions.unshift(loadSeqViz)