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

(Created page with "loadSeqViz = function(){ seqViewer = document.getElementById('seqVizViewer'); var viewer = seqviz .Viewer(seqViewer, { file: roligoFlipper, style: {width:...")
 
Line 1: Line 1:
 +
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(){
 
loadSeqViz = function(){
 
   seqViewer = document.getElementById('seqVizViewer');
 
   seqViewer = document.getElementById('seqVizViewer');
Line 8: Line 37:
 
     });
 
     });
 
   viewer.render();
 
   viewer.render();
  console.log(viewer);
 
 
}
 
}
 +
 +
fixSeqScrollLauncher = function(){
 +
  holder = document.getElementById("seqVizViewer");
 +
  holder.addEventListener("mouseover",fixSeqScroll);
 +
}
 +
startupFunctions.push(fixSeqScrollLauncher)
  
 
//Make first function to run on page load
 
//Make first function to run on page load
 
startupFunctions.unshift(loadSeqViz)
 
startupFunctions.unshift(loadSeqViz)

Revision as of 10:28, 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(){

 holder = document.getElementById("seqVizViewer");
 holder.addEventListener("mouseover",fixSeqScroll);

} startupFunctions.push(fixSeqScrollLauncher)

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