var SCHEMA_VERSION = 3;
var offline_mode = false;
var store = false;
var localServer = false;
var db = false;
function view_offline(id, feed_id) {
try {
enableHotkeys();
showArticleInHeadlines(id);
db.execute("UPDATE articles SET unread = 0 WHERE id = ?", [id]);
var rs = db.execute("SELECT * FROM articles WHERE id = ?", [id]);
if (rs.isValidRow()) {
var tmp = "
";
tmp += "";
tmp += "
"
tmp += rs.fieldByName("content");
tmp += "
";
tmp += "
";
render_article(tmp);
update_local_feedlist_counters();
}
rs.close();
return false;
} catch (e) {
exception_error("view_offline", e);
}
}
function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, offset) {
try {
notify('');
if (!offset) offset = 0;
if (offset > 0) {
_feed_cur_page = parseInt(offset);
if (_infscroll_request_sent) {
return;
}
} else {
_feed_cur_page = 0;
_infscroll_disable = 0;
}
if (getActiveFeedId() != feed_id) {
_feed_cur_page = 0;
active_post_id = 0;
_infscroll_disable = 0;
}
loading_set_progress(100);
clean_feed_selections();
setActiveFeedId(feed_id, is_cat);
if (!is_cat) {
var feedr = document.getElementById("FEEDR-" + feed_id);
if (feedr && !feedr.className.match("Selected")) {
feedr.className = feedr.className + "Selected";
}
} else {
var feedr = document.getElementById("FCAT-" + feed_id);
if (feedr && !feedr.className.match("Selected")) {
feedr.className = feedr.className + "Selected";
}
}
disableContainerChildren("headlinesToolbar", false);
Form.enable("main_toolbar_form");
var f = document.getElementById("headlines-frame");
try {
if (reply.offset == 0) {
debug("resetting headlines scrollTop");
f.scrollTop = 0;
}
} catch (e) { };
var tmp = "";
rs = db.execute("SELECT title FROM feeds WHERE id = ?", [feed_id]);
if (rs.isValidRow() || feed_id == -1 || feed_id == -4) {
feed_title = rs.field(0);
if (feed_id == -1) {
feed_title = __("Starred articles");
}
if (feed_id == -4) {
feed_title = __("All articles");
}
if (offset == 0) {
tmp += "";
}
if (offset == 0) {
var container = document.getElementById("headlines-frame");
container.innerHTML = tmp;
} else {
var ids = getSelectedArticleIds2();
var container = document.getElementById("headlinesList");
container.innerHTML = container.innerHTML + tmp;
for (var i = 0; i < ids.length; i++) {
markHeadline(ids[i]);
}
}
}
remove_splash();
_infscroll_request_sent = 0;
} catch (e) {
exception_error("viewfeed_offline", e);
}
}
function render_offline_feedlist() {
try {
var tmp = "