diff --git a/feedlist.js b/feedlist.js index 034900619..3634b87d7 100644 --- a/feedlist.js +++ b/feedlist.js @@ -67,7 +67,7 @@ function printFeedEntry(id, title, row_class, unread, icon) { function render_feedlist(data) { try { - var f = document.getElementById("feeds-frame"); + var f = $("feeds-frame"); f.innerHTML = data; // cache_invalidate("FEEDLIST"); // cache_inject("FEEDLIST", data, getInitParam("num_feeds")); @@ -175,7 +175,7 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) { var query = "backend.php?op=viewfeed&feed=" + feed + "&" + toolbar_query + "&subop=" + param_escape(subop); - if (document.getElementById("search_form")) { + if ($("search_form")) { var search_query = Form.serialize("search_form"); query = query + "&" + search_query; closeInfoBox(true); @@ -194,7 +194,7 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) { if (!activeFeedIsCat()) { - var feedlist = document.getElementById('feedList'); + var feedlist = $('feedList'); var next_unread_feed = getRelativeFeedId(feedlist, feed, "next", true); @@ -260,7 +260,7 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) { debug(query); - var container = document.getElementById("headlinesInnerContainer"); + var container = $("headlinesInnerContainer"); /* if (container && page_offset == 0 && !isCdmMode()) { new Effect.Fade(container, {duration: 1, to: 0.01, @@ -288,19 +288,19 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) { } if (cache_check) { - var f = document.getElementById("headlines-frame"); + var f = $("headlines-frame"); clean_feed_selections(); setActiveFeedId(feed, is_cat); if (!is_cat) { - var feedr = document.getElementById("FEEDR-" + feed); + var feedr = $("FEEDR-" + feed); if (feedr && !feedr.className.match("Selected")) { feedr.className = feedr.className + "Selected"; } } else { - var feedr = document.getElementById("FCAT-" + feed_id); + var feedr = $("FCAT-" + feed_id); if (feedr && !feedr.className.match("Selected")) { feedr.className = feedr.className + "Selected"; } @@ -335,7 +335,7 @@ function toggleCollapseCat_af(effect) { var elem = effect.element; var cat = elem.id.replace("FCATLIST-", ""); - var cap = document.getElementById("FCAP-" + cat); + var cap = $("FCAP-" + cat); if (Element.visible(elem)) { cap.innerHTML = cap.innerHTML.replace("…", ""); @@ -353,9 +353,9 @@ function toggleCollapseCat_af(effect) { function toggleCollapseCat(cat) { try { - var cat_elem = document.getElementById("FCAT-" + cat); - var cat_list = document.getElementById("FCATLIST-" + cat).parentNode; - var caption = document.getElementById("FCAP-" + cat); + var cat_elem = $("FCAT-" + cat); + var cat_list = $("FCATLIST-" + cat).parentNode; + var caption = $("FCAP-" + cat); /* if (cat_list.className.match("invisible")) { cat_list.className = ""; @@ -411,7 +411,7 @@ function toggleCollapseCat(cat) { function feedlist_dragsorted(ctr) { try { - var elem = document.getElementById("feedList"); + var elem = $("feedList"); var cats = elem.getElementsByTagName("LI"); var ordered_cats = new Array(); @@ -485,19 +485,19 @@ function feedlist_init() { function hide_footer_af(effect) { try { - var c = document.getElementById("content-frame"); + var c = $("content-frame"); if (c) { c.style.bottom = "0px"; - var ioa = document.getElementById("inline_orig_article"); + var ioa = $("inline_orig_article"); if (ioa) { ioa.height = c.offsetHeight; } } else { - var h = document.getElementById("headlines-frame"); + var h = $("headlines-frame"); if (h) { h.style.bottom = "0px"; @@ -526,14 +526,14 @@ function init_hidden_feedlist(theme) { if (theme != "" && theme != "compact") return; - var fl = document.getElementById("feeds-holder"); - var fh = document.getElementById("headlines-frame"); - var fc = document.getElementById("content-frame"); - var ft = document.getElementById("toolbar"); - var ff = document.getElementById("footer"); - var fhdr = document.getElementById("header"); + var fl = $("feeds-holder"); + var fh = $("headlines-frame"); + var fc = $("content-frame"); + var ft = $("toolbar"); + var ff = $("footer"); + var fhdr = $("header"); - var fbtn = document.getElementById("toggle_feeds_btn"); + var fbtn = $("toggle_feeds_btn"); if (fbtn) Element.show(fbtn); @@ -564,7 +564,7 @@ function init_collapsable_feedlist(theme) { if (theme != "" && theme != "compact" && theme != "graycube" && theme != "compat") return; - var fbtn = document.getElementById("collapse_feeds_btn"); + var fbtn = $("collapse_feeds_btn"); if (fbtn) Element.show(fbtn); @@ -647,7 +647,7 @@ function mouse_up_handler(e) { if (!selection_disabled) { document.onselectstart = null; - var e = document.getElementById("headlineActionsBody"); + var e = $("headlineActionsBody"); if (e) Element.hide(e); } diff --git a/functions.js b/functions.js index ff6075f11..e83952357 100644 --- a/functions.js +++ b/functions.js @@ -24,7 +24,7 @@ function exception_error(location, e, ext_info) { try { - var ebc = document.getElementById("xebContent"); + var ebc = $("xebContent"); if (ebc) { @@ -106,7 +106,7 @@ function open_article_callback(transport) { if (id) { id = id.firstChild.nodeValue; - if (!document.getElementById("headlinesList")) { + if (!$("headlinesList")) { window.setTimeout("toggleUnread(" + id + ", 0)", 100); } } @@ -148,7 +148,7 @@ function delay(gap) { var notify_hide_timerid = false; function hide_notify() { - var n = document.getElementById("notify"); + var n = $("notify"); if (n) { n.style.display = "none"; } @@ -165,8 +165,8 @@ function notify_real(msg, no_hide, n_type) { return; } - var n = document.getElementById("notify"); - var nb = document.getElementById("notify_body"); + var n = $("notify"); + var nb = $("notify_body"); if (!n || !nb) return; @@ -240,7 +240,7 @@ function printLockingError() { } function cleanSelected(element) { - var content = document.getElementById(element); + var content = $(element); for (i = 0; i < content.rows.length; i++) { content.rows[i].className = content.rows[i].className.replace("Selected", ""); @@ -248,7 +248,7 @@ function cleanSelected(element) { } function getVisibleUnreadHeadlines() { - var content = document.getElementById("headlinesList"); + var content = $("headlinesList"); var rows = new Array(); @@ -265,7 +265,7 @@ function getVisibleUnreadHeadlines() { function getVisibleHeadlineIds() { - var content = document.getElementById("headlinesList"); + var content = $("headlinesList"); var rows = new Array(); @@ -301,7 +301,7 @@ function getLastVisibleHeadlineId() { } function markHeadline(id) { - var row = document.getElementById("RROW-" + id); + var row = $("RROW-" + id); if (row) { var is_active = false; @@ -316,7 +316,7 @@ function markHeadline(id) { row.className = row.className = "Active"; } - var check = document.getElementById("RCHK-" + id); + var check = $("RCHK-" + id); if (check) { check.checked = true; @@ -328,7 +328,7 @@ function markHeadline(id) { } function getFeedIds() { - var content = document.getElementById("feedsList"); + var content = $("feedsList"); var rows = new Array(); @@ -398,7 +398,7 @@ function disableContainerChildren(id, disable, doc) { if (!doc) doc = document; - var container = doc.getElementById(id); + var container = $(id); if (!container) { //alert("disableContainerChildren: element " + id + " not found"); @@ -469,7 +469,7 @@ function parse_counters(reply, scheduled_call) { } if (t == "category") { - var catctr = document.getElementById("FCATCTR-" + id); + var catctr = $("FCATCTR-" + id); if (catctr) { catctr.innerHTML = "(" + ctr + ")"; if (ctr > 0) { @@ -481,12 +481,12 @@ function parse_counters(reply, scheduled_call) { continue; } - var feedctr = document.getElementById("FEEDCTR-" + id); - var feedu = document.getElementById("FEEDU-" + id); - var feedr = document.getElementById("FEEDR-" + id); - var feed_img = document.getElementById("FIMG-" + id); - var feedlink = document.getElementById("FEEDL-" + id); - var feedupd = document.getElementById("FLUPD-" + id); + var feedctr = $("FEEDCTR-" + id); + var feedu = $("FEEDU-" + id); + var feedr = $("FEEDR-" + id); + var feed_img = $("FIMG-" + id); + var feedlink = $("FEEDL-" + id); + var feedupd = $("FLUPD-" + id); if (updated && feedlink) { if (error) { @@ -581,7 +581,7 @@ function parse_counters(reply, scheduled_call) { setTimeout('updateFeedList(false, false)', 50); } } else { -/* var fl = document.getElementById("feeds-frame").innerHTML; +/* var fl = $("feeds-frame").innerHTML; if (fl) { cache_invalidate("FEEDLIST"); cache_inject("FEEDLIST", fl, getInitParam("num_feeds")); @@ -643,7 +643,7 @@ function all_counters_callback2(transport, async_call) { function get_feed_unread(id) { try { - return parseInt(document.getElementById("FEEDU-" + id).innerHTML); + return parseInt($("FEEDU-" + id).innerHTML); } catch (e) { return -1; } @@ -651,7 +651,7 @@ function get_feed_unread(id) { function get_cat_unread(id) { try { - var ctr = document.getElementById("FCATCTR-" + id).innerHTML; + var ctr = $("FCATCTR-" + id).innerHTML; ctr = ctr.replace("(", ""); ctr = ctr.replace(")", ""); return parseInt(ctr); @@ -669,7 +669,7 @@ function get_feed_entry_unread(elem) { } try { - return parseInt(document.getElementById("FEEDU-" + id).innerHTML); + return parseInt($("FEEDU-" + id).innerHTML); } catch (e) { return -1; } @@ -719,7 +719,7 @@ function resort_category(node) { function resort_feedlist() { debug("resort_feedlist"); - if (document.getElementById("FCATLIST--1")) { + if ($("FCATLIST--1")) { var lists = document.getElementsByTagName("UL"); @@ -730,7 +730,7 @@ function resort_feedlist() { } } else { - resort_category(document.getElementById("feedList")); + resort_category($("feedList")); } } @@ -774,7 +774,7 @@ function hideOrShowFeeds(hide) { debug("hideOrShowFeeds: " + hide); - if (document.getElementById("FCATLIST--1")) { + if ($("FCATLIST--1")) { var lists = document.getElementsByTagName("UL"); @@ -803,10 +803,10 @@ function hideOrShowFeedsCategory(id, hide) { var cat_node = null; if (id) { - node = document.getElementById("FCATLIST-" + id); - cat_node = document.getElementById("FCAT-" + id); + node = $("FCATLIST-" + id); + cat_node = $("FCAT-" + id); } else { - node = document.getElementById("feedList"); // no categories + node = $("feedList"); // no categories } // debug("hideOrShowFeedsCategory: " + node + " (" + hide + ")"); @@ -902,13 +902,13 @@ function selectTableRowById(elem_id, check_id, do_select) { try { - var row = document.getElementById(elem_id); + var row = $(elem_id); if (row) { selectTableRow(row, do_select); } - var check = document.getElementById(check_id); + var check = $(check_id); if (check) { check.checked = do_select; @@ -921,7 +921,7 @@ function selectTableRowById(elem_id, check_id, do_select) { function selectTableRowsByIdPrefix(content_id, prefix, check_prefix, do_select, classcheck, reset_others) { - var content = document.getElementById(content_id); + var content = $(content_id); if (!content) { alert("[selectTableRows] Element " + content_id + " not found."); @@ -936,7 +936,7 @@ function selectTableRowsByIdPrefix(content_id, prefix, check_prefix, do_select, selectTableRow(content.rows[i], do_select); var row_id = content.rows[i].id.replace(prefix, ""); - var check = document.getElementById(check_prefix + row_id); + var check = $(check_prefix + row_id); if (check) { check.checked = do_select; @@ -945,7 +945,7 @@ function selectTableRowsByIdPrefix(content_id, prefix, check_prefix, do_select, selectTableRow(content.rows[i], false); var row_id = content.rows[i].id.replace(prefix, ""); - var check = document.getElementById(check_prefix + row_id); + var check = $(check_prefix + row_id); if (check) { check.checked = false; @@ -956,7 +956,7 @@ function selectTableRowsByIdPrefix(content_id, prefix, check_prefix, do_select, selectTableRow(content.rows[i], false); var row_id = content.rows[i].id.replace(prefix, ""); - var check = document.getElementById(check_prefix + row_id); + var check = $(check_prefix + row_id); if (check) { check.checked = false; @@ -969,7 +969,7 @@ function selectTableRowsByIdPrefix(content_id, prefix, check_prefix, do_select, function getSelectedTableRowIds(content_id, prefix) { - var content = document.getElementById(content_id); + var content = $(content_id); if (!content) { alert("[getSelectedTableRowIds] Element " + content_id + " not found."); @@ -992,7 +992,7 @@ function getSelectedTableRowIds(content_id, prefix) { } function toggleSelectRowById(sender, id) { - var row = document.getElementById(id); + var row = $(id); if (sender.checked) { if (!row.className.match("Selected")) { @@ -1039,7 +1039,7 @@ function toggleSelectRow(sender) { function getNextUnreadCat(id) { try { - var rows = document.getElementById("feedList").getElementsByTagName("LI"); + var rows = $("feedList").getElementsByTagName("LI"); var feeds = new Array(); var unread_only = true; @@ -1077,7 +1077,7 @@ function getRelativeFeedId2(id, is_cat, direction, unread_only) { // alert(id + " IC: " + is_cat + " D: " + direction + " U: " + unread_only); - var rows = document.getElementById("feedList").getElementsByTagName("LI"); + var rows = $("feedList").getElementsByTagName("LI"); var feeds = new Array(); for (var i = 0; i < rows.length; i++) { @@ -1185,13 +1185,13 @@ function getRelativeFeedId(list, id, direction, unread_only) { } function showBlockElement(id, h_id) { - var elem = document.getElementById(id); + var elem = $(id); if (elem) { elem.style.display = "block"; if (h_id) { - elem = document.getElementById(h_id); + elem = $(h_id); if (elem) { elem.style.display = "none"; } @@ -1286,8 +1286,8 @@ function closeInfoBox(cleanup) { if (Element.visible("infoBoxShadow")) { Element.hide("dialog_overlay"); - var shadow = document.getElementById('infoBoxShadow'); - var box = document.getElementById('infoBoxShadow'); + var shadow = $('infoBoxShadow'); + var box = $('infoBoxShadow'); Element.hide(shadow); @@ -1341,8 +1341,8 @@ function infobox_callback2(transport) { Element.show("dialog_overlay"); } - var box = document.getElementById('infoBox'); - var shadow = document.getElementById('infoBoxShadow'); + var box = $('infoBox'); + var shadow = $('infoBoxShadow'); if (box) { box.innerHTML=transport.responseText; @@ -1355,7 +1355,7 @@ function infobox_callback2(transport) { /* FIXME this needs to be moved out somewhere */ - if (document.getElementById("tags_choices")) { + if ($("tags_choices")) { new Ajax.Autocompleter('tags_str', 'tags_choices', "backend.php?op=rpc&subop=completeTags", { tokens: ',', paramName: "search" }); @@ -1402,7 +1402,7 @@ function createFilter() { function toggleSubmitNotEmpty(e, submit_id) { try { - document.getElementById(submit_id).disabled = (e.value == "") + $(submit_id).disabled = (e.value == "") } catch (e) { exception_error("toggleSubmitNotEmpty", e); } @@ -1474,7 +1474,7 @@ function debug(msg) { debug_last_class = "even"; } - var c = document.getElementById('debug_output'); + var c = $('debug_output'); if (c && Element.visible(c)) { while (c.lastChild != 'undefined' && c.childNodes.length > 100) { c.removeChild(c.lastChild); @@ -1510,7 +1510,7 @@ function fatalError(code, msg, ext_info) { if (msg == "") msg = "Unknown error"; - var ebc = document.getElementById("xebContent"); + var ebc = $("xebContent"); if (ebc) { @@ -1541,9 +1541,9 @@ function getFeedName(id, is_cat) { var e; if (is_cat) { - e = document.getElementById("FCATN-" + id); + e = $("FCATN-" + id); } else { - e = document.getElementById("FEEDN-" + id); + e = $("FEEDN-" + id); } if (e) { return e.innerHTML.stripTags(); @@ -1602,7 +1602,7 @@ function filterDlgCheckAction(sender) { return; } - var action_param = document.getElementById("filter_dlg_param_box"); + var action_param = $("filter_dlg_param_box"); if (!action_param) { debug("filterDlgCheckAction: can't find action param box!"); @@ -1690,7 +1690,7 @@ function getRelativePostIds(id, limit) { debug("getRelativePostIds: " + id + " limit=" + limit); var ids = new Array(); - var container = document.getElementById("headlinesList"); + var container = $("headlinesList"); if (container) { var rows = container.rows; @@ -1773,7 +1773,7 @@ Position.Center = function(element, parent) { function labeltest_callback(transport) { try { - var container = document.getElementById('label_test_result'); + var container = $('label_test_result'); container.innerHTML = transport.responseText; if (!Element.visible(container)) { @@ -1789,7 +1789,7 @@ function labeltest_callback(transport) { function labelTest() { try { - var container = document.getElementById('label_test_result'); + var container = $('label_test_result'); var form = document.forms['label_edit_form']; @@ -1814,7 +1814,7 @@ function labelTest() { } function isCdmMode() { - return !document.getElementById("headlinesList"); + return !$("headlinesList"); } function getSelectedArticleIds2() { @@ -1830,7 +1830,7 @@ function getSelectedArticleIds2() { var ids = new Array(); for (var i = 0; i < rows.length; i++) { - var chk = document.getElementById("RCHK-" + rows[i]); + var chk = $("RCHK-" + rows[i]); if (chk && chk.checked) { ids.push(rows[i]); } @@ -1850,7 +1850,7 @@ function displayHelpInfobox(topic_id) { function focus_element(id) { try { - var e = document.getElementById(id); + var e = $(id); if (e) e.focus(); } catch (e) { exception_error("focus_element", e); @@ -1864,7 +1864,7 @@ function loading_set_progress(p) { debug("loading_set_progress : " + p + " (" + last_progress_point + ")"); - var o = document.getElementById("l_progress_i"); + var o = $("l_progress_i"); // o.style.width = (p * 2) + "px"; @@ -2011,8 +2011,8 @@ function labelFieldsCheck(elem) { function getSelectedFeedsFromBrowser() { - var list = document.getElementById("browseFeedList"); - if (!list) list = document.getElementById("browseBigFeedList"); + var list = $("browseFeedList"); + if (!list) list = $("browseBigFeedList"); var selected = new Array(); @@ -2021,7 +2021,7 @@ function getSelectedFeedsFromBrowser() { if (child.id && child.id.match("FBROW-")) { var id = child.id.replace("FBROW-", ""); - var cb = document.getElementById("FBCHK-" + id); + var cb = $("FBCHK-" + id); if (cb.checked) { selected.push(id); @@ -2037,8 +2037,8 @@ function updateFeedBrowser() { var query = "backend.php?op=rpc&subop=feedBrowser"; - var search = document.getElementById("feed_browser_search"); - var limit = document.getElementById("feed_browser_limit"); + var search = $("feed_browser_search"); + var limit = $("feed_browser_limit"); if (limit) { query = query + "&limit=" + limit[limit.selectedIndex].value; @@ -2054,10 +2054,10 @@ function updateFeedBrowser() { onComplete: function(transport) { notify(''); - var c = document.getElementById("browseFeedList"); + var c = $("browseFeedList"); var r = transport.responseXML.getElementsByTagName("content")[0]; var nr = transport.responseXML.getElementsByTagName("num-results")[0]; - var sb = document.getElementById("feed_browser_subscribe"); + var sb = $("feed_browser_subscribe"); if (c && r) { c.innerHTML = r.firstChild.nodeValue; diff --git a/offline.js b/offline.js index 2fc820941..cced40943 100644 --- a/offline.js +++ b/offline.js @@ -92,12 +92,12 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off setActiveFeedId(feed_id, is_cat); if (!is_cat) { - var feedr = document.getElementById("FEEDR-" + feed_id); + var feedr = $("FEEDR-" + feed_id); if (feedr && !feedr.className.match("Selected")) { feedr.className = feedr.className + "Selected"; } } else { - var feedr = document.getElementById("FCAT-" + feed_id); + var feedr = $("FCAT-" + feed_id); if (feedr && !feedr.className.match("Selected")) { feedr.className = feedr.className + "Selected"; } @@ -110,7 +110,7 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off disableContainerChildren("headlinesToolbar", false); Form.enable("main_toolbar_form"); - var f = document.getElementById("headlines-frame"); + var f = $("headlines-frame"); try { if (reply.offset == 0) { debug("resetting headlines scrollTop"); @@ -143,7 +143,7 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off var sel_none_link; var sel_inv_link; - if (document.getElementById("content-frame")) { + if ($("content-frame")) { sel_all_link = "javascript:selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, '', true)"; sel_unread_link = "javascript:selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, 'Unread', true)"; sel_none_link = "javascript:selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false)"; @@ -166,7 +166,7 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off tmp += ""; tmp += "
"; - if (document.getElementById("content-frame")) { + if ($("content-frame")) { tmp += ""; } @@ -291,7 +291,7 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off var content_preview = truncate_string(strip_tags(rs.fieldByName("content")), 100); - if (document.getElementById("content-frame")) { + if ($("content-frame")) { tmp += ""; @@ -413,12 +413,12 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off } if (offset == 0) { - var container = document.getElementById("headlines-frame"); + var container = $("headlines-frame"); container.innerHTML = tmp; } else { var ids = getSelectedArticleIds2(); - var container = document.getElementById("headlinesList"); + var container = $("headlinesList"); container.innerHTML = container.innerHTML + tmp; for (var i = 0; i < ids.length; i++) { @@ -571,10 +571,10 @@ function init_offline() { Element.hide("topLinksOnline"); Element.show("topLinksOffline"); - var tb_form = document.getElementById("main_toolbar_form"); + var tb_form = $("main_toolbar_form"); Element.hide(tb_form.update); - var chooser = document.getElementById("quickMenuChooser"); + var chooser = $("quickMenuChooser"); chooser.disabled = true; var rs = db.execute("SELECT key, value FROM init_params"); @@ -792,12 +792,12 @@ function update_offline_data(stage) { function set_feedlist_counter(id, ctr, is_cat) { try { - var feedctr = document.getElementById("FEEDCTR-" + id); - var feedu = document.getElementById("FEEDU-" + id); - var feedr = document.getElementById("FEEDR-" + id); + var feedctr = $("FEEDCTR-" + id); + var feedu = $("FEEDU-" + id); + var feedr = $("FEEDR-" + id); if (is_cat) { - var catctr = document.getElementById("FCATCTR-" + id); + var catctr = $("FCATCTR-" + id); if (catctr) { catctr.innerHTML = "(" + ctr + ")"; if (ctr > 0) { diff --git a/prefs.js b/prefs.js index 3a43851df..fc7d1db36 100644 --- a/prefs.js +++ b/prefs.js @@ -13,7 +13,7 @@ var mouse_is_down = false; function replace_pubkey_callback(transport) { try { - var link = document.getElementById("pubGenAddress"); + var link = $("pubGenAddress"); if (transport.responseXML) { @@ -42,7 +42,7 @@ function feedlist_callback2(transport) { try { - var container = document.getElementById('prefContent'); + var container = $('prefContent'); container.innerHTML=transport.responseText; selectTab("feedConfig", true); @@ -72,7 +72,7 @@ function dlg_frefresh_callback(transport) { } function filterlist_callback2(transport) { - var container = document.getElementById('prefContent'); + var container = $('prefContent'); container.innerHTML=transport.responseText; if (typeof correctPNG != 'undefined') { correctPNG(); @@ -83,8 +83,8 @@ function filterlist_callback2(transport) { function init_label_inline_editor() { try { - if (document.getElementById("prefLabelList")) { - var elems = document.getElementById("prefLabelList").getElementsByTagName("SPAN"); + if ($("prefLabelList")) { + var elems = $("prefLabelList").getElementsByTagName("SPAN"); for (var i = 0; i < elems.length; i++) { if (elems[i].id && elems[i].id.match("LILT-")) { @@ -108,7 +108,7 @@ function labellist_callback2(transport) { try { - var container = document.getElementById('prefContent'); + var container = $('prefContent'); closeInfoBox(); container.innerHTML=transport.responseText; @@ -127,7 +127,7 @@ function labellist_callback2(transport) { function userlist_callback2(transport) { try { - var container = document.getElementById('prefContent'); + var container = $('prefContent'); if (transport.readyState == 4) { container.innerHTML=transport.responseText; notify(""); @@ -140,7 +140,7 @@ function userlist_callback2(transport) { function prefslist_callback2(transport) { try { - var container = document.getElementById('prefContent'); + var container = $('prefContent'); container.innerHTML=transport.responseText; notify(""); remove_splash(); @@ -170,7 +170,7 @@ function changepass_callback2(transport) { notify_error(transport.responseText.replace("ERROR: ", "")); } else { notify_info(transport.responseText); - var warn = document.getElementById("default_pass_warning"); + var warn = $("default_pass_warning"); if (warn) warn.style.display = "none"; } @@ -184,8 +184,8 @@ function changepass_callback2(transport) { function init_cat_inline_editor() { try { - if (document.getElementById("prefFeedCatList")) { - var elems = document.getElementById("prefFeedCatList").getElementsByTagName("SPAN"); + if ($("prefFeedCatList")) { + var elems = $("prefFeedCatList").getElementsByTagName("SPAN"); for (var i = 0; i < elems.length; i++) { if (elems[i].id && elems[i].id.match("FCATT-")) { @@ -214,11 +214,11 @@ function updateFeedList(sort_key) { try { - var feed_search = document.getElementById("feed_search"); + var feed_search = $("feed_search"); var search = ""; if (feed_search) { search = feed_search.value; } - var slat = document.getElementById("show_last_article_times"); + var slat = $("show_last_article_times"); var slat_checked = false; if (slat) { @@ -243,7 +243,7 @@ function updateUsersList(sort_key) { try { - var user_search = document.getElementById("user_search"); + var user_search = $("user_search"); var search = ""; if (user_search) { search = user_search.value; } @@ -296,7 +296,7 @@ function addFeed() { try { - var link = document.getElementById("fadd_link"); + var link = $("fadd_link"); if (link.value.length == 0) { alert(__("Error: No feed URL given.")); @@ -325,7 +325,7 @@ function addFeed() { function addFeedCat() { - var cat = document.getElementById("fadd_cat"); + var cat = $("fadd_cat"); if (cat.value.length == 0) { alert(__("Can't add category: no name specified.")); @@ -695,8 +695,8 @@ function removeSelectedFeedCats() { function feedEditCancel() { try { - document.getElementById("subscribe_to_feed_btn").disabled = false; - document.getElementById("top25_feeds_btn").disabled = false; + $("subscribe_to_feed_btn").disabled = false; + $("top25_feeds_btn").disabled = false; } catch (e) { // this button is not always available, no-op if not found } @@ -744,7 +744,7 @@ function userEditCancel() { function filterEditCancel() { try { - document.getElementById("create_filter_btn").disabled = false; + $("create_filter_btn").disabled = false; selectPrefRows('filter', false); // cleanup feed selection } catch (e) { } @@ -795,7 +795,7 @@ function filterEditSave() { closeInfoBox(); - document.getElementById("create_filter_btn").disabled = false; + $("create_filter_btn").disabled = false; new Ajax.Request(query, { onComplete: function(transport) { @@ -969,7 +969,7 @@ function editSelectedFeeds() { function piggie(enable) { if (enable) { debug("I LOVEDED IT!"); - var piggie = document.getElementById("piggie"); + var piggie = $("piggie"); Element.show(piggie); Position.Center(piggie); @@ -980,7 +980,7 @@ function piggie(enable) { function validateOpmlImport() { - var opml_file = document.getElementById("opml_file"); + var opml_file = $("opml_file"); if (opml_file.value.length == 0) { alert(__("No OPML file to upload.")); @@ -993,7 +993,7 @@ function validateOpmlImport() { function updateFilterList(sort_key) { try { - var filter_search = document.getElementById("filter_search"); + var filter_search = $("filter_search"); var search = ""; if (filter_search) { search = filter_search.value; } @@ -1016,7 +1016,7 @@ function updateLabelList(sort_key) { try { - var label_search = document.getElementById("label_search"); + var label_search = $("label_search"); var search = ""; if (label_search) { search = label_search.value; } @@ -1054,7 +1054,7 @@ function selectTab(id, noupdate, subop) { try { try { - var c = document.getElementById('prefContent'); + var c = $('prefContent'); c.scrollTop = 0; } catch (e) { }; @@ -1088,7 +1088,7 @@ function selectTab(id, noupdate, subop) { /* clean selection from all tabs */ - var tabs_holder = document.getElementById("prefTabs"); + var tabs_holder = $("prefTabs"); var tab = tabs_holder.firstChild; while (tab) { @@ -1100,7 +1100,7 @@ function selectTab(id, noupdate, subop) { /* mark new tab as selected */ - tab = document.getElementById(id + "Tab"); + tab = $(id + "Tab"); if (tab) { if (!tab.className.match("Selected")) { @@ -1175,7 +1175,7 @@ function init_second_stage() { try { active_tab = getInitParam("prefs_active_tab"); - if (!document.getElementById(active_tab+"Tab")) active_tab = "genConfig"; + if (!$(active_tab+"Tab")) active_tab = "genConfig"; if (!active_tab || active_tab == '0') active_tab = "genConfig"; document.onkeydown = pref_hotkey_handler; @@ -1238,7 +1238,7 @@ function categorizeSelectedFeeds() { var sel_rows = getSelectedFeeds(); - var cat_sel = document.getElementById("sfeed_set_fcat"); + var cat_sel = $("sfeed_set_fcat"); var cat_id = cat_sel[cat_sel.selectedIndex].value; if (sel_rows.length > 0) { @@ -1481,7 +1481,7 @@ function pref_hotkey_handler(e) { "feed_search", "filter_search", "user_search", "feed_browser_search"); for (var i = 0; i < search_boxes.length; i++) { - var elem = document.getElementById(search_boxes[i]); + var elem = $(search_boxes[i]); if (elem) { focus_element(search_boxes[i]); return false; @@ -1532,27 +1532,27 @@ function pref_hotkey_handler(e) { hotkey_prefix = false; - if (keycode == 49 && document.getElementById("genConfigTab")) { // 1 + if (keycode == 49 && $("genConfigTab")) { // 1 selectTab("genConfig"); return false; } - if (keycode == 50 && document.getElementById("feedConfigTab")) { // 2 + if (keycode == 50 && $("feedConfigTab")) { // 2 selectTab("feedConfig"); return false; } - if (keycode == 51 && document.getElementById("filterConfigTab")) { // 4 + if (keycode == 51 && $("filterConfigTab")) { // 4 selectTab("filterConfig"); return false; } - if (keycode == 52 && document.getElementById("labelConfigTab")) { // 5 + if (keycode == 52 && $("labelConfigTab")) { // 5 selectTab("labelConfig"); return false; } - if (keycode == 53 && document.getElementById("userConfigTab")) { // 6 + if (keycode == 53 && $("userConfigTab")) { // 6 selectTab("userConfig"); return false; } @@ -1563,7 +1563,7 @@ function pref_hotkey_handler(e) { } - if (document.getElementById("piggie")) { + if ($("piggie")) { if (seq.match("807371717369")) { seq = ""; @@ -1586,10 +1586,10 @@ function pref_hotkey_handler(e) { function editFeedCats() { try { - document.getElementById("subscribe_to_feed_btn").disabled = true; + $("subscribe_to_feed_btn").disabled = true; try { - document.getElementById("top25_feeds_btn").disabled = true; + $("top25_feeds_btn").disabled = true; } catch (e) { // this button is not always available, no-op if not found } @@ -1736,7 +1736,7 @@ function validatePrefsSave() { function feedActionChange() { try { - var chooser = document.getElementById("feedActionChooser"); + var chooser = $("feedActionChooser"); var opid = chooser[chooser.selectedIndex].value; chooser.selectedIndex = 0; @@ -1961,7 +1961,7 @@ function feedsEditSave() { function batchFeedsToggleField(cb, elem, label) { try { var f = document.forms["batch_edit_feed_form"]; - var l = document.getElementById(label); + var l = $(label); if (cb.checked) { f[elem].disabled = false; @@ -2026,7 +2026,7 @@ function labelColorAsk(id, kind) { selectPrefRows('label', false); - var e = document.getElementById("LICID-" + id); + var e = $("LICID-" + id); if (e) { if (kind == "fg") { @@ -2047,7 +2047,7 @@ function labelColorAsk(id, kind) { function colorPicker(id, fg, bg) { try { - var picker = document.getElementById("colorPicker-" + id); + var picker = $("colorPicker-" + id); if (picker) Element.show(picker); @@ -2058,9 +2058,9 @@ function colorPicker(id, fg, bg) { function colorPickerHideAll() { try { - if (document.getElementById("prefLabelList")) { + if ($("prefLabelList")) { - var elems = document.getElementById("prefLabelList").getElementsByTagName("DIV"); + var elems = $("prefLabelList").getElementsByTagName("DIV"); for (var i = 0; i < elems.length; i++) { if (elems[i].id && elems[i].id.match("colorPicker-")) { @@ -2081,7 +2081,7 @@ function colorPickerDo(id, fg, bg) { "&ids=" + param_escape(id) + "&fg=" + param_escape(fg) + "&bg=" + param_escape(bg); - var e = document.getElementById("LICID-" + id); + var e = $("LICID-" + id); if (e) { e.style.color = fg; diff --git a/tt-rss.js b/tt-rss.js index 90ac934d7..d6a95eddd 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -65,7 +65,7 @@ function toggleTags(show_all) { debug("toggleTags: " + show_all + "; " + display_tags); - var p = document.getElementById("dispSwitchPrompt"); + var p = $("dispSwitchPrompt"); if (!show_all && !display_tags) { displayDlg("printTagCloud"); @@ -89,7 +89,7 @@ function toggleTags(show_all) { function dlg_frefresh_callback(transport, deleted_feed) { if (getActiveFeedId() == deleted_feed) { - var h = document.getElementById("headlines-frame"); + var h = $("headlines-frame"); if (h) { h.innerHTML = "
" + __('No feed selected.') + "
"; } @@ -260,7 +260,7 @@ function updateFeedList(silent, fetch) { if (fetch) query_str = query_str + "&fetch=yes"; -// var feeds_frame = document.getElementById("feeds-frame"); +// var feeds_frame = $("feeds-frame"); // feeds_frame.src = query_str; debug("updateFeedList Q=" + query_str); @@ -324,7 +324,7 @@ function timeout() { } function resetSearch() { - var searchbox = document.getElementById("searchbox") + var searchbox = $("searchbox") if (searchbox.value != "" && getActiveFeedId()) { searchbox.value = ""; @@ -421,12 +421,12 @@ function resize_headlines(delta_x, delta_y) { debug("resize_headlines: " + delta_x + ":" + delta_y); - var h_frame = document.getElementById("headlines-frame"); - var c_frame = document.getElementById("content-frame"); - var f_frame = document.getElementById("footer"); - var feeds_frame = document.getElementById("feeds-holder"); - var resize_grab = document.getElementById("resize-grabber"); - var resize_handle = document.getElementById("resize-handle"); + var h_frame = $("headlines-frame"); + var c_frame = $("content-frame"); + var f_frame = $("footer"); + var feeds_frame = $("feeds-holder"); + var resize_grab = $("resize-grabber"); + var resize_handle = $("resize-handle"); if (!c_frame || !h_frame) return; @@ -524,7 +524,7 @@ function init_second_stage() { if (fl) { render_feedlist(fl); - if (document.getElementById("feedList")) { + if ($("feedList")) { request_counters(); } else { setTimeout('updateFeedList(false, false)', 50); @@ -561,7 +561,7 @@ function init_second_stage() { } function quickMenuChange() { - var chooser = document.getElementById("quickMenuChooser"); + var chooser = $("quickMenuChooser"); var opid = chooser[chooser.selectedIndex].value; chooser.selectedIndex = 0; @@ -760,7 +760,7 @@ function parse_runtime_info(elem) { } if (k == "new_version_available") { - var icon = document.getElementById("newVersionIcon"); + var icon = $("newVersionIcon"); if (icon) { if (v == "1") { icon.style.display = "inline"; @@ -786,7 +786,7 @@ function parse_runtime_info(elem) { notify(''); } -/* var w = document.getElementById("noDaemonWarning"); +/* var w = $("noDaemonWarning"); if (w) { if (k == "daemon_is_running" && v != 1) { @@ -916,13 +916,13 @@ function collapse_feedlist() { if (theme != "" && theme != "compact" && theme != "graycube" && theme != "compat") return; - var fl = document.getElementById("feeds-holder"); - var fh = document.getElementById("headlines-frame"); - var fc = document.getElementById("content-frame"); - var ft = document.getElementById("toolbar"); - var ff = document.getElementById("footer"); - var fhdr = document.getElementById("header"); - var fbtn = document.getElementById("collapse_feeds_btn"); + var fl = $("feeds-holder"); + var fh = $("headlines-frame"); + var fc = $("content-frame"); + var ft = $("toolbar"); + var ff = $("footer"); + var fhdr = $("header"); + var fbtn = $("collapse_feeds_btn"); if (!Element.visible(fl)) { Element.show(fl); @@ -1036,7 +1036,7 @@ function hotkey_handler(e) { var keycode; var shift_key = false; - var feedlist = document.getElementById('feedList'); + var feedlist = $('feedList'); try { shift_key = e.shiftKey; @@ -1217,7 +1217,7 @@ function hotkey_handler(e) { if (keycode == 9) { // tab var id = getArticleUnderPointer(); if (id) { - var cb = document.getElementById("RCHK-" + id); + var cb = $("RCHK-" + id); if (cb) { cb.checked = !cb.checked; diff --git a/viewfeed.js b/viewfeed.js index acce5310d..faa691583 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -30,7 +30,7 @@ function catchup_callback2(transport, callback) { function clean_feed_selections() { try { - var feeds = document.getElementById("feedList").getElementsByTagName("LI"); + var feeds = $("feedList").getElementsByTagName("LI"); for (var i = 0; i < feeds.length; i++) { if (feeds[i].id && feeds[i].id.match("FEEDR-")) { @@ -69,18 +69,18 @@ function headlines_callback2(transport, feed_cur_page) { } if (!is_cat) { - var feedr = document.getElementById("FEEDR-" + feed_id); + var feedr = $("FEEDR-" + feed_id); if (feedr && !feedr.className.match("Selected")) { feedr.className = feedr.className + "Selected"; } } else { - var feedr = document.getElementById("FCAT-" + feed_id); + var feedr = $("FCAT-" + feed_id); if (feedr && !feedr.className.match("Selected")) { feedr.className = feedr.className + "Selected"; } } - var f = document.getElementById("headlines-frame"); + var f = $("headlines-frame"); try { if (feed_cur_page == 0) { debug("resetting headlines scrollTop"); @@ -141,10 +141,10 @@ function headlines_callback2(transport, feed_cur_page) { if (headlines_count > 0) { debug("adding some more headlines..."); - var c = document.getElementById("headlinesList"); + var c = $("headlinesList"); if (!c) { - c = document.getElementById("headlinesInnerContainer"); + c = $("headlinesInnerContainer"); } var ids = getSelectedArticleIds2(); @@ -203,7 +203,7 @@ function headlines_callback2(transport, feed_cur_page) { if (_cdm_wd_timeout) window.clearTimeout(_cdm_wd_timeout); - if (!document.getElementById("headlinesList") && + if (!$("headlinesList") && getActiveFeedId() != -3 && getInitParam("cdm_auto_catchup") == 1) { debug("starting CDM watchdog"); @@ -227,12 +227,12 @@ function headlines_callback2(transport, feed_cur_page) { function render_article(article) { try { - var f = document.getElementById("content-frame"); + var f = $("content-frame"); try { f.scrollTop = 0; } catch (e) { }; - var fi = document.getElementById("content-insert"); + var fi = $("content-insert"); try { fi.scrollTop = 0; @@ -251,7 +251,7 @@ function showArticleInHeadlines(id) { cleanSelected("headlinesList"); - var crow = document.getElementById("RROW-" + id); + var crow = $("RROW-" + id); if (!crow) return; @@ -261,7 +261,7 @@ function showArticleInHeadlines(id) { selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false); - var upd_img_pic = document.getElementById("FUPDPIC-" + id); + var upd_img_pic = $("FUPDPIC-" + id); var cache_prefix = ""; @@ -286,7 +286,7 @@ function showArticleInHeadlines(id) { cache_invalidate(cache_prefix + getActiveFeedId()); cache_inject(cache_prefix + getActiveFeedId(), - document.getElementById("headlines-frame").innerHTML, + $("headlines-frame").innerHTML, get_feed_unread(getActiveFeedId())); } else if (article_is_unread && view_mode == "all_articles") { @@ -294,7 +294,7 @@ function showArticleInHeadlines(id) { cache_invalidate(cache_prefix + getActiveFeedId()); cache_inject(cache_prefix + getActiveFeedId(), - document.getElementById("headlines-frame").innerHTML, + $("headlines-frame").innerHTML, get_feed_unread(getActiveFeedId())-1); } else if (article_is_unread) { @@ -351,7 +351,7 @@ function article_callback2(transport, id, feed_id) { } else { debug("article_callback: returned no XML object"); - //var f = document.getElementById("content-frame"); + //var f = $("content-frame"); //f.innerHTML = "
" + __('Could not display article (missing XML object)') + "
"; } @@ -433,7 +433,7 @@ function view(id, feed_id, skip_history) { query = query + "&cids=" + cids_to_request.toString(); - var crow = document.getElementById("RROW-" + id); + var crow = $("RROW-" + id); var article_is_unread = crow.className.match("Unread"); if (!async_counters_work) { @@ -531,12 +531,12 @@ function toggleMark(id, client_only, no_effects) { query = query + "&omode=flc"; } - var mark_img = document.getElementById("FMPIC-" + id); + var mark_img = $("FMPIC-" + id); if (!mark_img) return; - var vfeedu = document.getElementById("FEEDU--1"); - var crow = document.getElementById("RROW-" + id); + var vfeedu = $("FEEDU--1"); + var crow = $("RROW-" + id); if (mark_img.src.match("mark_unset")) { mark_img.src = mark_img.src.replace("mark_unset", "mark_set"); @@ -552,7 +552,7 @@ function toggleMark(id, client_only, no_effects) { mark_img.alt = __("Please wait..."); query = query + "&mark=0"; - if (document.getElementById("headlinesList") && !no_effects) { + if ($("headlinesList") && !no_effects) { Effect.Puff(mark_img, {duration : 0.25, afterFinish: tMark_afh_off}); } else { mark_img.src = mark_img.src.replace("mark_set", "mark_unset"); @@ -596,12 +596,12 @@ function togglePub(id, client_only, no_effects) { query = query + "&omode=flc"; } - var mark_img = document.getElementById("FPPIC-" + id); + var mark_img = $("FPPIC-" + id); if (!mark_img) return; - var vfeedu = document.getElementById("FEEDU--2"); - var crow = document.getElementById("RROW-" + id); + var vfeedu = $("FEEDU--2"); + var crow = $("RROW-" + id); if (mark_img.src.match("pub_unset")) { mark_img.src = mark_img.src.replace("pub_unset", "pub_set"); @@ -614,7 +614,7 @@ function togglePub(id, client_only, no_effects) { mark_img.alt = __("Please wait..."); query = query + "&pub=0"; - if (document.getElementById("headlinesList") && !no_effects) { + if ($("headlinesList") && !no_effects) { Effect.Puff(mark_img, {duration : 0.25, afterFinish: tPub_afh_off}); } else { mark_img.src = mark_img.src.replace("pub_set", "pub_unset"); @@ -639,9 +639,9 @@ function correctHeadlinesOffset(id) { try { - var hlist = document.getElementById("headlinesList"); - var container = document.getElementById("headlinesInnerContainer"); - var row = document.getElementById("RROW-" + id); + var hlist = $("headlinesList"); + var container = $("headlinesInnerContainer"); + var row = $("RROW-" + id); var viewport = container.offsetHeight; @@ -682,7 +682,7 @@ function moveToPost(mode) { var prev_id = false; var next_id = false; - if (!document.getElementById('RROW-' + active_post_id)) { + if (!$('RROW-' + active_post_id)) { active_post_id = false; } @@ -738,9 +738,9 @@ function moveToPost(mode) { function toggleSelected(id) { try { - var cb = document.getElementById("RCHK-" + id); + var cb = $("RCHK-" + id); - var row = document.getElementById("RROW-" + id); + var row = $("RROW-" + id); if (row) { var nc = row.className; @@ -781,7 +781,7 @@ function toggleUnread_afh(effect) { function toggleUnread(id, cmode, effect) { try { - var row = document.getElementById("RROW-" + id); + var row = $("RROW-" + id); if (row) { var nc = row.className; var is_selected = row.className.match("Selected"); @@ -791,7 +791,7 @@ function toggleUnread(id, cmode, effect) { // since we are removing selection from the object, uncheck // corresponding checkbox - var cb = document.getElementById("RCHK-" + id); + var cb = $("RCHK-" + id); if (cb) { cb.checked = false; } @@ -951,7 +951,7 @@ function selectionToggleUnread(cdm_mode, set_state, callback_func, no_error) { } for (i = 0; i < rows.length; i++) { - var row = document.getElementById("RROW-" + rows[i]); + var row = $("RROW-" + rows[i]); if (row) { var nc = row.className; nc = nc.replace("Unread", ""); @@ -1100,7 +1100,7 @@ function selectionTogglePublished(cdm_mode) { function cdmGetSelectedArticles() { var sel_articles = new Array(); - var container = document.getElementById("headlinesInnerContainer"); + var container = $("headlinesInnerContainer"); for (i = 0; i < container.childNodes.length; i++) { var child = container.childNodes[i]; @@ -1116,7 +1116,7 @@ function cdmGetSelectedArticles() { function cdmGetVisibleArticles() { var sel_articles = new Array(); - var container = document.getElementById("headlinesInnerContainer"); + var container = $("headlinesInnerContainer"); if (!container) return sel_articles; @@ -1134,7 +1134,7 @@ function cdmGetVisibleArticles() { function cdmGetUnreadArticles() { var sel_articles = new Array(); - var container = document.getElementById("headlinesInnerContainer"); + var container = $("headlinesInnerContainer"); for (i = 0; i < container.childNodes.length; i++) { var child = container.childNodes[i]; @@ -1151,7 +1151,7 @@ function cdmGetUnreadArticles() { // mode = all,none,unread function cdmSelectArticles(mode) { - var container = document.getElementById("headlinesInnerContainer"); + var container = $("headlinesInnerContainer"); for (i = 0; i < container.childNodes.length; i++) { var child = container.childNodes[i]; @@ -1159,7 +1159,7 @@ function cdmSelectArticles(mode) { if (child.id && child.id.match("RROW-")) { var aid = child.id.replace("RROW-", ""); - var cb = document.getElementById("RCHK-" + aid); + var cb = $("RCHK-" + aid); if (mode == "all") { if (!child.className.match("Selected")) { @@ -1191,7 +1191,7 @@ function catchupPage() { return; } - if (document.getElementById("headlinesList")) { + if ($("headlinesList")) { selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, 'Unread', true); selectionToggleUnread(false, false, 'viewCurrentFeed()', true); selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false); @@ -1208,7 +1208,7 @@ function catchupSelection() { var rows; - if (document.getElementById("headlinesList")) { + if ($("headlinesList")) { rows = getSelectedTableRowIds("headlinesList", "RROW", "RCHK"); } else { rows = cdmGetSelectedArticles(); @@ -1231,7 +1231,7 @@ function catchupSelection() { return; } - if (document.getElementById("headlinesList")) { + if ($("headlinesList")) { selectionToggleUnread(false, false, 'viewCurrentFeed()', true); // selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false); } else { @@ -1268,7 +1268,7 @@ function tag_saved_callback(transport) { var id = tags_str.getAttribute("id"); if (id) { - var tags = document.getElementById("ATSTR-" + id); + var tags = $("ATSTR-" + id); if (tags) { tags.innerHTML = tags_str.firstChild.nodeValue; } @@ -1328,7 +1328,7 @@ function editTagsInsert() { function cdmScrollViewport(where) { debug("cdmScrollViewport: " + where); - var ctr = document.getElementById("headlinesInnerContainer"); + var ctr = $("headlinesInnerContainer"); if (!ctr) return; @@ -1341,8 +1341,8 @@ function cdmScrollViewport(where) { function cdmArticleIsBelowViewport(id) { try { - var ctr = document.getElementById("headlinesInnerContainer"); - var e = document.getElementById("RROW-" + id); + var ctr = $("headlinesInnerContainer"); + var e = $("RROW-" + id); if (!e || !ctr) return; @@ -1361,8 +1361,8 @@ function cdmArticleIsBelowViewport(id) { function cdmArticleIsAboveViewport(id) { try { - var ctr = document.getElementById("headlinesInnerContainer"); - var e = document.getElementById("RROW-" + id); + var ctr = $("headlinesInnerContainer"); + var e = $("RROW-" + id); if (!e || !ctr) return; @@ -1381,8 +1381,8 @@ function cdmArticleIsAboveViewport(id) { function cdmScrollToArticleId(id) { try { - var ctr = document.getElementById("headlinesInnerContainer"); - var e = document.getElementById("RROW-" + id); + var ctr = $("headlinesInnerContainer"); + var e = $("RROW-" + id); if (!e || !ctr) return; @@ -1395,8 +1395,8 @@ function cdmScrollToArticleId(id) { function cdmArticleIsActuallyVisible(id) { try { - var ctr = document.getElementById("headlinesInnerContainer"); - var e = document.getElementById("RROW-" + id); + var ctr = $("headlinesInnerContainer"); + var e = $("RROW-" + id); if (!e || !ctr) return; @@ -1427,7 +1427,7 @@ function cdmWatchdog() { try { - var ctr = document.getElementById("headlinesInnerContainer"); + var ctr = $("headlinesInnerContainer"); if (!ctr) return; @@ -1478,7 +1478,7 @@ function cdmWatchdog() { if (ids.length > 0) { for (var i = 0; i < ids.length; i++) { - var e = document.getElementById("RROW-" + ids[i]); + var e = $("RROW-" + ids[i]); if (e) { e.className = e.className.replace("Unread", ""); } @@ -1688,7 +1688,7 @@ function getActiveArticleId() { function cdmClicked(id) { try { - var elem = document.getElementById("RROW-" + id); + var elem = $("RROW-" + id); if (elem) { var id = elem.id.replace("RROW-", ""); @@ -1782,7 +1782,7 @@ function postMouseOut(id) { function headlines_scroll_handler() { try { - var e = document.getElementById("headlinesInnerContainer"); + var e = $("headlinesInnerContainer"); // don't do infinite scrolling when Limit == All @@ -1819,7 +1819,7 @@ function catchupRelativeToArticle(below) { var visible_ids; - if (document.getElementById("headlinesList")) { + if ($("headlinesList")) { visible_ids = getVisibleHeadlineIds(); } else { visible_ids = cdmGetVisibleArticles(); @@ -1830,7 +1830,7 @@ function catchupRelativeToArticle(below) { if (!below) { for (var i = 0; i < visible_ids.length; i++) { if (visible_ids[i] != getActiveArticleId()) { - var e = document.getElementById("RROW-" + visible_ids[i]); + var e = $("RROW-" + visible_ids[i]); if (e && e.className.match("Unread")) { ids_to_mark.push(visible_ids[i]); @@ -1842,7 +1842,7 @@ function catchupRelativeToArticle(below) { } else { for (var i = visible_ids.length-1; i >= 0; i--) { if (visible_ids[i] != getActiveArticleId()) { - var e = document.getElementById("RROW-" + visible_ids[i]); + var e = $("RROW-" + visible_ids[i]); if (e && e.className.match("Unread")) { ids_to_mark.push(visible_ids[i]); @@ -1861,7 +1861,7 @@ function catchupRelativeToArticle(below) { if (confirm(msg)) { for (var i = 0; i < ids_to_mark.length; i++) { - var e = document.getElementById("RROW-" + ids_to_mark[i]); + var e = $("RROW-" + ids_to_mark[i]); e.className = e.className.replace("Unread", ""); } @@ -1892,7 +1892,7 @@ function cdmExpandArticle(a_id) { Effect.Appear(id, {duration : 0.5, beforeStart: function(effect) { var h_id = 'CICH-' + a_id; - var h_elem = document.getElementById(h_id); + var h_elem = $(h_id); if (h_elem) { h_elem.style.display = "none"; } toggleUnread(a_id, 0); @@ -1908,7 +1908,7 @@ function cdmExpandArticle(a_id) { function fixHeadlinesOrder(ids) { try { for (var i = 0; i < ids.length; i++) { - var e = document.getElementById("RROW-" + ids[i]); + var e = $("RROW-" + ids[i]); if (e) { if (i % 2 == 0) { @@ -1929,7 +1929,7 @@ function hideReadHeadlines() { var ids = false; var vis_ids = new Array(); - if (document.getElementById("headlinesList")) { + if ($("headlinesList")) { ids = getVisibleHeadlineIds(); } else { ids = cdmGetVisibleArticles(); @@ -1938,7 +1938,7 @@ function hideReadHeadlines() { var read_headlines_visible = true; for (var i = 0; i < ids.length; i++) { - var row = document.getElementById("RROW-" + ids[i]); + var row = $("RROW-" + ids[i]); if (row && row.className) { if (read_headlines_visible) { @@ -1985,7 +1985,7 @@ function invertHeadlineSelection() { for (var i = 0; i < rows.length; i++) { var nc = rows[i].className; var id = rows[i].id.replace("RROW-", ""); - var cb = document.getElementById("RCHK-" + id); + var cb = $("RCHK-" + id); if (!rows[i].className.match("Selected")) { nc = nc + "Selected"; @@ -2039,7 +2039,7 @@ function showOriginalArticleInline(id) { if (link && id) { link = link.firstChild.nodeValue; - var ci = document.getElementById("content-insert"); + var ci = $("content-insert"); var tmp = ""; @@ -2058,12 +2058,12 @@ function showOriginalArticleInline(id) { function scrollArticle(offset) { try { if (!isCdmMode()) { - var ci = document.getElementById("content-insert"); + var ci = $("content-insert"); if (ci) { ci.scrollTop += offset; } } else { - var hi = document.getElementById("headlinesInnerContainer"); + var hi = $("headlinesInnerContainer"); if (hi) { hi.scrollTop += offset; } @@ -2086,7 +2086,7 @@ function show_labels_in_headlines(transport) { if (e_id) { - var ctr = document.getElementById("HLLCTR-" + e_id); + var ctr = $("HLLCTR-" + e_id); if (ctr) { ctr.innerHTML = elems[l].firstChild.nodeValue; @@ -2104,8 +2104,8 @@ function show_labels_in_headlines(transport) { function toggleHeadlineActions() { try { - var e = document.getElementById("headlineActionsBody"); - var p = document.getElementById("headlineActionsDrop"); + var e = $("headlineActionsBody"); + var p = $("headlineActionsDrop"); if (!Element.visible(e)) { Element.show(e);