use multiple classes to mark statuses, JS code cleanup
This commit is contained in:
parent
7d12b6c8be
commit
ca8e3d75f4
3
cdm.css
3
cdm.css
|
@ -50,8 +50,7 @@ div.cdmFooter {
|
|||
clear : both;
|
||||
}
|
||||
|
||||
.evenUnreadSelected div.cdmFooter, .oddUnreadSelected div.cdmFooter,
|
||||
.evenSelected div.cdmFooter, .oddSelected div.cdmFooter {
|
||||
.Selected div.cdmFooter {
|
||||
background-color : #FFF2BF;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
226
feedlist.js
226
feedlist.js
|
@ -243,13 +243,13 @@ function viewfeed(feed, subop, is_cat, offset) {
|
|||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -384,16 +384,12 @@ function isCatCollapsed(cat) {
|
|||
|
||||
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) {
|
||||
|
||||
|
@ -707,9 +703,9 @@ function parse_counters(reply, scheduled_call) {
|
|||
if (catctr) {
|
||||
catctr.innerHTML = "(" + ctr + ")";
|
||||
if (ctr > 0) {
|
||||
catctr.className = "catCtrHasUnread";
|
||||
catctr.addClassName("Unread");
|
||||
} else {
|
||||
catctr.className = "catCtrNoUnread";
|
||||
catctr.removeClassName("Unread");
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
@ -778,26 +774,16 @@ function parse_counters(reply, scheduled_call) {
|
|||
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')) {
|
||||
|
@ -807,8 +793,8 @@ function parse_counters(reply, scheduled_call) {
|
|||
cache_invalidate("F:" + id);
|
||||
}
|
||||
} else {
|
||||
feedctr.className = "feedCtrNoUnread";
|
||||
feedr.className = feedr.className.replace("Unread", "");
|
||||
feedctr.removeClassName("Unread");
|
||||
feedr.removeClassName("Unread");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -883,7 +869,7 @@ function resort_category(node, cat_mode) {
|
|||
|
||||
try {
|
||||
|
||||
console.log("resort_category: " + node + " CM=" + cat_mode);
|
||||
//console.log("resort_category: " + node + " CM=" + cat_mode);
|
||||
|
||||
var by_unread = feedsSortByUnread();
|
||||
|
||||
|
@ -896,8 +882,8 @@ function resort_category(node, cat_mode) {
|
|||
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 */
|
||||
|
||||
|
@ -924,13 +910,11 @@ function resort_feedlist() {
|
|||
|
||||
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);
|
||||
|
@ -941,19 +925,13 @@ function hideOrShowFeeds(hide) {
|
|||
|
||||
try {
|
||||
|
||||
//console.log("hideOrShowFeeds: " + hide);
|
||||
|
||||
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-")) {
|
||||
|
||||
var id = lists[i].id.replace("FCATLIST-", "");
|
||||
hideOrShowFeedsCategory(id, hide);
|
||||
}
|
||||
}
|
||||
lists.each(function(list) {
|
||||
hideOrShowFeedsCategory(list.id.replace("FCATLIST-", ""), hide);
|
||||
});
|
||||
|
||||
} else {
|
||||
hideOrShowFeedsCategory(null, hide);
|
||||
|
@ -964,95 +942,46 @@ function hideOrShowFeeds(hide) {
|
|||
}
|
||||
}
|
||||
|
||||
function hideOrShowFeedsCategory(id, hide) {
|
||||
|
||||
function hideOrShowFeedsCategory(cat_id, hide) {
|
||||
try {
|
||||
|
||||
var node = null;
|
||||
var cat_node = null;
|
||||
var nodes;
|
||||
var cat_node;
|
||||
|
||||
if (id) {
|
||||
node = $("FCATLIST-" + id);
|
||||
cat_node = $("FCAT-" + id);
|
||||
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;
|
||||
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("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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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";
|
||||
if (hide && cat_unread == 0) {
|
||||
Effect.Fade(cat_node, {duration : 0.3,
|
||||
queue: { position: 'end', scope: 'CFADE-' + node.id, limit: 1 }});
|
||||
queue: { position: 'end', scope: 'CFADE-' + cat_node.id, limit: 1 }});
|
||||
} else {
|
||||
cat_node.style.display = "list-item";
|
||||
}
|
||||
} 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);
|
||||
|
@ -1076,32 +1005,24 @@ function getFeedName(id, is_cat) {
|
|||
|
||||
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-", ""));
|
||||
console.log(unread_cats);
|
||||
|
||||
if (cat_id >= 0) {
|
||||
if (!unread_only || get_cat_unread(cat_id) > 0) {
|
||||
feeds.push(cat_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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) {
|
||||
|
@ -1114,7 +1035,7 @@ function getRelativeFeedId2(id, is_cat, direction, unread_only) {
|
|||
|
||||
// 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++) {
|
||||
|
@ -1123,7 +1044,7 @@ function getRelativeFeedId2(id, is_cat, direction, unread_only) {
|
|||
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-", ""));
|
||||
}
|
||||
}
|
||||
|
@ -1179,16 +1100,7 @@ function getRelativeFeedId2(id, is_cat, direction, unread_only) {
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
66
functions.js
66
functions.js
|
@ -197,14 +197,6 @@ function notify_info(msg, no_hide) {
|
|||
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;
|
||||
|
@ -306,48 +298,26 @@ function gotoExportOpml() {
|
|||
|
||||
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) {
|
||||
|
@ -1516,21 +1486,21 @@ function selectTableRows(id, mode) {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -1551,7 +1521,7 @@ function getSelectedTableRowIds(id) {
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -1730,9 +1730,9 @@
|
|||
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\">
|
||||
|
@ -4273,7 +4273,7 @@
|
|||
$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)\"";
|
||||
|
@ -5313,12 +5313,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
if ($is_unread) {
|
||||
$add_class = "Unread";
|
||||
} else {
|
||||
$add_class = "";
|
||||
}
|
||||
|
||||
$expand_cdm = get_pref($link, 'CDM_EXPANDED');
|
||||
|
||||
$mouseover_attrs = "onmouseover='postMouseIn($id)'
|
||||
|
@ -5344,7 +5338,7 @@
|
|||
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";
|
||||
|
|
18
prefs.js
18
prefs.js
|
@ -1111,25 +1111,11 @@ function selectTab(id, noupdate, subop) {
|
|||
|
||||
/* 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;
|
||||
|
||||
|
|
73
tt-rss.css
73
tt-rss.css
|
@ -149,14 +149,14 @@ ul.feedList span.catTitle:hover {
|
|||
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;
|
||||
}
|
||||
|
@ -181,40 +181,40 @@ ul.feedCatList img, ul.feedList img {
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -351,8 +351,7 @@ input.editbox {
|
|||
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;
|
||||
|
@ -360,8 +359,7 @@ input.editbox {
|
|||
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;
|
||||
|
@ -369,7 +367,7 @@ input.editbox {
|
|||
border-color : #e7d796;
|
||||
}
|
||||
|
||||
.evenSelected, .evenSelected td {
|
||||
.even.Selected, .even.Selected td {
|
||||
background-color : #fff7d5;
|
||||
border-width : 0px 0px 1px 0px;
|
||||
border-style : solid;
|
||||
|
@ -377,7 +375,7 @@ input.editbox {
|
|||
border-collapse : collapse;
|
||||
}
|
||||
|
||||
.oddSelected, .oddSelected td {
|
||||
.odd.Selected, .odd.Selected td {
|
||||
background-color : #fff7d5;
|
||||
border-width : 0px 0px 1px 0px;
|
||||
border-style : solid;
|
||||
|
@ -385,7 +383,7 @@ input.editbox {
|
|||
border-collapse : collapse;
|
||||
}
|
||||
|
||||
.evenGrayed, .evenGrayed td {
|
||||
.even.Grayed, .even.Grayed td {
|
||||
background-color : #f0f0f0;
|
||||
color : #909090;
|
||||
border-width : 0px 0px 1px 0px;
|
||||
|
@ -394,7 +392,7 @@ input.editbox {
|
|||
border-collapse : collapse;
|
||||
}
|
||||
|
||||
.oddGrayed {
|
||||
.odd.Grayed {
|
||||
color : #909090;
|
||||
}
|
||||
|
||||
|
@ -413,7 +411,7 @@ input.editbox {
|
|||
border-collapse : collapse;
|
||||
}
|
||||
|
||||
.evenUnread, .evenUnread td {
|
||||
.even.Unread, .even.Unread td {
|
||||
background-color : #f0f0f0;
|
||||
font-weight : bold;
|
||||
border-width : 0px 0px 1px 0px;
|
||||
|
@ -422,7 +420,7 @@ input.editbox {
|
|||
border-collapse : collapse;
|
||||
}
|
||||
|
||||
.oddUnread, .oddUnread td {
|
||||
.odd.Unread, .odd.Unread td {
|
||||
font-weight : bold;
|
||||
border-width : 0px 0px 1px 0px;
|
||||
border-style : solid;
|
||||
|
@ -557,7 +555,7 @@ div.prefsTab:hover {
|
|||
cursor : pointer;
|
||||
}
|
||||
|
||||
div.prefsTabSelected:hover {
|
||||
div.prefsTab.Selected:hover {
|
||||
cursor : pointer;
|
||||
}
|
||||
|
||||
|
@ -579,7 +577,7 @@ div.prefsTab {
|
|||
height : 30px;
|
||||
}
|
||||
|
||||
div.prefsTabSelected {
|
||||
div.prefsTab.Selected {
|
||||
float : left;
|
||||
border-width : 1px 1px 0px 1px;
|
||||
border-color : #88b0f0;
|
||||
|
@ -1262,12 +1260,13 @@ div.return a:hover {
|
|||
right : 2px;
|
||||
}
|
||||
|
||||
.catCtrHasUnread, .feedCtrHasUnread {
|
||||
.catCtr.Unread, .feedCtr.Unread {
|
||||
font-weight : bold;
|
||||
color : #707070;
|
||||
display : inline;
|
||||
}
|
||||
|
||||
.catCtrNoUnread, .feedCtrNoUnread {
|
||||
.catCtr, .feedCtr {
|
||||
display : none;
|
||||
}
|
||||
|
||||
|
|
207
viewfeed.js
207
viewfeed.js
|
@ -69,13 +69,13 @@ function headlines_callback2(transport, feed_cur_page) {
|
|||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,9 +254,9 @@ function showArticleInHeadlines(id) {
|
|||
|
||||
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');
|
||||
|
||||
|
@ -420,7 +420,7 @@ function view(id) {
|
|||
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);
|
||||
|
@ -668,28 +668,16 @@ function toggleSelected(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.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);
|
||||
|
@ -712,24 +700,9 @@ function toggleUnread(id, cmode, effect) {
|
|||
|
||||
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",
|
||||
|
@ -738,7 +711,7 @@ function toggleUnread(id, cmode, effect) {
|
|||
}
|
||||
|
||||
} else {
|
||||
row.className = nc + "Unread";
|
||||
row.addClassName("Unread");
|
||||
}
|
||||
|
||||
if (db) {
|
||||
|
@ -747,7 +720,8 @@ function toggleUnread(id, cmode, effect) {
|
|||
}
|
||||
|
||||
} else if (cmode == 0) {
|
||||
row.className = nc;
|
||||
|
||||
row.removeClassName("Unread");
|
||||
|
||||
if (effect) {
|
||||
new Effect.Highlight(row, {duration: 1, startcolor: "#fff7d5",
|
||||
|
@ -761,7 +735,7 @@ function toggleUnread(id, cmode, effect) {
|
|||
}
|
||||
|
||||
} else if (cmode == 1) {
|
||||
row.className = nc + "Unread";
|
||||
row.addClassName("Unread");
|
||||
|
||||
if (db) {
|
||||
db.execute("UPDATE articles SET unread = 1 "+
|
||||
|
@ -772,9 +746,6 @@ function toggleUnread(id, cmode, effect) {
|
|||
|
||||
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" +
|
||||
|
@ -883,15 +854,11 @@ function selectionToggleUnread(set_state, callback_func, no_error) {
|
|||
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 = ?",
|
||||
|
@ -900,7 +867,8 @@ function selectionToggleUnread(set_state, callback_func, no_error) {
|
|||
}
|
||||
|
||||
if (set_state == false) {
|
||||
row.className = nc + "Selected";
|
||||
row.removeClassName("Unread");
|
||||
|
||||
if (db) {
|
||||
db.execute("UPDATE articles SET unread = 0 WHERE id = ?",
|
||||
[rows[i]]);
|
||||
|
@ -908,7 +876,8 @@ function selectionToggleUnread(set_state, callback_func, no_error) {
|
|||
}
|
||||
|
||||
if (set_state == true) {
|
||||
row.className = nc + "UnreadSelected";
|
||||
row.addClassName("Unread");
|
||||
|
||||
if (db) {
|
||||
db.execute("UPDATE articles SET unread = 1 WHERE id = ?",
|
||||
[rows[i]]);
|
||||
|
@ -1016,84 +985,65 @@ function selectionTogglePublished() {
|
|||
}
|
||||
|
||||
function getSelectedArticleIds2() {
|
||||
var sel_articles = new Array();
|
||||
|
||||
var children;
|
||||
var rv = [];
|
||||
|
||||
var children = $("headlinesInnerContainer").childNodes;
|
||||
$$("#headlinesInnerContainer > div[id*=RROW][class*=Selected]").each(
|
||||
function(child) {
|
||||
rv.push(child.id.replace("RROW-", ""));
|
||||
});
|
||||
|
||||
for (i = 0; i < children.length; i++) {
|
||||
var child = children[i];
|
||||
|
||||
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 > div[id*=RROW]");
|
||||
|
||||
var children = $("headlinesInnerContainer").childNodes;
|
||||
|
||||
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);
|
||||
children.each(function(child) {
|
||||
var id = child.id.replace("RROW-", "");
|
||||
var cb = $("RCHK-" + id);
|
||||
|
||||
if (mode == "all") {
|
||||
if (!child.className.match("Selected")) {
|
||||
child.className = child.className + "Selected";
|
||||
child.addClassName("Selected");
|
||||
cb.checked = true;
|
||||
}
|
||||
} else if (mode == "unread") {
|
||||
if (child.className.match("Unread") && !child.className.match("Selected")) {
|
||||
child.className = child.className + "Selected";
|
||||
if (child.hasClassName("Unread")) {
|
||||
child.addClassName("Selected");
|
||||
cb.checked = true;
|
||||
} else {
|
||||
child.removeClassName("Selected");
|
||||
cb.checked = false;
|
||||
}
|
||||
} else if (mode == "invert") {
|
||||
if (child.className.match("Selected")) {
|
||||
child.className = child.className.replace("Selected", "");
|
||||
if (child.hasClassName("Selected")) {
|
||||
child.removeClassName("Selected");
|
||||
cb.checked = false;
|
||||
} else {
|
||||
child.className = child.className + "Selected";
|
||||
child.addClassName("Selected");
|
||||
cb.checked = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
child.className = child.className.replace("Selected", "");
|
||||
child.removeClassName("Selected");
|
||||
cb.checked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
exception_error("selectArticles", e);
|
||||
|
@ -1349,7 +1299,7 @@ function cdmWatchdog() {
|
|||
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
|
||||
|
@ -1393,7 +1343,7 @@ function cdmWatchdog() {
|
|||
for (var i = 0; i < ids.length; i++) {
|
||||
var e = $("RROW-" + ids[i]);
|
||||
if (e) {
|
||||
e.className = e.className.replace("Unread", "");
|
||||
e.removeClassName("Unread");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1817,7 +1767,7 @@ function catchupRelativeToArticle(below) {
|
|||
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 {
|
||||
|
@ -1829,7 +1779,7 @@ function catchupRelativeToArticle(below) {
|
|||
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 {
|
||||
|
@ -1847,7 +1797,7 @@ function catchupRelativeToArticle(below) {
|
|||
|
||||
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" +
|
||||
|
@ -1958,9 +1908,11 @@ function fixHeadlinesOrder(ids) {
|
|||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2162,7 +2114,7 @@ function dismissSelectedArticles() {
|
|||
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]);
|
||||
|
@ -2190,8 +2142,8 @@ function dismissReadArticles() {
|
|||
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 {
|
||||
|
@ -2210,13 +2162,12 @@ function getVisibleArticleIds() {
|
|||
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);
|
||||
|
@ -2238,7 +2189,7 @@ function cdmClicked(event, id) {
|
|||
var elem = $("RROW-" + id);
|
||||
|
||||
if (elem)
|
||||
elem.className = elem.className.replace("Unread", "");
|
||||
elem.removeClassName("Unread");
|
||||
|
||||
var upd_img_pic = $("FUPDPIC-" + id);
|
||||
|
||||
|
@ -2248,6 +2199,8 @@ function cdmClicked(event, 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);
|
||||
|
||||
|
@ -2351,27 +2304,13 @@ function isCdmMode() {
|
|||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue