-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6445 from Ayushmanwebdeveloper/luci-app-olsr-js-mig
luci-app-olsr: migrate to JavaScript-based implementation
- Loading branch information
Showing
48 changed files
with
4,619 additions
and
3,344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
applications/luci-app-olsr/htdocs/luci-static/resources/common/common_js.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); | ||
}; | ||
}; |
Oops, something went wrong.