filter dialog: add inline regexp checker

master
Andrew Dolgov 5 years ago
parent 86a014f23b
commit e8523733b0

@ -978,12 +978,12 @@ class Pref_Filters extends Handler_Protected {
print "<input dojoType=\"dijit.form.ValidationTextBox\" print "<input dojoType=\"dijit.form.ValidationTextBox\"
required=\"true\" id=\"filterDlg_regExp\" required=\"true\" id=\"filterDlg_regExp\"
onchange='Filters.filterDlgCheckRegExp(this)' onchange='Filters.filterDlgCheckRegExp(this)'
style=\"font-size : 16px; width : 20em;\" onblur='Filters.filterDlgCheckRegExp(this)'
onfocus='Filters.filterDlgCheckRegExp(this)'
style=\"font-size : 16px; width : 500px\"
name=\"reg_exp\" value=\"$reg_exp\"/>"; name=\"reg_exp\" value=\"$reg_exp\"/>";
print "<div dojoType=\"dijit.Tooltip\" connectId=\"filterDlg_regExp\" position=\"below\"> print "<div dojoType='dijit.Tooltip' id='filterDlg_regExp_tip' connectId='filterDlg_regExp' position='below'></div>";
".__("Regular expression, without outer delimiters (i.e. slashes)")."
</div>";
print "<fieldset>"; print "<fieldset>";
print "<label class='checkbox'><input id=\"filterDlg_inverse\" dojoType=\"dijit.form.CheckBox\" print "<label class='checkbox'><input id=\"filterDlg_inverse\" dojoType=\"dijit.form.CheckBox\"

@ -1547,6 +1547,14 @@ body.ttrss_prefs .phpinfo td.v {
font-family: monospace; font-family: monospace;
word-break: break-all; word-break: break-all;
} }
body.ttrss_prefs #filterNewRuleDlg .invalid,
body.ttrss_main #filterNewRuleDlg .invalid {
background: #ffc0c0;
}
body.ttrss_prefs #filterNewRuleDlg .valid,
body.ttrss_main #filterNewRuleDlg .valid {
background: #c0ffc0;
}
body.ttrss_prefs fieldset, body.ttrss_prefs fieldset,
body.ttrss_utility fieldset { body.ttrss_utility fieldset {
border-width: 0px; border-width: 0px;

File diff suppressed because one or more lines are too long

@ -152,6 +152,18 @@ body.ttrss_prefs {
} }
} }
body.ttrss_prefs,
body.ttrss_main {
#filterNewRuleDlg {
.invalid {
background : #ffc0c0;
}
.valid {
background : #c0ffc0;
}
}
}
body.ttrss_prefs, body.ttrss_prefs,
body.ttrss_utility { body.ttrss_utility {
fieldset { fieldset {

@ -3,10 +3,21 @@
define(["dojo/_base/declare"], function (declare) { define(["dojo/_base/declare"], function (declare) {
Filters = { Filters = {
filterDlgCheckRegExp: function(sender) { filterDlgCheckRegExp: function(sender) {
const tooltip = dijit.byId("filterDlg_regExp_tip").domNode;
try { try {
sender.domNode.removeClassName("invalid");
sender.domNode.removeClassName("valid");
new RegExp("/" + sender.value + "/"); new RegExp("/" + sender.value + "/");
sender.domNode.addClassName("valid");
tooltip.innerText = __("Regular expression, without outer delimiters (i.e. slashes)");
} catch (e) { } catch (e) {
console.error(e); sender.domNode.addClassName("invalid");
tooltip.innerText = e.message;
} }
}, },
filterDlgCheckAction: function(sender) { filterDlgCheckAction: function(sender) {

@ -1548,6 +1548,14 @@ body.ttrss_prefs .phpinfo td.v {
font-family: monospace; font-family: monospace;
word-break: break-all; word-break: break-all;
} }
body.ttrss_prefs #filterNewRuleDlg .invalid,
body.ttrss_main #filterNewRuleDlg .invalid {
background: #ffc0c0;
}
body.ttrss_prefs #filterNewRuleDlg .valid,
body.ttrss_main #filterNewRuleDlg .valid {
background: #c0ffc0;
}
body.ttrss_prefs fieldset, body.ttrss_prefs fieldset,
body.ttrss_utility fieldset { body.ttrss_utility fieldset {
border-width: 0px; border-width: 0px;
@ -1827,6 +1835,12 @@ body.flat.ttrss_main.ttrss_prefs td.filename,
body.flat.ttrss_main.ttrss_prefs div.prefHelp { body.flat.ttrss_main.ttrss_prefs div.prefHelp {
color: #999999; color: #999999;
} }
body.flat.ttrss_main.ttrss_prefs #filterNewRuleDlg .invalid {
background: #503030;
}
body.flat.ttrss_main.ttrss_prefs #filterNewRuleDlg .valid {
background: #305030;
}
body.flat.ttrss_main { body.flat.ttrss_main {
/* /*
.post .content img, .post .content img,

File diff suppressed because one or more lines are too long

@ -28,6 +28,15 @@ body.flat.ttrss_main.ttrss_prefs {
div.prefHelp { div.prefHelp {
color : @fg-text-muted; color : @fg-text-muted;
} }
#filterNewRuleDlg {
.invalid {
background : #503030;
}
.valid {
background : #305030;
}
}
} }
body.flat.ttrss_main { body.flat.ttrss_main {

@ -1548,6 +1548,14 @@ body.ttrss_prefs .phpinfo td.v {
font-family: monospace; font-family: monospace;
word-break: break-all; word-break: break-all;
} }
body.ttrss_prefs #filterNewRuleDlg .invalid,
body.ttrss_main #filterNewRuleDlg .invalid {
background: #ffc0c0;
}
body.ttrss_prefs #filterNewRuleDlg .valid,
body.ttrss_main #filterNewRuleDlg .valid {
background: #c0ffc0;
}
body.ttrss_prefs fieldset, body.ttrss_prefs fieldset,
body.ttrss_utility fieldset { body.ttrss_utility fieldset {
border-width: 0px; border-width: 0px;
@ -1827,6 +1835,12 @@ body.flat.ttrss_main.ttrss_prefs td.filename,
body.flat.ttrss_main.ttrss_prefs div.prefHelp { body.flat.ttrss_main.ttrss_prefs div.prefHelp {
color: #999999; color: #999999;
} }
body.flat.ttrss_main.ttrss_prefs #filterNewRuleDlg .invalid {
background: #503030;
}
body.flat.ttrss_main.ttrss_prefs #filterNewRuleDlg .valid {
background: #305030;
}
body.flat.ttrss_main { body.flat.ttrss_main {
/* /*
.post .content img, .post .content img,

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save