remove toggleSelectListRow2()

This commit is contained in:
Andrew Dolgov 2018-12-02 10:16:25 +03:00
parent 8ea3a75df0
commit 2f85b50e36
3 changed files with 15 additions and 16 deletions

View File

@ -429,7 +429,7 @@ class Pref_Filters extends Handler_Protected {
$data = htmlspecialchars(json_encode($line));
print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='toggleSelectListRow2(this)'>".
print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='ListUtils.onChecked(this)'>".
"<span onclick=\"dijit.byId('filterEditDlg').editRule(this)\">".$this->getRuleName($line)."</span>".
"<input type='hidden' name='rule[]' value=\"$data\"/></li>";
}
@ -473,7 +473,7 @@ class Pref_Filters extends Handler_Protected {
$data = htmlspecialchars(json_encode($line));
print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='toggleSelectListRow2(this)'>".
print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='ListUtils.onChecked(this)'>".
"<span onclick=\"dijit.byId('filterEditDlg').editAction(this)\">".$this->getActionName($line)."</span>".
"<input type='hidden' name='action[]' value=\"$data\"/></li>";
}

View File

@ -53,12 +53,10 @@
$site_url = htmlspecialchars($line["site_url"]);
$subscribers = $line["subscribers"];
$check_box = "<input onclick='toggleSelectListRow2(this)'
$check_box = "<input onclick='ListUtils.onChecked(this)'
dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\" \">";
$class = ($feedctr % 2) ? "even" : "odd";
$site_url = "<a target=\"_blank\" rel=\"noopener noreferrer\"
href=\"$site_url\">
<span class=\"fb_feedTitle\">".
@ -75,11 +73,9 @@
$feed_url = htmlspecialchars($line["feed_url"]);
$site_url = htmlspecialchars($line["site_url"]);
$check_box = "<input onclick='toggleSelectListRow2(this)' dojoType=\"dijit.form.CheckBox\"
$check_box = "<input onclick='ListUtils.onChecked(this)' dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\">";
$class = ($feedctr % 2) ? "even" : "odd";
if ($line['articles_archived'] > 0) {
$archived = sprintf(_ngettext("%d archived article", "%d archived articles", (int) $line['articles_archived']), $line['articles_archived']);
$archived = "&nbsp;<span class='subscribers'>($archived)</span>";

View File

@ -53,6 +53,15 @@ Array.prototype.remove = function(s) {
}
};
const ListUtils = {
onChecked: function(elem) {
// account for dojo checkboxes
elem = elem.domNode || elem;
elem.up("li").toggleClassName("Selected");
}
};
const Utils = {
_rpc_seq: 0,
hotkey_prefix: 0,
@ -984,12 +993,6 @@ function toggleSelectRowById(sender, id) {
return toggleSelectRow(sender, row);
}
/* this is for dijit Checkbox */
function toggleSelectListRow2(sender) {
const row = sender.domNode.parentNode;
return toggleSelectRow(sender, row);
}
/* this is for dijit Checkbox */
function toggleSelectRow2(sender, row, is_cdm) {
@ -1137,7 +1140,7 @@ const Filters = {
new dijit.form.CheckBox({
onChange: function () {
this.domNode.up("li").toggleClassName("Selected");
ListUtils.onChecked(this);
},
}, cb);
@ -1186,7 +1189,7 @@ const Filters = {
new dijit.form.CheckBox({
onChange: function () {
this.domNode.up("li").toggleClassName("Selected");
ListUtils.onChecked(this);
},
}, cb);