Skip to content

Commit 64a7ed8

Browse files
author
jordanmccullough
committed
First pass at simplifying content-scope toggling
1 parent 7a0c3c6 commit 64a7ed8

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

_javascript/workbook.js

+10-22
Original file line numberDiff line numberDiff line change
@@ -23,38 +23,26 @@
2323
activeId = id;
2424
}
2525

26+
console.log("ActiveId: " + activeId);
27+
28+
var scopeWrapper = document.getElementById("scope");
2629

2730
switch(activeId){
2831
case "outline":
29-
showSet("outline");
30-
hideSet("summary");
31-
hideSet("details");
32+
showSet(scopeWrapper, "outline");
3233
break;
3334
case "summary":
34-
hideSet("outline");
35-
showSet("summary");
36-
hideSet("details");
35+
showSet(scopeWrapper, "summary");
3736
break;
3837
case "details":
39-
hideSet("outline");
40-
hideSet("summary");
41-
showSet("details");
38+
showSet(scopeWrapper, "details");
4239
break;
4340
}
4441
}
45-
function hideSet(id){
46-
var allEl = selection(id);
47-
hideClassNames = id + " scope-hidden";
48-
for(var e=0; e<allEl.length; e++){
49-
allEl[e].className = hideClassNames;
50-
}
51-
}
52-
function showSet(id){
53-
var allEl = selection(id),
54-
showClassNames = id + " scope-visible";
55-
for(var e=0; e<allEl.length; e++){
56-
allEl[e].className = showClassNames;
57-
}
42+
43+
function showSet(wrapper, scope){
44+
console.log("Changing scope");
45+
wrapper.className = scope;
5846
}
5947
function selection(identifier){
6048
var allEl = document.getElementsByClassName(identifier);

0 commit comments

Comments
 (0)