massive code cleanup

This commit is contained in:
Andrew Dolgov 2008-05-20 06:47:57 +01:00
parent e86dbf9d9b
commit ee8768dbbb
4 changed files with 4 additions and 330 deletions

View File

@ -339,15 +339,6 @@ function feedlist_init() {
document.onmouseup = mouse_up_handler;
setTimeout("timeout()", 0);
/* debug("about to remove splash, OMG!");
var o = document.getElementById("overlay");
if (o) {
o.style.display = "none";
debug("removed splash!");
} */
if (typeof correctPNG != 'undefined') {
correctPNG();
}
@ -368,12 +359,6 @@ function feedlist_init() {
setTimeout("hide_footer()", 5000);
}
/* if (getInitParam("hide_feedlist") == 1) {
init_hidden_feedlist(getInitParam("theme"));
} else {
init_collapsable_feedlist(getInitParam("theme"));
} */
init_collapsable_feedlist(getInitParam("theme"));
} catch (e) {

View File

@ -11,25 +11,12 @@ Array.prototype.remove = function(s) {
}
}
function browser_has_opacity() {
return navigator.userAgent.match("Gecko") != null ||
navigator.userAgent.match("Opera") != null;
}
function is_msie() {
return navigator.userAgent.match("MSIE");
}
function is_opera() {
return navigator.userAgent.match("Opera");
}
function is_khtml() {
return navigator.userAgent.match("KHTML");
}
function is_safari() {
return navigator.userAgent.match("Safari");
return window.opera;
}
function exception_error(location, e, silent) {
@ -1233,10 +1220,6 @@ function infobox_callback2(transport) {
var shadow = document.getElementById('infoBoxShadow');
if (box) {
/* if (!is_safari()) {
new Draggable(shadow);
} */
box.innerHTML=transport.responseText;
if (shadow) {
shadow.style.display = "block";
@ -1507,14 +1490,6 @@ function getRelativePostIds(id, limit) {
var r_id = rows[i].id.replace("RROW-", "");
if (r_id == id) {
/* if (i > 0) ids.push(rows[i-1].id.replace("RROW-", ""));
if (i > 1) ids.push(rows[i-2].id.replace("RROW-", ""));
if (i > 2) ids.push(rows[i-3].id.replace("RROW-", ""));
if (i < rows.length-1) ids.push(rows[i+1].id.replace("RROW-", ""));
if (i < rows.length-2) ids.push(rows[i+2].id.replace("RROW-", ""));
if (i < rows.length-3) ids.push(rows[i+3].id.replace("RROW-", "")); */
for (var k = 1; k <= limit; k++) {
var nid = false;

172
tt-rss.js
View File

@ -1277,178 +1277,6 @@ function hotkey_handler(e) {
}
/*
if (keycode == 48) { // 0
return setHotkeyZone(0);
}
if (keycode == 49) { // 1
return setHotkeyZone(1);
}
if (keycode == 50) { // 2
return setHotkeyZone(2);
}
if (keycode == 51) { // 3
return setHotkeyZone(3);
}
if (keycode == 82) { // r
return scheduleFeedUpdate(true);
}
if (keycode == 83) { // s
return displayDlg("search", getActiveFeedId());
}
if (keycode == 85) { // u
if (getActiveFeedId()) {
return viewfeed(getActiveFeedId(), "ForceUpdate");
}
}
if (keycode == 65) { // a
return toggleDispRead();
}
var feedlist = document.getElementById('feedList');
if (keycode == 74) { // j
var feed = getActiveFeedId();
var new_feed = getRelativeFeedId(feedlist, feed, 'prev');
if (new_feed) viewfeed(new_feed, '');
}
if (keycode == 75) { // k
var feed = getActiveFeedId();
var new_feed = getRelativeFeedId(feedlist, feed, 'next');
if (new_feed) viewfeed(new_feed, '');
}
if (shift_key && (keycode == 78 || keycode == 40)) { // shift - n, down
return catchupRelativeToArticle(1);
}
if (shift_key && (keycode == 80 || keycode == 38)) { // shift - p, up
return catchupRelativeToArticle(0);
}
if (keycode == 78 || keycode == 40) { // n, down
if (typeof moveToPost != 'undefined') {
return moveToPost('next');
}
}
if (keycode == 80 || keycode == 38) { // p, up
if (typeof moveToPost != 'undefined') {
return moveToPost('prev');
}
}
if (keycode == 68 && shift_key) { // d
if (!debug_mode_enabled) {
document.getElementById('debug_output').style.display = 'block';
debug('debug mode activated');
} else {
document.getElementById('debug_output').style.display = 'none';
}
debug_mode_enabled = !debug_mode_enabled;
}
if (keycode == 191 && shift_key) { // ?
if (!Element.visible("hotkey_help_overlay")) {
Element.show("hotkey_help_overlay");
} else {
Element.hide("hotkey_help_overlay");
}
}
if (keycode == 69 && shift_key) { // e
return editFeedDlg(getActiveFeedId());
}
if (keycode == 70 && shift_key) { // f
if (getActiveFeedId()) {
return catchupCurrentFeed();
}
}
if (keycode == 80 && shift_key) { // p
if (getActiveFeedId()) {
return catchupPage();
}
}
if (keycode == 86) { // v
if (getActiveArticleId()) {
openArticleInNewWindow(getActiveArticleId());
}
}
if (keycode == 84) { // t
var id = getActiveArticleId();
if (id) {
var cb = document.getElementById("RCHK-" + id);
if (cb) {
cb.checked = !cb.checked;
toggleSelectRowById(cb, "RROW-" + id);
}
}
}
if (keycode == 67) { // c
var id = getActiveArticleId();
if (id) {
toggleUnread(id, 0);
}
}
if (keycode == 67 && shift_key) { // c
if (typeof collapse_feedlist != 'undefined') {
return collapse_feedlist();
}
}
if (keycode == 81 && shift_key) { // shift + q
if (typeof catchupAllFeeds != 'undefined') {
return catchupAllFeeds();
}
}
if (keycode == 73 && shift_key) { // shift + i
if (document.getElementById("subtoolbar_search")) {
if (Element.visible("subtoolbar_search")) {
Element.hide("subtoolbar_search");
Element.show("subtoolbar_ftitle");
setTimeout("Element.focus('subtoolbar_search_box')", 100);
} else {
Element.show("subtoolbar_search");
Element.hide("subtoolbar_ftitle");
}
}
}
if (keycode == 27) { // escape
if (Element.visible("hotkey_help_overlay")) {
Element.hide("hotkey_help_overlay");
}
}
if (typeof localHotkeyHandler != 'undefined') {
try {
return localHotkeyHandler(e);
} catch (e) {
exception_error("hotkey_handler, local:", e);
}
} */
if (hotkey_prefix) {
debug("KP: PREFIX=" + hotkey_prefix + " CODE=" + keycode + " CHAR=" + keychar);
} else {

View File

@ -520,19 +520,11 @@ function toggleMark(id, client_only, no_effects) {
mark_img.alt = __("Unstar article");
query = query + "&mark=1";
/* if (vfeedu && crow.className.match("Unread")) {
vfeedu.innerHTML = (+vfeedu.innerHTML) + 1;
} */
} else {
//mark_img.src = "images/mark_unset.png";
mark_img.alt = __("Please wait...");
query = query + "&mark=0";
/* if (vfeedu && crow.className.match("Unread")) {
vfeedu.innerHTML = (+vfeedu.innerHTML) - 1;
} */
if (document.getElementById("headlinesList") && !no_effects) {
Effect.Puff(mark_img, {duration : 0.25, afterFinish: tMark_afh_off});
} else {
@ -541,25 +533,6 @@ function toggleMark(id, client_only, no_effects) {
}
}
/* var vfeedctr = document.getElementById("FEEDCTR--1");
var vfeedr = document.getElementById("FEEDR--1");
if (vfeedu && vfeedctr) {
if ((+vfeedu.innerHTML) > 0) {
if (crow.className.match("Unread") && !vfeedr.className.match("Unread")) {
vfeedr.className = vfeedr.className + "Unread";
vfeedctr.className = "odd";
}
} else {
vfeedctr.className = "invisible";
vfeedr.className = vfeedr.className.replace("Unread", "");
}
}
debug("toggle starred for aid " + id);
//new Ajax.Request(query); */
if (!client_only) {
debug(query);
@ -598,19 +571,12 @@ function togglePub(id, client_only, no_effects) {
mark_img.alt = __("Unpublish article");
query = query + "&pub=1";
/* if (vfeedu && crow.className.match("Unread")) {
vfeedu.innerHTML = (+vfeedu.innerHTML) + 1;
} */
} else {
//mark_img.src = "images/pub_unset.png";
mark_img.alt = __("Please wait...");
query = query + "&pub=0";
/* if (vfeedu && crow.className.match("Unread")) {
vfeedu.innerHTML = (+vfeedu.innerHTML) - 1;
} */
if (document.getElementById("headlinesList") && !no_effects) {
Effect.Puff(mark_img, {duration : 0.25, afterFinish: tPub_afh_off});
} else {
@ -619,25 +585,6 @@ function togglePub(id, client_only, no_effects) {
}
}
/* var vfeedctr = document.getElementById("FEEDCTR--2");
var vfeedr = document.getElementById("FEEDR--2");
if (vfeedu && vfeedctr) {
if ((+vfeedu.innerHTML) > 0) {
if (crow.className.match("Unread") && !vfeedr.className.match("Unread")) {
vfeedr.className = vfeedr.className + "Unread";
vfeedctr.className = "odd";
}
} else {
vfeedctr.className = "invisible";
vfeedr.className = vfeedr.className.replace("Unread", "");
}
}
debug("toggle published for aid " + id);
new Ajax.Request(query); */
if (!client_only) {
new Ajax.Request(query, {
onComplete: function(transport) {
@ -746,52 +693,6 @@ function moveToPost(mode) {
}
}
/* } else {
var rows = cdmGetVisibleArticles();
if (mode == "next") {
for (var i = 0; i < rows.length; i++) {
if (cdmArticleIsActuallyVisible(rows[i]) ||
cdmArticleIsBelowViewport(rows[i])) {
if (!cdmArticleIsActuallyVisible(rows[i])) {
cdmScrollToArticleId(rows[i]);
}
//setTimeout("toggleUnread(" + rows[i] + ", undefined, true)", 500);
cdmSelectArticles("none");
toggleUnread(rows[i], undefined, true);
toggleSelected(rows[i]);
return;
}
}
cdmScrollViewport('bottom');
} else if (mode == "prev") {
for (var i = 0; i < rows.length; i++) {
if (cdmArticleIsAboveViewport(rows[i]) &&
!cdmArticleIsAboveViewport(rows[i+1])) {
cdmScrollToArticleId(rows[i]);
//setTimeout("toggleUnread(" + rows[i] + ", undefined, true)", 500);
cdmSelectArticles("none");
toggleUnread(rows[i], undefined, true);
cdmSelectArticleById(rows[i]);
break;
}
}
}
} */
} catch (e) {
exception_error("moveToPost", e);
}
@ -1607,7 +1508,7 @@ function cdmClicked(elem) {
}
} catch (e) {
exception_error("cdmMouseIn", e);
exception_error("cdmClicked", e);
}
}
@ -1684,21 +1585,6 @@ function postMouseOut(id) {
}
}
function cdmMouseIn(elem) {
/* try {
if (elem.id && elem.id.match("RROW-")) {
var id = elem.id.replace("RROW-", "");
active_post_id = id;
}
} catch (e) {
exception_error("cdmMouseIn", e);
} */
}
function cdmMouseOut(elem) {
//active_post_id = false;
}
function headlines_scroll_handler() {
try {