54 lines
1.6 KiB
JavaScript
54 lines
1.6 KiB
JavaScript
function opencell(id) {
|
|
var x = document.getElementsByClassName("opened");
|
|
var url = window.location.toString();
|
|
url = url.split("#")[0];
|
|
|
|
if ( x.length !== 0) {
|
|
|
|
var w = x[0].getElementsByClassName("data");
|
|
w[0].classList.add("hidden");
|
|
w[0].classList.remove("display");
|
|
var currentid = x[0].id
|
|
// x[0].classList.add("closed");
|
|
x[0].classList.remove("opened");
|
|
if (currentid !== id){
|
|
var y = document.getElementById(id);
|
|
// y.classList.remove("closed");
|
|
y.classList.add("opened");
|
|
var z = y.getElementsByClassName("hidden");
|
|
z[0].classList.add("display");
|
|
z[0].classList.remove("hidden");
|
|
url = url.concat("#",id);
|
|
}
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
var y = document.getElementById(id);
|
|
// y.classList.remove("closed");
|
|
y.classList.add("opened");
|
|
var z = y.getElementsByClassName("hidden");
|
|
z[0].classList.add("display");
|
|
z[0].classList.remove("hidden");
|
|
url = url.concat("#",id);
|
|
}
|
|
|
|
history.pushState({}, null, url);
|
|
}
|
|
function init() {
|
|
if(window.location.hash) {
|
|
var anchor = window.location.hash.substring(1);
|
|
var x = document.getElementById("jobs");
|
|
console.log(x.children[anchor] );
|
|
var w = x.children[anchor]
|
|
if ( w !== undefined) {
|
|
// w.classList.remove("closed");
|
|
w.classList.add("opened");
|
|
var z = w.getElementsByClassName("hidden");
|
|
z[0].classList.add("display");
|
|
z[0].classList.remove("hidden");
|
|
}
|
|
}
|
|
}
|