SanderKeij (Talk | contribs) |
|||
(11 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{:Team:TU-Eindhoven/NavMenu}} | {{:Team:TU-Eindhoven/NavMenu}} | ||
<html> | <html> | ||
+ | <style> | ||
+ | #HQ_page p { | ||
+ | color:black; | ||
+ | } | ||
+ | </style> | ||
<head> | <head> | ||
<div class="container logbook neat" id="log-container"> | <div class="container logbook neat" id="log-container"> | ||
<h2>Log book</h2> | <h2>Log book</h2> | ||
− | <p> | + | <p>Our logbook is recorded daily, here you can find a short summary of the labwork done by each subgroup in chronological order.</p> |
<span>Categories:</span> | <span>Categories:</span> | ||
<select id="CategoriesSelect" onchange="changeCat(this)"> | <select id="CategoriesSelect" onchange="changeCat(this)"> | ||
<option value="all" selected="selected">(please select [ALL]:)</option> | <option value="all" selected="selected">(please select [ALL]:)</option> | ||
− | <option value=" | + | <option value="Adhesin">Adhesin</option> |
<option value="cloning">Cloning</option> | <option value="cloning">Cloning</option> | ||
<option value="biobrick">Biobrick</option> | <option value="biobrick">Biobrick</option> | ||
Line 19: | Line 24: | ||
</div> | </div> | ||
+ | <script src="https://2018.igem.org/Team:TU-Eindhoven/logbook?action=raw&ctype=text/javascript"></script> | ||
<script> | <script> | ||
// Catelogue | // Catelogue | ||
var bGenerateCat = false; | var bGenerateCat = false; | ||
+ | document.addEventListener("DOMContentLoaded", function(){ | ||
+ | console.log("start generating logbook..."); | ||
+ | var logJSON = logJSONObj; | ||
+ | console.log(logJSON); | ||
+ | var log = document.getElementById("log-container"); | ||
+ | // var dates = Object.keys(logtext).length; | ||
+ | var trans = {'Adhesin':'Adhesin', | ||
+ | 'cloning':'Cloning', | ||
+ | 'biobrick':'Biobrick', | ||
+ | 'organiclab':'Organic Lab' | ||
+ | }; | ||
+ | for(var key in logJSON) { | ||
+ | console.log(key); | ||
+ | let btn = document.createElement("BUTTON"); | ||
+ | btn.classList.add("accordion"); | ||
+ | btn.innerHTML = key; | ||
+ | log.appendChild(btn); | ||
+ | |||
+ | let panel = document.createElement("DIV"); | ||
+ | panel.classList.add("my-panel"); | ||
+ | for(var part in logJSON[key]) { | ||
+ | let h = document.createElement('H2'); | ||
+ | h.innerHTML = trans[part]; | ||
+ | |||
+ | let d = document.createElement("DIV"); | ||
+ | d.classList.add(part, "all"); | ||
+ | d.innerHTML = logJSON[key][part]["html"]; | ||
+ | d.insertBefore(h, d.firstChild); | ||
+ | panel.appendChild(d); | ||
+ | } | ||
+ | log.appendChild(panel); | ||
+ | } | ||
+ | var acc = document.getElementsByClassName("accordion"); | ||
+ | var i; | ||
+ | |||
+ | for (i = 0; i < acc.length; i++) { | ||
+ | acc[i].addEventListener("click", function() { | ||
+ | this.classList.toggle("active"); | ||
+ | var panel = this.nextElementSibling; | ||
+ | if (panel.style.maxHeight){ | ||
+ | panel.style.maxHeight = null; | ||
+ | } else { | ||
+ | panel.style.maxHeight = panel.scrollHeight + "px"; | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | }) | ||
+ | |||
var xhr = new XMLHttpRequest(); | var xhr = new XMLHttpRequest(); | ||
xhr.overrideMimeType("application/json"); | xhr.overrideMimeType("application/json"); | ||
− | xhr.open("GET", "https://2018.igem.org/Team:TU-Eindhoven/logbook?action=raw&ctype=text/javascript", true); | + | // xhr.open("GET", "https://2018.igem.org/Team:TU-Eindhoven/logbook?action=raw&ctype=text/javascript", true); |
− | + | ||
xhr.onreadystatechange = function(){ | xhr.onreadystatechange = function(){ | ||
− | if (xhr.readyState == 4 | + | if (xhr.readyState == 4){ |
+ | if(xhr.status == "200") { | ||
+ | console.log("start generating logbook..."); | ||
var logJSON = JSON.parse(xhr.responseText); | var logJSON = JSON.parse(xhr.responseText); | ||
var log = document.getElementById("log-container"); | var log = document.getElementById("log-container"); | ||
Line 71: | Line 127: | ||
}); | }); | ||
} | } | ||
− | } | + | }} |
} | } | ||
− | xhr.send(null); | + | // xhr.send(null); |
// change categories | // change categories |
Latest revision as of 23:29, 16 October 2018
Log book
Our logbook is recorded daily, here you can find a short summary of the labwork done by each subgroup in chronological order.
Categories: