Commit 9f2bc09a authored by Téo Vasseur's avatar Téo Vasseur

js : remove code duplication in setOverlays()

parent ff39446c
......@@ -97,27 +97,18 @@ function hideOverlays() {
}
function setOverlays() {
div = document.createElement('div');
div.className = "overlay";
div.onclick = function() {
setView(selectedView, 'A');
hideOverlays();
}
document.getElementById('A').appendChild(div);
div = div.cloneNode();
div.onclick = function() {
setView(selectedView, 'B');
hideOverlays();
}
document.getElementById('B').appendChild(div);
div = div.cloneNode();
div.onclick = function() {
setView(selectedView, 'C');
hideOverlays();
var setOverlay = function(id) {
div = document.createElement('div');
div.className = "overlay";
div.onclick = function() {
setView(selectedView, id);
hideOverlays();
}
document.getElementById(id).appendChild(div);
}
document.getElementById('C').appendChild(div);
setOverlay('A');
setOverlay('B');
setOverlay('C');
}
function main() {
......
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