diff --git a/luci-app-zapret2/htdocs/luci-static/resources/view/zapret2/settings.js b/luci-app-zapret2/htdocs/luci-static/resources/view/zapret2/settings.js
index 37f9309..3f324a4 100644
--- a/luci-app-zapret2/htdocs/luci-static/resources/view/zapret2/settings.js
+++ b/luci-app-zapret2/htdocs/luci-static/resources/view/zapret2/settings.js
@@ -7,6 +7,11 @@
'require view';
'require view.zapret2.tools as tools';
+document.head.appendChild(E('link', {
+ rel: 'stylesheet',
+ href: L.resource('view/zapret2/styles.css')
+}));
+
return view.extend({
parsers: { },
@@ -128,8 +133,10 @@ return view.extend({
let btn = sec.taboption(tabname, form.Button, '_' + param + '_btn', locname);
btn.inputtitle = _('Edit');
btn.inputstyle = 'edit btn';
- let val = sec.taboption(tabname, form.DummyValue, '_' + param);
- val.rawhtml = multiline ? true : false;
+ let val = sec.taboption(tabname, form.TextValue, '_' + param);
+ val.readonly = true;
+ val.rows = rows + 5;
+ val.wrap = false;
val.cfgvalue = function(section_id) {
let value = uci.get(tools.appName, section_id, param);
if (value == null) {
@@ -141,15 +148,10 @@ return view.extend({
value = value.replace(/\n --/g, "\n--");
value = value.replace(/ --/g, "\n--");
}
- if (val.rawhtml) {
- value = value.replace(//g, '˃');
- value = value.replace(/\n/g, '
');
- }
return value;
};
val.validate = function(section_id, value) {
- return (value) ? value.trim() : "";
+ return true;
};
let desc = locname;
if (multiline == 2) {
diff --git a/luci-app-zapret2/htdocs/luci-static/resources/view/zapret2/styles.css b/luci-app-zapret2/htdocs/luci-static/resources/view/zapret2/styles.css
new file mode 100644
index 0000000..72a22fd
--- /dev/null
+++ b/luci-app-zapret2/htdocs/luci-static/resources/view/zapret2/styles.css
@@ -0,0 +1,6 @@
+textarea, .cbi-value textarea
+{
+ white-space: pre;
+ overflow-x: auto;
+ font-family: monospace;
+}
diff --git a/luci-app-zapret2/htdocs/luci-static/resources/view/zapret2/tools.js b/luci-app-zapret2/htdocs/luci-static/resources/view/zapret2/tools.js
index f6a9cd2..106411e 100644
--- a/luci-app-zapret2/htdocs/luci-static/resources/view/zapret2/tools.js
+++ b/luci-app-zapret2/htdocs/luci-static/resources/view/zapret2/tools.js
@@ -506,24 +506,10 @@ return baseclass.extend({
value = value.replace(/˂/g, '<');
value = value.replace(/˃/g, '>');
try {
- let elem = document.getElementById("cbi-" + this.appName + "-" + this.cfgsec + "-_" + this.cfgparam);
- if (elem) {
- if (elem.querySelector('div')) {
- elem = elem.querySelector('div');
- } else {
- elem = elem.querySelector('output');
- }
- }
+ let elem = document.getElementById("widget.cbid." + this.appName + ".config._" + this.cfgparam);
if (elem) {
let val = value.trim();
- if (this.multiline) {
- val = val.replace(//g, '˃');
- val = val.replace(/\n/g, '
');
- elem.innerHTML = val;
- } else {
- elem.textContent = val;
- }
+ elem.textContent = val;
}
} catch(e) {
console.error('ERROR: cannot found elem for ' + this.cfgsec + '.' + this.cfgparam);