Team:Cornell/javascripts/notebook

From 2013.igem.org

(Difference between revisions)
(Undo revision 20026 by N.Bhatt (talk))
Line 1: Line 1:
-
function loadHref() {
+
function loadHref() {
-
if(document.location != "https://2013.igem.org/Team:Cornell/notebook") {
+
alert("hello");
-
var href = document.location.href;
+
if(document.location != "https://2013.igem.org/Team:Cornell/notebook") {
-
var i = href.substring(href.indexOf("#")+1);
+
var href = document.location.href;
-
document.getElementById('week' + i + 'entry').style.display = 'block';
+
var i = href.substring(href.indexOf("#")+1);
-
 
+
document.getElementById('week' + i + 'entry').style.display = 'block';
if(i != 'A') {
if(i != 'A') {
-
document.getElementById('weekAentry').style.display = 'none';
+
document.getElementById('weekAentry').style.display = 'none';
-
document.getElementById('weekA').className = '';
+
document.getElementById('weekA').className = '';
-
}
+
-
document.getElementById('week' + i ).className = 'active';
+
}
}
-
var techb = document.getElementsByClassName('nb-onetech-i');
+
document.getElementById('week' + i ).className = 'active';
-
for(var i = techb.length-1; i >= 0; i--) {
+
}
-
techb[i].onclick = function() {
+
var techb = document.getElementsByClassName('nb-onetech-i');
-
showTech(this);
+
for(var i = techb.length-1; i >= 0; i--) {
-
}
+
techb[i].onclick = function() {
-
var teche = techb[i].parentNode.parentNode.children[1];
+
showTech(this);
-
if(teche.innerHTML == "" || teche.innerHTML.indexOf("{{{tech}}}") != -1){
+
-
techb[i].className = 'nb-onetech-disabled';
+
-
teche.className = 'nb-tech-disabled';
+
-
}
+
}
}
-
}
+
var teche = techb[i].parentNode.parentNode.children[1];
-
function filter(that) {
+
if(teche.innerHTML == "" || teche.innerHTML.indexOf("{{{tech}}}") != -1){
-
var ele = that.children[0];
+
techb[i].className = 'nb-onetech-disabled';
-
var show = ele.style.display == 'none';
+
teche.className = 'nb-tech-disabled';
-
ele.style.display= (show ? 'block' : 'none');
+
-
that.parentNode.children[1].className = (show ? 'nb-only' : 'nb-only-i');
+
-
all();
+
-
var list = document.getElementsByClassName('nb-' + ele.id);
+
-
for (var i = 0; i < list.length; i++) {
+
-
list[i].style.display = (show ? 'block' : 'none');
+
}
}
}
}
-
function onlyFilter(that) {
+
}
-
var filt = that.parentNode;
+
function filter(that) {
-
var row = filt.parentNode;
+
var ele = that.children[0];
 +
var show = ele.style.display == 'none';
 +
ele.style.display= (show ? 'block' : 'none');
 +
that.parentNode.children[1].className = (show ? 'nb-only' : 'nb-only-i');
 +
all();
 +
var list = document.getElementsByClassName('nb-' + ele.id);
 +
for (var i = 0; i < list.length; i++) {
 +
list[i].style.display = (show ? 'block' : 'none');
 +
}
 +
}
 +
function onlyFilter(that) {
 +
var filt = that.parentNode;
 +
var row = filt.parentNode;
 +
 +
for(var i=0; i<row.children.length; i++)
 +
{
 +
var hide = true;
 +
if(row.children[i] == filt) hide = false;
 +
row.children[i].children[0].children[0].style.display = (hide ? 'none' : 'block');
 +
row.children[i].children[1].className = (hide ? 'nb-only-i' : 'nb-only');
-
for(var i=0; i<row.children.length; i++)
+
var list = document.getElementsByClassName('nb-' + row.children[i].children[0].children[0].id);
-
{
+
for (var j = 0; j < list.length; j++) {
-
var hide = true;
+
list[j].style.display = (hide ? 'none' : 'block');
-
if(row.children[i] == filt) hide = false;
+
-
row.children[i].children[0].children[0].style.display = (hide ? 'none' : 'block');
+
-
row.children[i].children[1].className = (hide ? 'nb-only-i' : 'nb-only');
+
-
+
-
var list = document.getElementsByClassName('nb-' + row.children[i].children[0].children[0].id);
+
-
for (var j = 0; j < list.length; j++) {
+
-
list[j].style.display = (hide ? 'none' : 'block');
+
-
}
+
}
}
-
all();
 
}
}
-
function all() {
+
all();
-
var all = true;
+
}
-
var allbut = document.getElementById('nb-all');
+
function all() {
-
var row = document.getElementById('wet-only').parentNode.parentNode;
+
var all = true;
-
for(var i=0; i<row.children.length; i++)
+
var allbut = document.getElementById('nb-all');
-
{ if(row.children[i].children[1].className == 'nb-only-i') all = false; }
+
var row = document.getElementById('wet-only').parentNode.parentNode;
-
allbut.className = (all ? 'nb-all' : 'nb-all-i');
+
for(var i=0; i<row.children.length; i++)
 +
{ if(row.children[i].children[1].className == 'nb-only-i') all = false; }
 +
allbut.className = (all ? 'nb-all' : 'nb-all-i');
 +
}
 +
function showAll() {
 +
var all = true;
 +
var allbut = document.getElementById('nb-all');
 +
var row = document.getElementById('wet-only').parentNode.parentNode;
 +
for(var i=0; i<row.children.length; i++)
 +
{
 +
row.children[i].children[0].children[0].style.display = 'block';
 +
row.children[i].children[1].className = 'nb-only';
}
}
-
function showAll() {
+
allbut.className = (all ? 'nb-all' : 'nb-all-i');
-
var all = true;
+
var list = document.getElementsByClassName("entry");
-
var allbut = document.getElementById('nb-all');
+
for (var i = 0; i < list.length; i++) {
-
var row = document.getElementById('wet-only').parentNode.parentNode;
+
list[i].style.display = 'block';
-
for(var i=0; i<row.children.length; i++)
+
-
{
+
-
row.children[i].children[0].children[0].style.display = 'block';
+
-
row.children[i].children[1].className = 'nb-only';
+
-
}
+
-
allbut.className = (all ? 'nb-all' : 'nb-all-i');
+
-
var list = document.getElementsByClassName("entry");
+
-
for (var i = 0; i < list.length; i++) {
+
-
list[i].style.display = 'block';
+
-
}
+
}
}
-
function weekFilter(that) {
+
}
-
for(var i = -4; i<25; i++) {
+
function weekFilter(that) {
-
var c = (i > 0 ? "" + i : String.fromCharCode(69 + i));
+
for(var i = -4; i<25; i++) {
-
var ele = document.getElementById('week' + c);
+
var c = (i > 0 ? "" + i : String.fromCharCode(69 + i));
-
if(ele != null) ele.className = (that.id.substr(4) == c ? 'active' : '');
+
var ele = document.getElementById('week' + c);
-
}
+
if(ele != null) ele.className = (that.id.substr(4) == c ? 'active' : '');
-
var filt = that.id + "entry";
+
-
var all = document.getElementsByClassName('nb-week');
+
-
for(var i = 0; i<all.length; i++) {
+
-
if(all[i].tagName == 'DIV') all[i].style.display = 'none';
+
-
}
+
-
document.getElementById(filt).style.display = 'block';
+
}
}
-
function showAllTech() {
+
var filt = that.id + "entry";
-
var techbut = document.getElementById('nb-alltech');
+
var all = document.getElementsByClassName('nb-week');
-
var all = techbut.className == 'nb-all-i';
+
for(var i = 0; i<all.length; i++) {
-
techbut.className = (all ? 'nb-all' : 'nb-all-i');
+
if(all[i].tagName == 'DIV') all[i].style.display = 'none';
-
var row = document.getElementsByClassName('nb-tech');
+
}
-
for(var i=0; i<row.length; i++) {
+
document.getElementById(filt).style.display = 'block';
-
row[i].style.display = (all ? 'block' : 'none');
+
}
-
}
+
function showAllTech() {
-
var techs = document.getElementsByClassName(all ? 'nb-onetech-i' : 'nb-onetech');
+
var techbut = document.getElementById('nb-alltech');
-
for(var i= techs.length -1; i >= 0; i--) {
+
var all = techbut.className == 'nb-all-i';
-
techs[i].className = (all ? 'nb-onetech' : 'nb-onetech-i');
+
techbut.className = (all ? 'nb-all' : 'nb-all-i');
-
}
+
var row = document.getElementsByClassName('nb-tech');
 +
for(var i=0; i<row.length; i++) {
 +
row[i].style.display = (all ? 'block' : 'none');
}
}
-
function showTech(that) {
+
var techs = document.getElementsByClassName(all ? 'nb-onetech-i' : 'nb-onetech');
-
var show = that.className == 'nb-onetech-i';
+
for(var i= techs.length -1; i >= 0; i--) {
-
that.className = show ? 'nb-onetech' : 'nb-onetech-i';
+
techs[i].className = (all ? 'nb-onetech' : 'nb-onetech-i');
-
that.parentNode.parentNode.children[1].style.display = show ? 'block' : 'none';
+
}
}
 +
}
 +
function showTech(that) {
 +
var show = that.className == 'nb-onetech';
 +
that.className = show ? 'nb-onetech-i' : 'nb-onetech';
 +
that.parentNode.parentNode.children[1].style.display = show ? 'none' : 'block';
 +
}

Revision as of 23:29, 24 June 2013

function loadHref() { alert("hello"); if(document.location != "https://2013.igem.org/Team:Cornell/notebook") { var href = document.location.href; var i = href.substring(href.indexOf("#")+1); document.getElementById('week' + i + 'entry').style.display = 'block'; if(i != 'A') { document.getElementById('weekAentry').style.display = 'none'; document.getElementById('weekA').className = ; } document.getElementById('week' + i ).className = 'active'; } var techb = document.getElementsByClassName('nb-onetech-i'); for(var i = techb.length-1; i >= 0; i--) { techb[i].onclick = function() { showTech(this); } var teche = techb[i].parentNode.parentNode.children[1]; if(teche.innerHTML == "" || teche.innerHTML.indexOf("{{{tech}}}") != -1){ techb[i].className = 'nb-onetech-disabled'; teche.className = 'nb-tech-disabled'; } } } function filter(that) { var ele = that.children[0]; var show = ele.style.display == 'none'; ele.style.display= (show ? 'block' : 'none'); that.parentNode.children[1].className = (show ? 'nb-only' : 'nb-only-i'); all(); var list = document.getElementsByClassName('nb-' + ele.id); for (var i = 0; i < list.length; i++) { list[i].style.display = (show ? 'block' : 'none'); } } function onlyFilter(that) { var filt = that.parentNode; var row = filt.parentNode;

for(var i=0; i<row.children.length; i++) { var hide = true; if(row.children[i] == filt) hide = false; row.children[i].children[0].children[0].style.display = (hide ? 'none' : 'block'); row.children[i].children[1].className = (hide ? 'nb-only-i' : 'nb-only');

var list = document.getElementsByClassName('nb-' + row.children[i].children[0].children[0].id); for (var j = 0; j < list.length; j++) { list[j].style.display = (hide ? 'none' : 'block'); } } all(); } function all() { var all = true; var allbut = document.getElementById('nb-all'); var row = document.getElementById('wet-only').parentNode.parentNode; for(var i=0; i<row.children.length; i++) { if(row.children[i].children[1].className == 'nb-only-i') all = false; } allbut.className = (all ? 'nb-all' : 'nb-all-i'); } function showAll() { var all = true; var allbut = document.getElementById('nb-all'); var row = document.getElementById('wet-only').parentNode.parentNode; for(var i=0; i<row.children.length; i++) { row.children[i].children[0].children[0].style.display = 'block'; row.children[i].children[1].className = 'nb-only'; } allbut.className = (all ? 'nb-all' : 'nb-all-i'); var list = document.getElementsByClassName("entry"); for (var i = 0; i < list.length; i++) { list[i].style.display = 'block'; } } function weekFilter(that) { for(var i = -4; i<25; i++) { var c = (i > 0 ? "" + i : String.fromCharCode(69 + i)); var ele = document.getElementById('week' + c); if(ele != null) ele.className = (that.id.substr(4) == c ? 'active' : ); } var filt = that.id + "entry"; var all = document.getElementsByClassName('nb-week'); for(var i = 0; i<all.length; i++) { if(all[i].tagName == 'DIV') all[i].style.display = 'none'; } document.getElementById(filt).style.display = 'block'; } function showAllTech() { var techbut = document.getElementById('nb-alltech'); var all = techbut.className == 'nb-all-i'; techbut.className = (all ? 'nb-all' : 'nb-all-i'); var row = document.getElementsByClassName('nb-tech'); for(var i=0; i<row.length; i++) { row[i].style.display = (all ? 'block' : 'none'); } var techs = document.getElementsByClassName(all ? 'nb-onetech-i' : 'nb-onetech'); for(var i= techs.length -1; i >= 0; i--) { techs[i].className = (all ? 'nb-onetech' : 'nb-onetech-i'); } } function showTech(that) { var show = that.className == 'nb-onetech'; that.className = show ? 'nb-onetech-i' : 'nb-onetech'; that.parentNode.parentNode.children[1].style.display = show ? 'none' : 'block'; }