headlines buffer: remove dijit-based RCHK elements

This commit is contained in:
Andrew Dolgov 2013-02-28 15:04:33 +04:00
parent 831408f0e8
commit f7945c99d0
4 changed files with 30 additions and 29 deletions

View File

@ -417,8 +417,8 @@ class Feeds extends Handler_Protected {
$reply['content'] .= "<div class='hlLeft'>"; $reply['content'] .= "<div class='hlLeft'>";
$reply['content'] .= "<input dojoType=\"dijit.form.CheckBox\" $reply['content'] .= "<input
type=\"checkbox\" onclick=\"toggleSelectRow2(this)\" type=\"checkbox\" onclick=\"toggleSelectRow(this)\"
id=\"RCHK-$id\">"; id=\"RCHK-$id\">";
$reply['content'] .= "$marked_pic"; $reply['content'] .= "$marked_pic";
@ -520,8 +520,8 @@ class Feeds extends Handler_Protected {
$reply['content'] .= "<div>"; $reply['content'] .= "<div>";
$reply['content'] .= "<input dojoType=\"dijit.form.CheckBox\" $reply['content'] .= "<input
type=\"checkbox\" onclick=\"toggleSelectRow2(this, false, true)\" type=\"checkbox\" onclick=\"toggleSelectRow(this, false, true)\"
id=\"RCHK-$id\">"; id=\"RCHK-$id\">";
$reply['content'] .= "$marked_pic"; $reply['content'] .= "$marked_pic";

View File

@ -366,9 +366,13 @@ function toggleSelectRow2(sender, row, is_cdm) {
} }
function toggleSelectRow(sender, row) { function toggleSelectRow(sender, row, is_cdm) {
if (!row) row = sender.parentNode.parentNode; if (!row)
if (!is_cdm)
row = sender.parentNode.parentNode;
else
row = sender.parentNode.parentNode.parentNode;
if (sender.checked && !row.hasClassName('Selected')) if (sender.checked && !row.hasClassName('Selected'))
row.addClassName('Selected'); row.addClassName('Selected');

View File

@ -737,9 +737,9 @@ function hotkey_handler(e) {
case "select_article_cursor": case "select_article_cursor":
var id = getArticleUnderPointer(); var id = getArticleUnderPointer();
if (id) { if (id) {
var cb = dijit.byId("RCHK-" + id); var cb = $("RCHK-" + id)
if (cb) { if (cb) {
cb.attr("checked", !cb.attr("checked")); cb.checked = !cb.checked;
toggleSelectRowById(cb, "RROW-" + id); toggleSelectRowById(cb, "RROW-" + id);
return false; return false;
} }

View File

@ -162,11 +162,7 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
initHeadlinesMenu(); initHeadlinesMenu();
new_elems.each(function(child) { new_elems.each(function(child) {
var cb = dijit.byId(child.id.replace("RROW-", "RCHK-")); if (!$("RCHK-" + child.id.replace("RROW-", "RCHK-"))) {
if (!cb) {
dojo.parser.parse(child);
if (!Element.visible(child)) if (!Element.visible(child))
new Effect.Appear(child, { duration : 0.5 }); new Effect.Appear(child, { duration : 0.5 });
} else { } else {
@ -216,6 +212,7 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
_infscroll_request_sent = 0; _infscroll_request_sent = 0;
notify(""); notify("");
} catch (e) { } catch (e) {
@ -605,16 +602,16 @@ function moveToPost(mode, noscroll) {
function toggleSelected(id, force_on) { function toggleSelected(id, force_on) {
try { try {
var cb = dijit.byId("RCHK-" + id); var cb = $("RCHK-" + id);
var row = $("RROW-" + id); var row = $("RROW-" + id);
if (row) { if (row) {
if (row.hasClassName('Selected') && !force_on) { if (row.hasClassName('Selected') && !force_on) {
row.removeClassName('Selected'); row.removeClassName('Selected');
if (cb) cb.attr("checked", false); if (cb) cb.checked = false;
} else { } else {
row.addClassName('Selected'); row.addClassName('Selected');
if (cb) cb.attr("checked", true); if (cb) cb.checked = true;
} }
} }
} catch (e) { } catch (e) {
@ -900,52 +897,52 @@ function selectArticles(mode) {
children.each(function(child) { children.each(function(child) {
var id = child.id.replace("RROW-", ""); var id = child.id.replace("RROW-", "");
var cb = dijit.byId("RCHK-" + id); var cb = $("RCHK-" + id);
if (mode == "all") { if (mode == "all") {
child.addClassName("Selected"); child.addClassName("Selected");
if (cb) cb.attr("checked", true); if (cb) cb.checked= true;
} else if (mode == "unread") { } else if (mode == "unread") {
if (child.hasClassName("Unread")) { if (child.hasClassName("Unread")) {
child.addClassName("Selected"); child.addClassName("Selected");
if (cb) cb.attr("checked", true); if (cb) cb.checked = true;
} else { } else {
child.removeClassName("Selected"); child.removeClassName("Selected");
if (cb) cb.attr("checked", false); if (cb) cb.checked = false;
} }
} else if (mode == "marked") { } else if (mode == "marked") {
var img = $("FMPIC-" + child.id.replace("RROW-", "")); var img = $("FMPIC-" + child.id.replace("RROW-", ""));
if (img && img.src.match("mark_set")) { if (img && img.src.match("mark_set")) {
child.addClassName("Selected"); child.addClassName("Selected");
if (cb) cb.attr("checked", true); if (cb) cb.checked = true;
} else { } else {
child.removeClassName("Selected"); child.removeClassName("Selected");
if (cb) cb.attr("checked", false); if (cb) cb.checked = false;
} }
} else if (mode == "published") { } else if (mode == "published") {
var img = $("FPPIC-" + child.id.replace("RROW-", "")); var img = $("FPPIC-" + child.id.replace("RROW-", ""));
if (img && img.src.match("pub_set")) { if (img && img.src.match("pub_set")) {
child.addClassName("Selected"); child.addClassName("Selected");
if (cb) cb.attr("checked", true); if (cb) cb.checked = true;
} else { } else {
child.removeClassName("Selected"); child.removeClassName("Selected");
if (cb) cb.attr("checked", false); if (cb) cb.checked = false;
} }
} else if (mode == "invert") { } else if (mode == "invert") {
if (child.hasClassName("Selected")) { if (child.hasClassName("Selected")) {
child.removeClassName("Selected"); child.removeClassName("Selected");
if (cb) cb.attr("checked", false); if (cb) cb.checked = false;
} else { } else {
child.addClassName("Selected"); child.addClassName("Selected");
if (cb) cb.attr("checked", true); if (cb) cb.checked = true;
} }
} else { } else {
child.removeClassName("Selected"); child.removeClassName("Selected");
if (cb) cb.attr("checked", false); if (cb) cb.checked = false;
} }
}); });
@ -1636,10 +1633,10 @@ function isCdmMode() {
function markHeadline(id) { function markHeadline(id) {
var row = $("RROW-" + id); var row = $("RROW-" + id);
if (row) { if (row) {
var check = dijit.byId("RCHK-" + id); var check = $("RCHK-" + id);
if (check) { if (check) {
check.attr("checked", true); check.checked = true;
} }
row.addClassName("Selected"); row.addClassName("Selected");