aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/assets
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-03-17 22:18:55 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2022-03-17 22:18:55 +0300
commit38068824378f746f2a156890354b1fa947c2d5e3 (patch)
treeec1112c299a51053a4225fc569caf94de0824d6b /assets
parentcss: main.css -> pre_overlay.css (diff)
downloadwireguard-config-38068824378f746f2a156890354b1fa947c2d5e3.tar.gz
wireguard-config-38068824378f746f2a156890354b1fa947c2d5e3.zip
replace text in buttons with icons
Diffstat (limited to 'assets')
-rw-r--r--assets/js/main.js25
1 files changed, 21 insertions, 4 deletions
diff --git a/assets/js/main.js b/assets/js/main.js
index 0d203dd..84970dc 100644
--- a/assets/js/main.js
+++ b/assets/js/main.js
@@ -341,18 +341,33 @@ Data.prototype.hide_advanced = function() {
});
}
+function edit_btn_init(btn) {
+ btn.empty();
+ btn.append('<span class="glyphicon glyphicon-pencil"/>');
+}
+
+function edit_btn_save(btn) {
+ btn.empty();
+ btn.append('<span class="glyphicon glyphicon-floppy-disk"/>');
+}
+
function edit_btn_on_click(btn, pre) {
var editable = pre.prop('isContentEditable');
pre.prop('contentEditable', !editable);
if (editable) {
- btn.text('Edit');
+ edit_btn_init(btn);
btn.blur(); // a.k.a. unfocus
} else {
- btn.text('Save');
+ edit_btn_save(btn);
pre.focus();
}
}
+function dload_btn_init(btn) {
+ btn.empty();
+ btn.append('<span class="glyphicon glyphicon-download-alt"/>');
+}
+
function basename(path) {
return path.substring(path.lastIndexOf('/') + 1);
}
@@ -372,12 +387,14 @@ function dload_btn_on_click(btn, path, pre) {
}
function make_pre_buttons(path, pre) {
- var edit_btn = $('<button class="btn btn-default" type="button"/>').text('Edit');
+ var edit_btn = $('<button class="btn btn-default" type="button" title="Edit"/>');
+ edit_btn_init(edit_btn);
edit_btn.click(function() {
edit_btn_on_click(edit_btn, pre);
});
- var dload_btn = $('<button class="btn btn-default" type="button"/>').text('Download');
+ var dload_btn = $('<button class="btn btn-default" type="button" title="Download"/>');
+ dload_btn_init(dload_btn);
dload_btn.click(function() {
dload_btn_on_click(dload_btn, path, pre);
});