further javascript cleanups
This commit is contained in:
parent
7276362076
commit
bb7cfaceb1
|
@ -486,6 +486,8 @@
|
||||||
// kludge, because iframe doesn't seem to support onload()
|
// kludge, because iframe doesn't seem to support onload()
|
||||||
|
|
||||||
print "<script type=\"text/javascript\">
|
print "<script type=\"text/javascript\">
|
||||||
|
document.onkeydown = hotkey_handler;
|
||||||
|
|
||||||
var feedr = parent.document.getElementById(\"FEEDR-\" + $feed);
|
var feedr = parent.document.getElementById(\"FEEDR-\" + $feed);
|
||||||
var feedt = parent.document.getElementById(\"FEEDT-\" + $feed);
|
var feedt = parent.document.getElementById(\"FEEDT-\" + $feed);
|
||||||
var feedu = parent.document.getElementById(\"FEEDU-\" + $feed);
|
var feedu = parent.document.getElementById(\"FEEDU-\" + $feed);
|
||||||
|
|
|
@ -91,11 +91,14 @@ function hotkey_handler(e) {
|
||||||
|
|
||||||
var piggie = document.getElementById("piggie");
|
var piggie = document.getElementById("piggie");
|
||||||
|
|
||||||
|
if (piggie) {
|
||||||
|
|
||||||
if (seq.match("807371717369")) {
|
if (seq.match("807371717369")) {
|
||||||
localPiggieFunction(true);
|
localPiggieFunction(true);
|
||||||
} else {
|
} else {
|
||||||
localPiggieFunction(false);
|
localPiggieFunction(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof localHotkeyHandler != 'undefined') {
|
if (typeof localHotkeyHandler != 'undefined') {
|
||||||
localHotkeyHandler(keycode);
|
localHotkeyHandler(keycode);
|
||||||
|
|
|
@ -238,10 +238,6 @@
|
||||||
|
|
||||||
$last_read_qpart = "";
|
$last_read_qpart = "";
|
||||||
|
|
||||||
// if ("$orig_title" != "$entry_title") {
|
|
||||||
// $last_read_qpart = 'last_read = null,';
|
|
||||||
// }
|
|
||||||
|
|
||||||
if ($orig_content_hash != $content_hash) {
|
if ($orig_content_hash != $content_hash) {
|
||||||
if (UPDATE_POST_ON_CHECKSUM_CHANGE) {
|
if (UPDATE_POST_ON_CHECKSUM_CHANGE) {
|
||||||
$last_read_qpart = 'last_read = null,';
|
$last_read_qpart = 'last_read = null,';
|
||||||
|
@ -257,10 +253,6 @@
|
||||||
$entry_is_modified = true;
|
$entry_is_modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (!$no_orig_date && $orig_timestamp < $entry_timestamp) {
|
|
||||||
// $last_read_qpart = 'last_read = null,';
|
|
||||||
// }
|
|
||||||
|
|
||||||
if ($entry_is_modified) {
|
if ($entry_is_modified) {
|
||||||
|
|
||||||
$entry_comments = pg_escape_string($entry_comments);
|
$entry_comments = pg_escape_string($entry_comments);
|
||||||
|
@ -268,8 +260,6 @@
|
||||||
$entry_title = pg_escape_string($entry_title);
|
$entry_title = pg_escape_string($entry_title);
|
||||||
$entry_link = pg_escape_string($entry_link);
|
$entry_link = pg_escape_string($entry_link);
|
||||||
|
|
||||||
// print "update object $entry_guid<br>";
|
|
||||||
|
|
||||||
$query = "UPDATE ttrss_entries
|
$query = "UPDATE ttrss_entries
|
||||||
SET
|
SET
|
||||||
$last_read_qpart
|
$last_read_qpart
|
||||||
|
|
109
tt-rss.js
109
tt-rss.js
|
@ -57,59 +57,6 @@ function feedlist_callback() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
function viewfeed_callback() {
|
|
||||||
var container = document.getElementById('headlines');
|
|
||||||
if (xmlhttp.readyState == 4) {
|
|
||||||
container.innerHTML = xmlhttp.responseText;
|
|
||||||
|
|
||||||
var factive = document.getElementById("FACTIVE");
|
|
||||||
var funread = document.getElementById("FUNREAD");
|
|
||||||
var ftotal = document.getElementById("FTOTAL");
|
|
||||||
|
|
||||||
if (_viewfeed_autoselect_first == true) {
|
|
||||||
_viewfeed_autoselect_first = false;
|
|
||||||
view(getFirstVisibleHeadlineId(), active_feed_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_viewfeed_autoselect_last == true) {
|
|
||||||
_viewfeed_autoselect_last = false;
|
|
||||||
view(getLastVisibleHeadlineId(), active_feed_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ftotal && factive && funread) {
|
|
||||||
var feed_id = factive.innerHTML;
|
|
||||||
|
|
||||||
var feedr = document.getElementById("FEEDR-" + feed_id);
|
|
||||||
var feedt = document.getElementById("FEEDT-" + feed_id);
|
|
||||||
var feedu = document.getElementById("FEEDU-" + feed_id);
|
|
||||||
|
|
||||||
feedt.innerHTML = ftotal.innerHTML;
|
|
||||||
feedu.innerHTML = funread.innerHTML;
|
|
||||||
|
|
||||||
total_feed_entries = ftotal.innerHTML;
|
|
||||||
|
|
||||||
if (feedu.innerHTML > 0 && !feedr.className.match("Unread")) {
|
|
||||||
feedr.className = feedr.className + "Unread";
|
|
||||||
} else if (feedu.innerHTML <= 0) {
|
|
||||||
feedr.className = feedr.className.replace("Unread", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanSelected("feedsList");
|
|
||||||
|
|
||||||
feedr.className = feedr.className + "Selected";
|
|
||||||
}
|
|
||||||
|
|
||||||
var searchbox = document.getElementById("searchbox");
|
|
||||||
searchbox.value = search_query;
|
|
||||||
|
|
||||||
markHeadline(active_post_id);
|
|
||||||
|
|
||||||
notify("");
|
|
||||||
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
|
|
||||||
function refetch_callback() {
|
function refetch_callback() {
|
||||||
|
|
||||||
if (xmlhttp_rpc.readyState == 4) {
|
if (xmlhttp_rpc.readyState == 4) {
|
||||||
|
@ -337,62 +284,6 @@ function viewfeed(feed, skip, subop) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
function view(id,feed_id) {
|
|
||||||
|
|
||||||
enableHotkeys();
|
|
||||||
|
|
||||||
if (!xmlhttp_ready(xmlhttp_view)) {
|
|
||||||
printLockingError();
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var crow = document.getElementById("RROW-" + id);
|
|
||||||
|
|
||||||
if (crow.className.match("Unread")) {
|
|
||||||
var umark = document.getElementById("FEEDU-" + feed_id);
|
|
||||||
umark.innerHTML = umark.innerHTML - 1;
|
|
||||||
crow.className = crow.className.replace("Unread", "");
|
|
||||||
|
|
||||||
if (umark.innerHTML == "0") {
|
|
||||||
var feedr = document.getElementById("FEEDR-" + feed_id);
|
|
||||||
feedr.className = feedr.className.replace("Unread", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
total_unread--;
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanSelected("headlinesList");
|
|
||||||
// crow.className = crow.className + "Selected";
|
|
||||||
|
|
||||||
var upd_img_pic = document.getElementById("FUPDPIC-" + id);
|
|
||||||
|
|
||||||
if (upd_img_pic) {
|
|
||||||
upd_img_pic.innerHTML = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
// document.getElementById('content').innerHTML='Loading, please wait...';
|
|
||||||
|
|
||||||
var unread_rows = getVisibleUnreadHeadlines();
|
|
||||||
|
|
||||||
if (unread_rows.length == 0) {
|
|
||||||
var button = document.getElementById("btnCatchupPage");
|
|
||||||
if (button) {
|
|
||||||
button.className = "disabledButton";
|
|
||||||
button.href = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
active_post_id = id;
|
|
||||||
|
|
||||||
var content = document.getElementById("content-frame");
|
|
||||||
|
|
||||||
content.src = "backend.php?op=view&addheader=true&id=" + param_escape(id);
|
|
||||||
markHeadline(active_post_id);
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
function timeout() {
|
function timeout() {
|
||||||
scheduleFeedUpdate(true);
|
scheduleFeedUpdate(true);
|
||||||
setTimeout("timeout()", 1800*1000);
|
setTimeout("timeout()", 1800*1000);
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
<iframe name="headlines-frame"
|
<iframe name="headlines-frame"
|
||||||
id="headlines-frame" class="headlinesFrame"> </iframe>
|
id="headlines-frame" class="headlinesFrame"> </iframe>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr><tr>
|
||||||
<td class="content" id="content" valign="top">
|
<td class="content" id="content" valign="top">
|
||||||
<iframe name="content-frame" id="content-frame" class="contentFrame"> </iframe>
|
<iframe name="content-frame" id="content-frame" class="contentFrame"> </iframe>
|
||||||
</td>
|
</td>
|
||||||
|
|
55
viewfeed.js
55
viewfeed.js
|
@ -1,4 +1,5 @@
|
||||||
var active_post_id;
|
var active_feed_id = false;
|
||||||
|
var active_post_id = false;
|
||||||
var total_unread = 0;
|
var total_unread = 0;
|
||||||
|
|
||||||
var xmlhttp_rpc = false;
|
var xmlhttp_rpc = false;
|
||||||
|
@ -22,7 +23,7 @@ if (!xmlhttp_rpc && typeof XMLHttpRequest!='undefined') {
|
||||||
xmlhttp_rpc = new XMLHttpRequest();
|
xmlhttp_rpc = new XMLHttpRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
function view(id,feed_id) {
|
function view(id, feed_id) {
|
||||||
|
|
||||||
enableHotkeys();
|
enableHotkeys();
|
||||||
|
|
||||||
|
@ -60,6 +61,7 @@ function view(id,feed_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
active_post_id = id;
|
active_post_id = id;
|
||||||
|
active_feed_id = feed_id;
|
||||||
|
|
||||||
var content = parent.document.getElementById("content-frame");
|
var content = parent.document.getElementById("content-frame");
|
||||||
|
|
||||||
|
@ -100,4 +102,53 @@ function toggleMark(id, toggle) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function moveToPost(mode) {
|
||||||
|
|
||||||
|
var rows = getVisibleHeadlineIds();
|
||||||
|
|
||||||
|
var prev_id;
|
||||||
|
var next_id;
|
||||||
|
|
||||||
|
if (active_post_id == false) {
|
||||||
|
next_id = getFirstVisibleHeadlineId();
|
||||||
|
prev_id = getLastVisibleHeadlineId();
|
||||||
|
} else {
|
||||||
|
for (var i = 0; i < rows.length; i++) {
|
||||||
|
if (rows[i] == active_post_id) {
|
||||||
|
prev_id = rows[i-1];
|
||||||
|
next_id = rows[i+1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == "next") {
|
||||||
|
if (next_id != undefined) {
|
||||||
|
view(next_id, active_feed_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == "prev") {
|
||||||
|
if ( prev_id != undefined) {
|
||||||
|
view(prev_id, active_feed_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function localHotkeyHandler(keycode) {
|
||||||
|
|
||||||
|
if (keycode == 78) {
|
||||||
|
return moveToPost('next');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keycode == 80) {
|
||||||
|
return moveToPost('prev');
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME
|
||||||
|
// if (keycode == 85) {
|
||||||
|
// return viewfeed(active_feed_id, active_offset, "ForceUpdate");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// alert("KC: " + keycode);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue