Difference between revisions of "Team:UNSW Australia/js/Notebook"

(Created page with "// Initialise variables for lab categories var all = 0; var cloning = 0; var protein = 0; var assays = 0; var plants = 0; var parts = 0; var interlab = 0; $(document).ready(f...")
 
(Blanked the page)
 
Line 1: Line 1:
// Initialise variables for lab categories
 
var all = 0;
 
var cloning = 0;
 
var protein = 0;
 
var assays = 0;
 
var plants = 0;
 
var parts = 0;
 
var interlab = 0;
 
  
$(document).ready(function() {
 
$(".week-summary").hide();
 
$(".week-content").hide();
 
displayAllCats();
 
});
 
 
var isEven = function(number) {
 
return (number % 2 === 0) ? true : false;
 
};
 
 
 
// Display all lab categories
 
function displayAllCats() {
 
cloning = 1;
 
protein = 1;
 
assays = 1;
 
plants = 1;
 
parts = 1;
 
interlab = 1;
 
chooseCats();
 
}
 
 
function resetCats() {
 
cloning = 0;
 
protein = 0;
 
assays = 0;
 
plants = 0;
 
parts = 0;
 
interlab = 0;
 
}
 
 
function allSelected() {
 
if (cloning === 1 && protein === 1 && assays === 1 &&
 
plants === 1 && parts === 1 && interlab === 1) {
 
return 1;
 
} else {
 
return 0;
 
}
 
}
 
 
function noneSelected() {
 
if (isEven(cloning) === true && isEven(protein) === true && isEven(assays) === true &&
 
isEven(plants) === true && isEven(parts) === true && isEven(interlab) === true) {
 
return 1;
 
} else {
 
return 0;
 
}
 
}
 
 
function oneOdd() {
 
if (isEven(cloning) === false || isEven(protein) === false || isEven(assays) === false ||
 
isEven(plants) === false || isEven(parts) === false || isEven(interlab) === false) {
 
return 1;
 
} else {
 
return 0;
 
}
 
}
 
 
function displayCloning() {
 
if (allSelected() === 1) {
 
resetCats();
 
} else if (oneOdd() === 1 && isEven(cloning) === true) {
 
resetCats();
 
}
 
cloning++;
 
chooseCats();
 
}
 
 
function displayProtein() {
 
if (allSelected() === 1) {
 
resetCats();
 
} else if (oneOdd() === 1 && isEven(protein) === true) {
 
resetCats();
 
}
 
protein++;
 
chooseCats();
 
}
 
 
function displayAssays() {
 
if (allSelected() === 1) {
 
resetCats();
 
} else if (oneOdd() === 1 && isEven(assays) === true) {
 
resetCats();
 
}
 
assays++;
 
chooseCats();
 
}
 
 
function displayPlants() {
 
if (allSelected() === 1) {
 
resetCats();
 
} else if (oneOdd() === 1 && isEven(plants) === true) {
 
resetCats();
 
}
 
plants++;
 
chooseCats();
 
}
 
 
function displayParts() {
 
if (allSelected() === 1) {
 
resetCats();
 
} else if (oneOdd() === 1 && isEven(parts) === true) {
 
resetCats();
 
}
 
parts++;
 
chooseCats();
 
}
 
 
function displayInterlab() {
 
if (allSelected() === 1) {
 
resetCats();
 
} else if (oneOdd() === 1 && isEven(interlab) === true) {
 
resetCats();
 
}
 
interlab++;
 
chooseCats();
 
}
 
 
 
var week1Click = 0;
 
var week2Click = 0;
 
var week3Click = 0;
 
var week4Click = 0;
 
var week5Click = 0;
 
var week6Click = 0;
 
var week7Click = 0;
 
var week8Click = 0;
 
var week9Click = 0;
 
var week10Click = 0;
 
var week11Click = 0;
 
var week12Click = 0;
 
 
 
 
function displayDaily1() {
 
week1Click++;
 
 
if (isEven(week1Click) === true) {
 
$("#w1").hide();
 
} else {
 
$("#w1").show();
 
}
 
}
 
 
function displayDaily2() {
 
week2Click++;
 
 
if (isEven(week2Click) === true) {
 
$("#w2").hide();
 
} else {
 
$("#w2").show();
 
}
 
}
 
 
 
function displayDaily3() {
 
week3Click++;
 
 
if (isEven(week3Click) === true)  {
 
$("#w3").hide();
 
} else {
 
$("#w3").show();
 
}
 
}
 
 
function displayDaily4() {
 
week4Click++;
 
 
if (isEven(week4Click) === true)  {
 
$("#w4").hide();
 
} else {
 
$("#w4").show();
 
}
 
}
 
 
function displayDaily5() {
 
week5Click++;
 
 
if (isEven(week5Click) === true)  {
 
$("#w5").hide();
 
} else {
 
$("#w5").show();
 
}
 
}
 
 
function displayDaily6() {
 
week6Click++;
 
 
if (isEven(week6Click) === true)  {
 
$("#w6").hide();
 
} else {
 
$("#w6").show();
 
}
 
}
 
 
function displayDaily7() {
 
week7Click++;
 
 
if (isEven(week7Click) === true)  {
 
$("#w7").hide();
 
} else {
 
$("#w7").show();
 
}
 
}
 
 
function displayDaily8() {
 
week8Click++;
 
 
if (isEven(week8Click) === true)  {
 
$("#w8").hide();
 
} else {
 
$("#w8").show();
 
}
 
}
 
 
function displayDaily9() {
 
week9Click++;
 
 
if (isEven(week9Click) === true)  {
 
$("#w9").hide();
 
} else {
 
$("#w9").show();
 
}
 
}
 
 
function displayDaily10() {
 
week10Click++;
 
 
if (isEven(week10Click) === true)  {
 
$("#w10").hide();
 
} else {
 
$("#w10").show();
 
}
 
}
 
 
function displayDaily11() {
 
week11Click++;
 
 
if (isEven(week11Click) === true)  {
 
$("#w11").hide();
 
} else {
 
$("#w11").show();
 
}
 
}
 
 
function displayDaily12() {
 
week12Click++;
 
 
if (isEven(week12Click) === true)  {
 
$("#w12").hide();
 
} else {
 
$("#w12").show();
 
}
 
}
 
 
function chooseCats() {
 
if (noneSelected() === 1) {
 
displayAllCats();
 
}
 
 
if (isEven(cloning) === true) {
 
$(".cloning").hide();
 
}
 
 
if (isEven(protein) === true) {
 
$(".protein").hide();
 
}
 
 
if (isEven(assays) === true) {
 
$(".assays").hide();
 
}
 
 
if (isEven(plants) === true) {
 
$(".plants").hide();
 
}
 
 
if (isEven(parts) === true) {
 
$(".parts").hide();
 
}
 
 
if (isEven(interlab) === true) {
 
$(".interlab").hide();
 
}
 
 
if (isEven(cloning) === false) {
 
$(".cloning").show();
 
} else if (isEven(protein) === false) {
 
$(".protein").show();
 
} else if (isEven(assays) === false) {
 
$(".assays").show();
 
} else if (isEven(plants) === false) {
 
$(".plants").show();
 
} else if (isEven(parts) === false) {
 
$(".parts").show();
 
} else if (isEven(interlab) === false) {
 
$(".interlab").show();
 
}
 
}
 

Latest revision as of 05:10, 21 August 2018