Added collapse/expand all button
Noah Zalev committed
May 6, 2021 at 17:06 UTC
27e5aceabac85ef77bb90174035902657807e890
1 file changed
+24
-1
views/default.handlebars
+24
-1
@@ -255,7 +255,9 @@
255
<tr>
256
<td class=h1></td>
257
<td id=devListToolbar class=style14 style="display:none">
258
- <input type="button" id="SelectAllButton" onclick="selectallButtonFunction();" value="Select All" />
258
+
259
+ <input type="button" id="CollapseAllButton" onclick="collapseallButtonFunction();" value="Collapse All" />
260
+ <input type="button" id="SelectAllButton" onclick="selectallButtonFunction();" value="Select All" />
261
<input type=button id=GroupActionButton disabled="disabled" value="Group Action" onclick=groupActionFunction() />
262
<input id=SearchInput type=search autocomplete=off placeholder=Filter onchange=onDeviceSearchChanged(event) onkeyup=onDeviceSearchChanged(event) onfocus=onSearchFocus(1) onblur=onSearchFocus(0) />
263
<span id=SearchInputClearButton style="display:none;position:relative"><img src="images/x16.png" type="button" onclick="clearDeviceSearch()" style="position:absolute;cursor:pointer;left:-18px;top:-8px" srcset="images/x32.png 2x"/></span>
@@ -1570,6 +1572,9 @@
1572
var deskKeyboardShortcutsStr = getstore('deskKeyShortcuts', '0x0A002E,0x100000,0x100028,0x100026,0x10004C,0x10004D,0x11004D,0x100052,0x020073,0x080057,0x020009,0x100025,0x100027').split(',');
1573
for (var i in deskKeyboardShortcutsStr) { deskKeyboardShortcuts.push(parseInt(deskKeyboardShortcutsStr[i])); }
1574
updateDeskShortcutKeys();
1575
+
1576
+ // Override the collapse button text
1577
+ updateCollapseallButtonText();
1578
}
1579
1580
function refreshCookieSession() {
@@ -4311,6 +4316,7 @@
4316
}
4317
Q('DevxColImg' + id).src = x?'images/c2.png':'images/c1.png';
4318
putstore('_collapse', JSON.stringify(CollapsedGroups));
4319
+ updateCollapseallButtonText();
4320
onDevicesScrollEx();
4321
}
4322
@@ -4851,6 +4857,22 @@
4857
return "Unknown";
4858
}
4859
4860
+ function collapseallButtonFunction() {
4861
+ if (Q('CollapseAllButton').value == "Collapse All") {
4862
+ cmexpandaction(2);
4863
+ } else {
4864
+ cmexpandaction(1);
4865
+ }
4866
+ }
4867
+
4868
+ function updateCollapseallButtonText() {
4869
+ if ((JSON.stringify(getstore('_collapse', '{}')).length - 4) > 0) {
4870
+ Q('CollapseAllButton').value = "Expand All";
4871
+ } else {
4872
+ Q('CollapseAllButton').value = "Collapse All";
4873
+ }
4874
+ }
4875
+
4876
function selectallButtonFunction() {
4877
var elements = document.getElementsByClassName('DeviceCheckbox'), checkcount = Object.keys(checkedNodeids).length;
4878
for (var i = 0; i < elements.length; i++) { elements[i].checked = (checkcount == 0); }
@@ -5456,6 +5478,7 @@
5478
}
5479
}
5480
putstore('_collapse', JSON.stringify(CollapsedGroups));
5481
+ updateCollapseallButtonText();
5482
mainUpdate(4);
5483
}
5484