Commit 3fe53c01 authored by r03ert0's avatar r03ert0

remove jquery from index-page.js

parent 84404556
...@@ -2,14 +2,13 @@ ...@@ -2,14 +2,13 @@
import '../style/style.css'; import '../style/style.css';
import '../style/index-style.css'; import '../style/index-style.css';
import '../style/ui.css'; import '../style/ui.css';
import $ from 'jquery';
/** /**
* @function goToURL * @function goToURL
* @returns {void} * @returns {void}
*/ */
function goToURL() { function goToURL() {
var url=$("#url").val(); const url = document.getElementById("url").value;
location.href = "/mri?url="+url; location.href = "/mri?url="+url;
} }
...@@ -47,16 +46,18 @@ testWebSockets() ...@@ -47,16 +46,18 @@ testWebSockets()
alert(m); alert(m);
}); });
// intro.js test for(const slide of document.getElementsByClassName("slide")) {
//startIntro(); slide.style.height = window.innerHeight + 'px';
}
$(".slide").height(window.innerHeight); window.addEventListener('resize', () => {
$(window).on('resize', function() { for(const slide of document.getElementsByClassName("slide")) {
$(".slide").height(window.innerHeight); slide.style.height = window.innerHeight + 'px';
}
}); });
// go to url button // go to url button
$("#go").click(goToURL); document.getElementById("go").addEventListener('click', goToURL);
// video settings // video settings
var vid = document.getElementById("bgBrains"); var vid = document.getElementById("bgBrains");
...@@ -65,73 +66,81 @@ vid.onplaying = function() { ...@@ -65,73 +66,81 @@ vid.onplaying = function() {
}; };
// List of brains // List of brains
$("#list").change(function() { document.getElementById("list").addEventListener("change", () => {
$("#url").val($("#list").val()); document.getElementById("url").value = document.getElementById("list").value;
});
document.querySelector("h2").style.marginLeft = 0;
document.querySelector("h2").style.opacity = 1;
// Add URL loading
document.getElementById("url").addEventListener("keyup", (e) => {
if (e.keyCode === 13) {
goToURL(e);
}
}); });
// Connect addProject button
document.getElementById("addProject").addEventListener("click", () => {
location.href = "/project/new";
});
// multiple div as slides
var menuShowing = true; var menuShowing = true;
$(window).on('scroll', function() { window.addEventListener("scroll", () => {
var y = window.pageYOffset; const y = window.pageYOffset;
if(y>100 && menuShowing) { if(y>100 && menuShowing) {
$("#menu").css({top:-32, opacity:0}); document.getElementById("menu").style.top = -32;
document.getElementById("menu").style.opacity = 0;
menuShowing = false; menuShowing = false;
$("#footer").show(); document.getElementById("footer").style.display = "";
} }
if(y<100 && !menuShowing) { if(y<100 && !menuShowing) {
$("#menu").css({top:0, opacity:1}); document.getElementById("menu").style.top = 0;
document.getElementById("menu").style.opacity = 1;
menuShowing = true; menuShowing = true;
} }
}); });
$("h2").css({marginLeft:0, opacity:1}); // intro.js test
//startIntro();
var version=1; // var version=1;
var brainsToTry=[ // var brainsToTry=[
"https://zenodo.org/record/44855/files/MRI-n4.nii.gz", // "https://zenodo.org/record/44855/files/MRI-n4.nii.gz",
"http://files.figshare.com/2284784/MRI_n4.nii.gz", // "http://files.figshare.com/2284784/MRI_n4.nii.gz",
"https://dl.dropbox.com/s/cny5b3so267bv94/p32-f18-uchar.nii.gz", // "https://dl.dropbox.com/s/cny5b3so267bv94/p32-f18-uchar.nii.gz",
"https://fcp-indi.s3.amazonaws.com/data/Projects/ABIDE_Initiative/RawData/NYU/0050952/session_1/anat_1/mprage.nii.gz" // "https://fcp-indi.s3.amazonaws.com/data/Projects/ABIDE_Initiative/RawData/NYU/0050952/session_1/anat_1/mprage.nii.gz"
]; // ];
// Present the history in localStorage if it exists. // Present the history in localStorage if it exists.
let i, stored, str; // let i, stored, str;
if(localStorage.AtlasMaker) { // if(localStorage.AtlasMaker) {
stored=JSON.parse(localStorage.AtlasMaker); // stored=JSON.parse(localStorage.AtlasMaker);
if(stored.version && stored.version === version) { // if(stored.version && stored.version === version) {
str = "<br/><p><b>Recently visited</b><br/>"; // str = "<br/><p><b>Recently visited</b><br/>";
for(i=stored.history.length-1; i>=Math.max(0, stored.history.length-10); i--) { // for(i=stored.history.length-1; i>=Math.max(0, stored.history.length-10); i--) {
str += "<a href='"+location+"mri?url="+stored.history[i].url+"'>"+stored.history[i].url+"</a><br />"; // str += "<a href='"+location+"mri?url="+stored.history[i].url+"'>"+stored.history[i].url+"</a><br />";
// /**
/** // * @todo Add image thumbnails
* @todo Add image thumbnails // */
*/ // if(stored.history[i].img) {
if(stored.history[i].img) { // document.getElementById("intro").innerHTML += `<img src="${stored.history[i].img}"/>`;
$("#intro").append('<img src="'+stored.history[i].img+'"/>'); // // $("#intro").append('<img src="'+stored.history[i].img+'"/>');
} // }
} // }
str += "</p>"; // str += "</p>";
$("#intro").append(str); // document.getElementById("intro").innerHTML += str;
} else { // // $("#intro").append(str);
localStorage.clear(); // } else {
} // localStorage.clear();
} // }
if(typeof localStorage.AtlasMaker === 'undefined' || stored.history.length<5) { // }
str="<br/><p><b>Some brains to try</b><br/>"; // if(typeof localStorage.AtlasMaker === 'undefined' || stored.history.length<5) {
for(i=0; i<brainsToTry.length; i++) { // str="<br/><p><b>Some brains to try</b><br/>";
str+="<a href='"+location+"mri?url="+brainsToTry[i]+"'>"+brainsToTry[i]+"</a><br />"; // for(i=0; i<brainsToTry.length; i++) {
} // str+="<a href='"+location+"mri?url="+brainsToTry[i]+"'>"+brainsToTry[i]+"</a><br />";
str+="</p>"; // }
$("#intro").append(str); // str+="</p>";
} // document.getElementById("intro").innerHTML += str;
// // $("#intro").append(str);
// Add URL loading // }
$("#url").keyup(function(e) {
//console.log(e,e.target);
if (e.keyCode === 13) {
goToURL(e);
}
});
// Connect addProject button
$("#addProject").click(function() { location.href = "/project/new"; });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment