CollinMarino (Talk | contribs) |
CollinMarino (Talk | contribs) |
||
Line 1: | Line 1: | ||
+ | var currentSeq; | ||
+ | |||
function disableScroll() { | function disableScroll() { | ||
html=document.getElementsByTagName('html')[0]; | html=document.getElementsByTagName('html')[0]; | ||
Line 28: | Line 30: | ||
} | } | ||
− | + | //seqType takes values "linear", "circular", "both", or "both_flip" | |
+ | seqChange = function(seq){ | ||
+ | currentSeq = seq; | ||
+ | document.getElementById("seqTitle").innerHTML = seq.name; | ||
seqViewer = document.getElementById('seqVizViewer'); | seqViewer = document.getElementById('seqVizViewer'); | ||
− | + | options = { | |
− | + | file: seq.data, | |
− | + | style: {width: "100%", height: "100%"}, | |
− | + | copyEvent: (event => event.key === "c" && (event.metaKey || event.ctrlKey)), | |
− | + | viewer: seq.seqType | |
− | }); | + | } |
+ | var viewer = seqviz.Viewer(seqViewer, options); | ||
viewer.render(); | viewer.render(); | ||
} | } | ||
− | + | loadSeqViz = function(){ | |
+ | seqChange(sequences.roligoFlipper) | ||
+ | } | ||
+ | |||
+ | eventListeners = function(){ | ||
if(!mobileCheck()){ | if(!mobileCheck()){ | ||
holder = document.getElementById("seqVizViewer"); | holder = document.getElementById("seqVizViewer"); | ||
holder.addEventListener("mouseover",fixSeqScroll); | holder.addEventListener("mouseover",fixSeqScroll); | ||
} | } | ||
− | + | document.getElementsByClassName('download')[0].addEventListener("click",function(){ | |
+ | var blob = new Blob([currentSeq.data],{ type: "text/plain;charset=utf-8" }); | ||
+ | saveAs(blob, currentSeq.name+".gb"); | ||
+ | }) | ||
} | } | ||
− | startupFunctions.push( | + | startupFunctions.push(eventListeners) |
//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 09:17, 24 October 2020
var currentSeq;
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)
}
//seqType takes values "linear", "circular", "both", or "both_flip" seqChange = function(seq){
currentSeq = seq; document.getElementById("seqTitle").innerHTML = seq.name; seqViewer = document.getElementById('seqVizViewer'); options = { file: seq.data, style: {width: "100%", height: "100%"}, copyEvent: (event => event.key === "c" && (event.metaKey || event.ctrlKey)), viewer: seq.seqType } var viewer = seqviz.Viewer(seqViewer, options); viewer.render();
}
loadSeqViz = function(){
seqChange(sequences.roligoFlipper)
}
eventListeners = function(){
if(!mobileCheck()){ holder = document.getElementById("seqVizViewer"); holder.addEventListener("mouseover",fixSeqScroll); } document.getElementsByClassName('download')[0].addEventListener("click",function(){ var blob = new Blob([currentSeq.data],{ type: "text/plain;charset=utf-8" }); saveAs(blob, currentSeq.name+".gb"); })
} startupFunctions.push(eventListeners)
//Make first function to run on page load startupFunctions.unshift(loadSeqViz)