clear : both;
}
-.evenUnreadSelected div.cdmFooter, .oddUnreadSelected div.cdmFooter,
-.evenSelected div.cdmFooter, .oddSelected div.cdmFooter {
+.Selected div.cdmFooter {
background-color : #FFF2BF;
}
function selectTableRow(r, do_select) {
- r.className = r.className.replace("Selected", "");
if (do_select) {
- r.className = r.className + "Selected";
+ r.addClassName("Selected");
+ } else {
+ r.removeClassName("Selected");
}
}
if (!is_cat) {
var feedr = $("FEEDR-" + feed);
- if (feedr && !feedr.className.match("Selected")) {
- feedr.className = feedr.className + "Selected";
+ if (feedr && !feedr.hasClassName("Selected")) {
+ feedr.addClassName("Selected");
}
} else {
var feedr = $("FCAT-" + feed_id);
- if (feedr && !feedr.className.match("Selected")) {
- feedr.className = feedr.className + "Selected";
+ if (feedr && !feedr.hasClassName("Selected")) {
+ feedr.addClassName("Selected");
}
}
function feedlist_dragsorted(ctr) {
try {
- var elem = $("feedList");
+ var cats = $$("#feedList > li[id*=FCAT-]");
+ var ordered_cats = [];
- var cats = elem.getElementsByTagName("LI");
- var ordered_cats = new Array();
-
- for (var i = 0; i < cats.length; i++) {
- if (cats[i].id && cats[i].id.match("FCAT-")) {
- ordered_cats.push(cats[i].id.replace("FCAT-", ""));
- }
- }
+ cats.each(function(cat) {
+ ordered_cats.push(cat.id.replace("FCAT-", ""));
+ });
if (ordered_cats.length > 0) {
if (catctr) {
catctr.innerHTML = "(" + ctr + ")";
if (ctr > 0) {
- catctr.className = "catCtrHasUnread";
+ catctr.addClassName("Unread");
} else {
- catctr.className = "catCtrNoUnread";
+ catctr.removeClassName("Unread");
}
}
continue;
feedu.innerHTML = ctr;
if (error) {
- feedr.className = feedr.className.replace("feed", "error");
+ feedr.removeClassName("feed");
+ feedr.addClassName("error");
} else if (id > 0) {
- feedr.className = feedr.className.replace("error", "feed");
+ feedr.removeClassName("error");
+ feedr.addClassName("feed");
}
if (ctr > 0) {
- feedctr.className = "feedCtrHasUnread";
- if (!feedr.className.match("Unread")) {
- var is_selected = feedr.className.match("Selected");
-
- feedr.className = feedr.className.replace("Selected", "");
- feedr.className = feedr.className.replace("Unread", "");
-
- feedr.className = feedr.className + "Unread";
-
- if (is_selected) {
- feedr.className = feedr.className + "Selected";
- }
-
- }
+ feedctr.addClassName("Unread");
+ feedr.addClassName("Unread");
if (row_needs_hl &&
!getInitParam("theme_options").match('no_highlights')) {
cache_invalidate("F:" + id);
}
} else {
- feedctr.className = "feedCtrNoUnread";
- feedr.className = feedr.className.replace("Unread", "");
+ feedctr.removeClassName("Unread");
+ feedr.removeClassName("Unread");
}
}
}
try {
- console.log("resort_category: " + node + " CM=" + cat_mode);
+ //console.log("resort_category: " + node + " CM=" + cat_mode);
var by_unread = feedsSortByUnread();
var tmp_val = get_feed_entry_unread(list[i]);
var cur_val = get_feed_entry_unread(list[j]);
- var tmp_name = get_feed_entry_name(list[i]);
- var cur_name = get_feed_entry_name(list[j]);
+ var tmp_name = get_feed_entry_name(list[i]).toLowerCase();
+ var cur_name = get_feed_entry_name(list[j]).toLowerCase();
/* we don't want to match FEEDR-0 - e.g. Archived articles */
if ($("FCATLIST--1")) {
- var lists = document.getElementsByTagName("UL");
+ var lists = $$("#feedList ul[id*=FCATLIST]");
- for (var i = 0; i < lists.length; i++) {
- if (lists[i].id && lists[i].id.match("FCATLIST-")) {
- resort_category(lists[i], true);
- }
- }
+ lists.each(function(list) {
+ if (list.id != "FCATLIST--1") resort_category(list, true);
+ });
} else {
resort_category($("feedList"), false);
try {
- //console.log("hideOrShowFeeds: " + hide);
-
- if ($("FCATLIST--1")) {
-
- var lists = document.getElementsByTagName("UL");
-
- for (var i = 0; i < lists.length; i++) {
- if (lists[i].id && lists[i].id.match("FCATLIST-")) {
-
- var id = lists[i].id.replace("FCATLIST-", "");
- hideOrShowFeedsCategory(id, hide);
- }
+ if ($("FCATLIST--1")) {
+
+ var lists = $$("#feedList ul[id*=FCATLIST]");
+
+ lists.each(function(list) {
+ hideOrShowFeedsCategory(list.id.replace("FCATLIST-", ""), hide);
+ });
+
+ } else {
+ hideOrShowFeedsCategory(null, hide);
}
- } else {
- hideOrShowFeedsCategory(null, hide);
- }
-
} catch (e) {
exception_error("hideOrShowFeeds", e);
}
}
-function hideOrShowFeedsCategory(id, hide) {
-
+function hideOrShowFeedsCategory(cat_id, hide) {
try {
-
- var node = null;
- var cat_node = null;
- if (id) {
- node = $("FCATLIST-" + id);
- cat_node = $("FCAT-" + id);
+ var nodes;
+ var cat_node;
+
+ if (cat_id) {
+ nodes = $$("#FCATLIST-" + cat_id + " > li");
+ cat_node = $("FCAT-" + cat_id);
} else {
- node = $("feedList"); // no categories
+ nodes = $$("#feedList li");
}
- // console.log("hideOrShowFeedsCategory: " + node + " (" + hide + ")");
-
var cat_unread = 0;
-
- if (!node) {
- console.warn("hideOrShowFeeds: passed node is null, aborting");
- return;
- }
-
- // console.log("cat: " + node.id);
-
- if (node.hasChildNodes() && node.firstChild.nextSibling != false) {
- for (i = 0; i < node.childNodes.length; i++) {
- if (node.childNodes[i].nodeName != "LI") { continue; }
-
- if (node.childNodes[i].style != undefined) {
-
- var has_unread = (node.childNodes[i].className != "feed" &&
- node.childNodes[i].className != "label" &&
- !(!getInitParam("hide_read_shows_special") &&
- node.childNodes[i].className == "virt") &&
- node.childNodes[i].className != "error" &&
- node.childNodes[i].className != "tag");
-
- var has_error = node.childNodes[i].className.match("error");
-
- // console.log(node.childNodes[i].id + " --> " + has_unread);
-
- if (hide && !has_unread) {
- var id = node.childNodes[i].id;
- Effect.Fade(node.childNodes[i], {duration : 0.3,
- queue: { position: 'end', scope: 'FFADE-' + id, limit: 1 }});
- }
-
- if (!hide) {
- Element.show(node.childNodes[i]);
- }
-
- if (has_unread) {
- Element.show(node.childNodes[i]);
- cat_unread++;
- }
- //if (has_error) Element.hide(node.childNodes[i]);
- }
+ nodes.each(function(node) {
+
+ var is_unread = node.hasClassName("Unread") ||
+ (node.hasClassName("virt") &&
+ getInitParam("hide_read_shows_special")) ||
+ node.hasClassName("error");
+
+ if (hide && !is_unread) {
+ Effect.Fade(node, {duration : 0.3,
+ queue: { position: 'end', scope: 'FFADE-' + node.id, limit: 1 }});
+ } else {
+ Element.show(node);
+ ++cat_unread;
}
- }
-
- // console.log("end cat: " + node.id + " unread " + cat_unread);
- if (cat_node) {
+ });
- if (cat_unread == 0) {
- if (cat_node.style == undefined) {
- console.log("ERROR: supplied cat_node " + cat_node +
- " has no styles. WTF?");
- return;
- }
- if (hide) {
- //cat_node.style.display = "none";
- Effect.Fade(cat_node, {duration : 0.3,
- queue: { position: 'end', scope: 'CFADE-' + node.id, limit: 1 }});
- } else {
- cat_node.style.display = "list-item";
- }
+ if (cat_node) {
+ if (hide && cat_unread == 0) {
+ Effect.Fade(cat_node, {duration : 0.3,
+ queue: { position: 'end', scope: 'CFADE-' + cat_node.id, limit: 1 }});
} else {
- try {
- cat_node.style.display = "list-item";
- } catch (e) {
- console.log(e);
- }
+ Element.show(cat_node);
}
}
-// console.log("unread for category: " + cat_unread);
-
} catch (e) {
exception_error("hideOrShowFeedsCategory", e);
}
function getNextUnreadCat(id) {
try {
- var rows = $("feedList").getElementsByTagName("LI");
- var feeds = new Array();
+ var rows = $$("#feedList li[id*=FCAT]");
+ var unread_cats = [];
- var unread_only = true;
- var is_cat = true;
+ rows.each(function(row) {
+ var cat_id = row.id.replace("FCAT-", "");
- for (var i = 0; i < rows.length; i++) {
- if (rows[i].id.match("FCAT-")) {
- if (rows[i].id == "FCAT-" + id && is_cat || (Element.visible(rows[i]) && Element.visible(rows[i].parentNode))) {
+ if (Element.visible(row) && get_cat_unread(cat_id) > 0)
+ unread_cats.push(parseInt(cat_id));
+ });
- var cat_id = parseInt(rows[i].id.replace("FCAT-", ""));
-
- if (cat_id >= 0) {
- if (!unread_only || get_cat_unread(cat_id) > 0) {
- feeds.push(cat_id);
- }
- }
- }
- }
- }
+ console.log(unread_cats);
+
+ var idx = unread_cats.indexOf(id);
- var idx = feeds.indexOf(id);
- if (idx != -1 && idx < feeds.length) {
- return feeds[idx+1];
+ if (idx != -1 && idx < unread_cats.length-1) {
+ return unread_cats[idx+1];
} else {
- return feeds.shift();
+ return unread_cats[0];
}
} catch (e) {
// alert(id + " IC: " + is_cat + " D: " + direction + " U: " + unread_only);
- var rows = $("feedList").getElementsByTagName("LI");
+ var rows = $$("#feedList li");
var feeds = new Array();
for (var i = 0; i < rows.length; i++) {
if (rows[i].id == "FEEDR-" + id && !is_cat || (Element.visible(rows[i]) && Element.visible(rows[i].parentNode))) {
if (!unread_only ||
- (rows[i].className.match("Unread") || rows[i].id == "FEEDR-" + id)) {
+ (rows[i].hasClassName("Unread") || rows[i].id == "FEEDR-" + id)) {
feeds.push(rows[i].id.replace("FEEDR-", ""));
}
}
function clean_feed_selections() {
try {
- var feeds = $("feedList").getElementsByTagName("LI");
-
- for (var i = 0; i < feeds.length; i++) {
- if (feeds[i].id && feeds[i].id.match("FEEDR-")) {
- feeds[i].className = feeds[i].className.replace("Selected", "");
- }
- if (feeds[i].id && feeds[i].id.match("FCAT-")) {
- feeds[i].className = feeds[i].className.replace("Selected", "");
- }
- }
+ $$("#feedList li").invoke('removeClassName', 'Selected');
} catch (e) {
exception_error("clean_feed_selections", e);
}
notify_real(msg, no_hide, 4);
}
-function cleanSelected(element) {
- var content = $(element);
-
- for (i = 0; i < content.rows.length; i++) {
- content.rows[i].className = content.rows[i].className.replace("Selected", "");
- }
-}
-
function setCookie(name, value, lifetime, path, domain, secure) {
var d = false;
function toggleSelectRowById(sender, id) {
var row = $(id);
-
- if (sender.checked) {
- if (!row.className.match("Selected")) {
- row.className = row.className + "Selected";
- }
- } else {
- if (row.className.match("Selected")) {
- row.className = row.className.replace("Selected", "");
- }
- }
+ return toggleSelectRow(sender, row);
}
function toggleSelectListRow(sender) {
- var parent_row = sender.parentNode;
-
- if (sender.checked) {
- if (!parent_row.className.match("Selected")) {
- parent_row.className = parent_row.className + "Selected";
- }
- } else {
- if (parent_row.className.match("Selected")) {
- parent_row.className = parent_row.className.replace("Selected", "");
- }
- }
+ var row = sender.parentNode;
+ return toggleSelectRow(sender, row);
}
-function tSR(sender) {
- return toggleSelectRow(sender);
+function tSR(sender, row) {
+ return toggleSelectRow(sender, row);
}
-function toggleSelectRow(sender) {
- var parent_row = sender.parentNode.parentNode;
+function toggleSelectRow(sender, row) {
- if (sender.checked) {
- if (!parent_row.className.match("Selected")) {
- parent_row.className = parent_row.className + "Selected";
- }
- } else {
- if (parent_row.className.match("Selected")) {
- parent_row.className = parent_row.className.replace("Selected", "");
- }
- }
+ if (!row) row = sender.parentNode.parentNode;
+
+ if (sender.checked && !row.hasClassName('Selected'))
+ row.addClassName('Selected');
+ else
+ row.removeClassName('Selected');
}
function checkboxToggleElement(elem, id) {
}
if (cb) {
- var issel = row.className.match("Selected");
+ var issel = row.hasClassName("Selected");
if (mode == "all" && !issel) {
- row.className += "Selected";
+ row.addClassName("Selected");
cb.checked = true;
} else if (mode == "none" && issel) {
- row.className = row.className.replace("Selected", "");
+ row.removeClassName("Selected");
cb.checked = false;
} else if (mode == "invert") {
if (issel) {
- row.className = row.className.replace("Selected", "");
+ row.removeClassName("Selected");
cb.checked = false;
} else {
- row.className += "Selected";
+ row.addClassName("Selected");
cb.checked = true;
}
}
var elem_rows = $(id).rows;
for (i = 0; i < elem_rows.length; i++) {
- if (elem_rows[i].className.match("Selected")) {
+ if (elem_rows[i].hasClassName("Selected")) {
var bare_id = elem_rows[i].id.replace(/^[A-Z]*?-/, "");
rows.push(bare_id);
}
if (!$feed_title) $feed_title = getFeedTitle($link, $feed_id, false);
if (!$unread) $unread = getFeedUnread($link, $feed_id);
- if ($unread > 0) $class .= "Unread";
+ if ($unread > 0) $class .= " Unread";
if (!$icon_file) $icon_file = getFeedIcon($feed_id);
print "<span $rtl_tag id=\"FEEDN-$feed_id\">$feed</span>";
if ($unread != 0) {
- $fctr_class = "class=\"feedCtrHasUnread\"";
+ $fctr_class = "class=\"feedCtr Unread\"";
} else {
- $fctr_class = "class=\"feedCtrNoUnread\"";
+ $fctr_class = "class=\"feedCtr\"";
}
print " <span $rtl_tag $fctr_class id=\"FEEDCTR-$feed_id\">
$collapse_pic = "cat-collapse.png";
}
- $catctr_class = ($cat_unread > 0) ? "catCtrHasUnread" : "catCtrNoUnread";
+ $catctr_class = ($cat_unread > 0) ? "catCtr Unread" : "catCtr";
if ($can_browse) {
$browse_cat_link = "onclick=\"javascript:viewCategory($cat_id)\"";
}
if ($actid == $feed_id) {
- $class .= "Selected";
+ $class .= " Selected";
}
$total_unread += $unread;
}
if ($line["unread"] == "t" || $line["unread"] == "1") {
- $class .= "Unread";
+ $class .= " Unread";
++$num_unread;
$is_unread = true;
} else {
}
}
- if ($is_unread) {
- $add_class = "Unread";
- } else {
- $add_class = "";
- }
-
$expand_cdm = get_pref($link, 'CDM_EXPANDED');
$mouseover_attrs = "onmouseover='postMouseIn($id)'
print "</div>";
print "<input type=\"checkbox\" onclick=\"toggleSelectRowById(this,
- 'RROW-$id')\" class=\"feedCheckBox\" id=\"RCHK-$id\"/>";
+ 'RROW-$id')\" id=\"RCHK-$id\"/>";
print "$marked_pic";
print "$published_pic";
$edit_uid = $_REQUEST["id"];
if ($subop == "edit" && $uid != $edit_uid) {
- $class .= "Grayed";
+ $class .= " Grayed";
$this_row_id = "";
} else {
$this_row_id = "id=\"UMRR-$uid\"";
/* clean selection from all tabs */
- var tabs_holder = $("prefTabs");
- var tab = tabs_holder.firstChild;
-
- while (tab) {
- if (tab.className && tab.className.match("prefsTabSelected")) {
- tab.className = "prefsTab";
- }
- tab = tab.nextSibling;
- }
+ $$("#prefTabs div").invoke('removeClassName', 'Selected');
/* mark new tab as selected */
- tab = $(id + "Tab");
-
- if (tab) {
- if (!tab.className.match("Selected")) {
- tab.className = tab.className + "Selected";
- }
- }
+ $(id + "Tab").addClassName("Selected");
active_tab = id;
color : #4684ff;
}
-ul.feedList li.feedCatSelected {
+ul.feedList li.feedCat.Selected {
margin : 0px;
padding : 3px 0px 3px 0px;
color : #4684ff;
font-size : 12px;
}
-ul.feedList li.feedCatSelected span.catTitle {
+ul.feedList li.feedCat.Selected span.catTitle {
color : #4684ff;
cursor : pointer;
}
vertical-align : bottom;
}
-li.feedUnread,
-li.errorUnread,
-li.labelUnread,
-li.virtUnread,
-li.tagUnread {
+li.feed.Unread,
+li.error.Unread,
+li.label.Unread,
+li.virt.Unread,
+li.tag.Unread {
font-weight : bold;
}
-li.errorSelected span.feedlink,
+li.error.Selected span.feedlink,
li.error span.feedlink,
-li.errorUnread span.feedlink,
-li.errorUnreadSelected span.feedlink {
+li.error.Unread span.feedlink,
+li.error.Unread.Selected span.feedlink {
color : #f04040;
}
-li.feedSelected span.feedlink,
-li.labelSelected span.feedlink,
-li.virtSelected span.feedlink,
-li.tagSelected span.feedlink {
+li.feed.Selected span.feedlink,
+li.label.Selected span.feedlink,
+li.virt.Selected span.feedlink,
+li.tag.Selected span.feedlink {
color : #4684ff;
}
-li.feedUnreadSelected span.feedlink,
-li.labelUnreadSelected span.feedlink,
-li.virtUnreadSelected span.feedlink,
-li.tagUnreadSelected span.feedlink {
+li.feed.Unread.Selected span.feedlink,
+li.label.Unread.Selected span.feedlink,
+li.virt.Unread.Selected span.feedlink,
+li.tag.Unread.Selected span.feedlink {
color : #4684ff;
}
-li.feedUnreadSelected,
-li.errorUnreadSelected,
-li.labelUnreadSelected,
-li.virtUnreadSelected,
-li.tagUnreadSelected {
+li.feed.Unread.Selected,
+li.error.Unread.Selected,
+li.label.Unread.Selected,
+li.virt.Unread.Selected,
+li.tag.Unread.Selected {
font-weight : bold;
}
color : #4684ff;
}
-.evenUnreadSelected, .evenSelectedUnread, .evenUnreadSelected td,
- .evenSelectedUnread td {
+.even.Unread.Selected, .even.Unread.Selected td {
background-color : #fff7d5;
font-weight : bold;
border-width : 0px 0px 1px 0px;
border-color : #e7d796;
}
-.oddUnreadSelected, .oddSelectedUnread, .oddUnreadSelected td,
- .oddSelectedUnread td {
+.odd.Unread.Selected, .odd.Unread.Selected td {
background-color : #fff7d5;
font-weight : bold;
border-width : 0px 0px 1px 0px;
border-color : #e7d796;
}
-.evenSelected, .evenSelected td {
+.even.Selected, .even.Selected td {
background-color : #fff7d5;
border-width : 0px 0px 1px 0px;
border-style : solid;
border-collapse : collapse;
}
-.oddSelected, .oddSelected td {
+.odd.Selected, .odd.Selected td {
background-color : #fff7d5;
border-width : 0px 0px 1px 0px;
border-style : solid;
border-collapse : collapse;
}
-.evenGrayed, .evenGrayed td {
+.even.Grayed, .even.Grayed td {
background-color : #f0f0f0;
color : #909090;
border-width : 0px 0px 1px 0px;
border-collapse : collapse;
}
-.oddGrayed {
+.odd.Grayed {
color : #909090;
}
border-collapse : collapse;
}
-.evenUnread, .evenUnread td {
+.even.Unread, .even.Unread td {
background-color : #f0f0f0;
font-weight : bold;
border-width : 0px 0px 1px 0px;
border-collapse : collapse;
}
-.oddUnread, .oddUnread td {
+.odd.Unread, .odd.Unread td {
font-weight : bold;
border-width : 0px 0px 1px 0px;
border-style : solid;
cursor : pointer;
}
-div.prefsTabSelected:hover {
+div.prefsTab.Selected:hover {
cursor : pointer;
}
height : 30px;
}
-div.prefsTabSelected {
+div.prefsTab.Selected {
float : left;
border-width : 1px 1px 0px 1px;
border-color : #88b0f0;
right : 2px;
}
-.catCtrHasUnread, .feedCtrHasUnread {
+.catCtr.Unread, .feedCtr.Unread {
font-weight : bold;
color : #707070;
+ display : inline;
}
-.catCtrNoUnread, .feedCtrNoUnread {
+.catCtr, .feedCtr {
display : none;
}
if (!is_cat) {
var feedr = $("FEEDR-" + feed_id);
- if (feedr && !feedr.className.match("Selected")) {
- feedr.className = feedr.className + "Selected";
+ if (feedr) {
+ feedr.addClassName("Selected");
}
} else {
var feedr = $("FCAT-" + feed_id);
- if (feedr && !feedr.className.match("Selected")) {
- feedr.className = feedr.className + "Selected";
+ if (feedr) {
+ feedr.addClassName("Selected");
}
}
if (!crow) return;
- var article_is_unread = crow.className.match("Unread");
+ var article_is_unread = crow.hasClassName("Unread");
- crow.className = crow.className.replace("Unread", "");
+ crow.removeClassName("Unread");
selectArticles('none');
query = query + "&cids=" + cids_to_request.toString();
var crow = $("RROW-" + id);
- var article_is_unread = crow.className.match("Unread");
+ var article_is_unread = crow.hasClassName("Unread");
active_post_id = id;
showArticleInHeadlines(id);
try {
var cb = $("RCHK-" + id);
-
var row = $("RROW-" + id);
- if (row) {
- var nc = row.className;
-
- if (!nc.match("Selected")) {
- nc = nc + "Selected";
- if (cb) {
- cb.checked = true;
- }
- // In CDM basically last selected article == active article
- if (isCdmMode()) active_post_id = id;
+ if (row) {
+ if (row.hasClassName('Selected')) {
+ row.removeClassName('Selected');
+ if (cb) cb.checked = false;
} else {
- nc = nc.replace("Selected", "");
- if (cb) {
- cb.checked = false;
- }
-
+ row.addClassName('Selected');
+ if (cb) cb.checked = true;
}
-
- row.className = nc;
}
} catch (e) {
exception_error("toggleSelected", e);
var row = $("RROW-" + id);
if (row) {
- var nc = row.className;
- var is_selected = row.className.match("Selected");
- nc = nc.replace("Unread", "");
- nc = nc.replace("Selected", "");
-
- // since we are removing selection from the object, uncheck
- // corresponding checkbox
-
- var cb = $("RCHK-" + id);
- if (cb) {
- cb.checked = false;
- }
-
- // NOTE: I'm not sure that resetting selection here is a feature -fox
-
if (cmode == undefined || cmode == 2) {
- if (row.className.match("Unread")) {
- row.className = nc;
+ if (row.hasClassName("Unread")) {
+ row.removeClassName("Unread");
if (effect) {
new Effect.Highlight(row, {duration: 1, startcolor: "#fff7d5",
}
} else {
- row.className = nc + "Unread";
+ row.addClassName("Unread");
}
if (db) {
}
} else if (cmode == 0) {
- row.className = nc;
+
+ row.removeClassName("Unread");
if (effect) {
new Effect.Highlight(row, {duration: 1, startcolor: "#fff7d5",
}
} else if (cmode == 1) {
- row.className = nc + "Unread";
+ row.addClassName("Unread");
if (db) {
db.execute("UPDATE articles SET unread = 1 "+
update_local_feedlist_counters();
- // Disable unmarking as selected for the time being (16.05.08) -fox
- if (is_selected) row.className = row.className + "Selected";
-
if (cmode == undefined) cmode = 2;
var query = "?op=rpc&subop=catchupSelected" +
for (i = 0; i < rows.length; i++) {
var row = $("RROW-" + rows[i]);
if (row) {
- var nc = row.className;
- nc = nc.replace("Unread", "");
- nc = nc.replace("Selected", "");
-
if (set_state == undefined) {
- if (row.className.match("Unread")) {
- row.className = nc + "Selected";
+ if (row.hasClassName("Unread")) {
+ row.removeClassName("Unread");
} else {
- row.className = nc + "UnreadSelected";
+ row.addClassName("Unread");
}
if (db) {
db.execute("UPDATE articles SET unread = NOT unread WHERE id = ?",
}
if (set_state == false) {
- row.className = nc + "Selected";
+ row.removeClassName("Unread");
+
if (db) {
db.execute("UPDATE articles SET unread = 0 WHERE id = ?",
[rows[i]]);
}
if (set_state == true) {
- row.className = nc + "UnreadSelected";
+ row.addClassName("Unread");
+
if (db) {
db.execute("UPDATE articles SET unread = 1 WHERE id = ?",
[rows[i]]);
}
function getSelectedArticleIds2() {
- var sel_articles = new Array();
- var children;
-
- var children = $("headlinesInnerContainer").childNodes;
+ var rv = [];
- for (i = 0; i < children.length; i++) {
- var child = children[i];
+ $$("#headlinesInnerContainer > div[id*=RROW][class*=Selected]").each(
+ function(child) {
+ rv.push(child.id.replace("RROW-", ""));
+ });
- if (child.id && child.id.match("RROW-") && child.className.match("Selected")) {
- var c_id = child.id.replace("RROW-", "");
- sel_articles.push(c_id);
- }
- }
-
- return sel_articles;
+ return rv;
}
function getLoadedArticleIds() {
- var sel_articles = new Array();
+ var rv = [];
- var children = $("headlinesInnerContainer").childNodes;
+ var children = $$("#headlinesInnerContainer > div[id*=RROW-]");
- if (!children) return sel_articles;
+ children.each(function(child) {
+ rv.push(child.id.replace("RROW-", ""));
+ });
- for (i = 0; i < children.length; i++) {
- var child = children[i];
+ return rv;
- if (child.id && child.id.match("RROW-")) {
- var c_id = child.id.replace("RROW-", "");
- sel_articles.push(c_id);
- }
- }
-
- return sel_articles;
}
// mode = all,none,unread,invert
function selectArticles(mode) {
try {
- var children;
-
- var children = $("headlinesInnerContainer").childNodes;
+ var children = $$("#headlinesInnerContainer > div[id*=RROW]");
- for (i = 0; i < children.length; i++) {
- var child = children[i];
-
- if (child.id && child.id.match("RROW-")) {
- var aid = child.id.replace("RROW-", "");
-
- var cb = $("RCHK-" + aid);
-
- if (mode == "all") {
- if (!child.className.match("Selected")) {
- child.className = child.className + "Selected";
- cb.checked = true;
- }
- } else if (mode == "unread") {
- if (child.className.match("Unread") && !child.className.match("Selected")) {
- child.className = child.className + "Selected";
- cb.checked = true;
- }
- } else if (mode == "invert") {
- if (child.className.match("Selected")) {
- child.className = child.className.replace("Selected", "");
- cb.checked = false;
- } else {
- child.className = child.className + "Selected";
- cb.checked = true;
- }
+ children.each(function(child) {
+ var id = child.id.replace("RROW-", "");
+ var cb = $("RCHK-" + id);
+ if (mode == "all") {
+ child.addClassName("Selected");
+ cb.checked = true;
+ } else if (mode == "unread") {
+ if (child.hasClassName("Unread")) {
+ child.addClassName("Selected");
+ cb.checked = true;
} else {
- child.className = child.className.replace("Selected", "");
+ child.removeClassName("Selected");
cb.checked = false;
}
- }
- }
+ } else if (mode == "invert") {
+ if (child.hasClassName("Selected")) {
+ child.removeClassName("Selected");
+ cb.checked = false;
+ } else {
+ child.addClassName("Selected");
+ cb.checked = true;
+ }
+
+ } else {
+ child.removeClassName("Selected");
+ cb.checked = false;
+ }
+ });
} catch (e) {
exception_error("selectArticles", e);
var e = ctr.firstChild;
while (e) {
- if (e.className && e.className == "cdmArticleUnread" && e.id &&
+ if (e.className && e.hasClassName("Unread") && e.id &&
e.id.match("RROW-")) {
// article fits in viewport OR article is longer than viewport and
for (var i = 0; i < ids.length; i++) {
var e = $("RROW-" + ids[i]);
if (e) {
- e.className = e.className.replace("Unread", "");
+ e.removeClassName("Unread");
}
}
if (visible_ids[i] != getActiveArticleId()) {
var e = $("RROW-" + visible_ids[i]);
- if (e && e.className.match("Unread")) {
+ if (e && e.hasClassName("Unread")) {
ids_to_mark.push(visible_ids[i]);
}
} else {
if (visible_ids[i] != getActiveArticleId()) {
var e = $("RROW-" + visible_ids[i]);
- if (e && e.className.match("Unread")) {
+ if (e && e.hasClassName("Unread")) {
ids_to_mark.push(visible_ids[i]);
}
} else {
for (var i = 0; i < ids_to_mark.length; i++) {
var e = $("RROW-" + ids_to_mark[i]);
- e.className = e.className.replace("Unread", "");
+ e.removeClassName("Unread");
}
var query = "?op=rpc&subop=catchupSelected" +
if (e) {
if (i % 2 == 0) {
- e.className = e.className.replace("even", "odd");
+ e.removeClassName("even");
+ e.addClassName("odd");
} else {
- e.className = e.className.replace("odd", "even");
+ e.removeClassName("odd");
+ e.addClassName("even");
}
}
}
for (var i = 0; i < ids.length; i++) {
var elem = $("RROW-" + ids[i]);
- if (elem.className && elem.className.match("Selected") &&
+ if (elem.className && elem.hasClassName("Selected") &&
ids[i] != active_post_id) {
new Effect.Fade(elem, {duration : 0.5});
sel.push(ids[i]);
for (var i = 0; i < ids.length; i++) {
var elem = $("RROW-" + ids[i]);
- if (elem.className && !elem.className.match("Unread") &&
- !elem.className.match("Selected")) {
+ if (elem.className && !elem.hasClassName("Unread") &&
+ !elem.hasClassName("Selected")) {
new Effect.Fade(elem, {duration : 0.5});
} else {
var ids = [];
try {
- var tmp = getLoadedArticleIds();
-
- for (var i = 0; i < tmp.length; i++) {
- var elem = $("RROW-" + tmp[i]);
+
+ getLoadedArticleIds().each(function(id) {
+ var elem = $("RROW-" + id);
if (elem && Element.visible(elem))
- ids.push(tmp[i]);
- }
+ ids.push(id);
+ });
} catch (e) {
exception_error("getVisibleArticleIds", e);
var elem = $("RROW-" + id);
if (elem)
- elem.className = elem.className.replace("Unread", "");
+ elem.removeClassName("Unread");
var upd_img_pic = $("FUPDPIC-" + id);
upd_img_pic.src = "images/blank_icon.gif";
}
+ active_post_id = id;
+
var query = "?op=rpc&subop=catchupSelected" +
"&cmode=0&ids=" + param_escape(id);
function markHeadline(id) {
var row = $("RROW-" + id);
if (row) {
- var is_active = false;
-
- if (row.className.match("Active")) {
- is_active = true;
- }
- row.className = row.className.replace("Selected", "");
- row.className = row.className.replace("Active", "");
- row.className = row.className.replace("Insensitive", "");
-
- if (is_active) {
- row.className = row.className = "Active";
- }
-
var check = $("RCHK-" + id);
if (check) {
check.checked = true;
}
- row.className = row.className + "Selected";
-
+ row.addClassName("Selected");
}
}