summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-olsr/htdocs/luci-static/resources/common
diff options
context:
space:
mode:
authorAyushman Tripathi <ayushmantripathi7724@gmail.com>2023-06-26 01:23:48 +0530
committerAyushman Tripathi <ayushmantripathi7724@gmail.com>2023-07-20 20:05:50 +0530
commitebd09332b4330001ecd3a86d1b379e0afc3bafee (patch)
tree39e973d153f0081800822e6a4a325f71d4441a00 /applications/luci-app-olsr/htdocs/luci-static/resources/common
parentfd5440a7be5506fa39c3993f10f754dedb5e8888 (diff)
luci-app-olsr: migrate to js
Signed-off-by: Ayushman Tripathi <ayushmantripathi7724@gmail.com> luci-app-olsr: migrate to js fix XSS vulnerability Signed-off-by: Ayushman Tripathi <ayushmantripathi7724@gmail.com> luci-app-olsr: migrate to js luci-app-olsr: migrate to js fix minor bugs Signed-off-by: Ayushman Tripathi <ayushmantripathi7724@gmail.com> luci-app-olsr: migrate to js luci-app-olsr: migrate to js fix plugins bugs Signed-off-by: Ayushman Tripathi <ayushmantripathi7724@gmail.com> luci-app-olsr: migrate to js luci-app-olsr: migrate to js fix interfaces bugs Signed-off-by: Ayushman Tripathi <ayushmantripathi7724@gmail.com> luci-app-olsr: migrate to js luci-app-olsr: migrate to js fix interface & snr bugs Signed-off-by: Ayushman Tripathi <ayushmantripathi7724@gmail.com> luci-app-olsr: migrate to js luci-app-olsr: migrate to js fix hostname Signed-off-by: Ayushman Tripathi <ayushmantripathi7724@gmail.com> luci-app-olsr: migrate to js luci-app-olsr: migrate to js fix typo Signed-off-by: Ayushman Tripathi <ayushmantripathi7724@gmail.com> luci-app-olsr: migrate to js luci-app-olsr: migrate to js fix missing files, use rpc for hostnames, remove luci-compat Signed-off-by: Ayushman Tripathi <ayushmantripathi7724@gmail.com> luci-app-olsr: migrate to js luci-app-olsr: migrate to js fix menu order Signed-off-by: Ayushman Tripathi <ayushmantripathi7724@gmail.com> luci-app-olsr: migrate to js
Diffstat (limited to 'applications/luci-app-olsr/htdocs/luci-static/resources/common')
-rw-r--r--applications/luci-app-olsr/htdocs/luci-static/resources/common/common_js.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/applications/luci-app-olsr/htdocs/luci-static/resources/common/common_js.js b/applications/luci-app-olsr/htdocs/luci-static/resources/common/common_js.js
new file mode 100644
index 0000000000..126bcece59
--- /dev/null
+++ b/applications/luci-app-olsr/htdocs/luci-static/resources/common/common_js.js
@@ -0,0 +1,34 @@
+function css(selector, property, value) {
+ for (var i = 0; i < document.styleSheets.length; i++) {
+ try {
+ document.styleSheets[i].insertRule(selector + ' {' + property + ':' + value + '}', document.styleSheets[i].cssRules.length);
+ } catch (err) {
+ try {
+ document.styleSheets[i].addRule(selector, property + ':' + value);
+ } catch (err) {}
+ } //IE
+ }
+}
+
+window.onload = function () {
+ var buttons = '<input type="button" name="show-proto-4" id="show-proto-4" class="cbi-button cbi-button-apply" style="margin-right: 5px" value="<%:Hide IPv4%>">';
+ buttons += '<input type="button" name="show-proto-6" id="show-proto-6" class="cbi-button cbi-button-apply" value="<%:Hide IPv6%>">';
+
+ document.getElementById('togglebuttons').innerHTML = buttons;
+
+ var visible = true;
+ document.getElementById('show-proto-4').onclick = function () {
+ visible = !visible;
+ document.getElementById('show-proto-4').value = visible ? '<%:Hide IPv4%>' : '<%:Show IPv4%>';
+ document.getElementById('show-proto-4').className = visible ? 'cbi-button cbi-button-apply' : 'cbi-button cbi-button-reset';
+ css('.proto-4', 'display', visible ? 'table-row' : 'none');
+ };
+
+ var visible6 = true;
+ document.getElementById('show-proto-6').onclick = function () {
+ visible6 = !visible6;
+ document.getElementById('show-proto-6').value = visible6 ? '<%:Hide IPv6%>' : '<%:Show IPv6%>';
+ document.getElementById('show-proto-6').className = visible6 ? 'cbi-button cbi-button-apply' : 'cbi-button cbi-button-reset';
+ css('.proto-6', 'display', visible6 ? 'table-row' : 'none');
+ };
+};