1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-24 01:41:28 +00:00

move more stuff to offline.js

This commit is contained in:
Andrew Dolgov
2009-02-04 13:36:06 +03:00
parent 1b27261c84
commit 25d9935382
3 changed files with 51 additions and 50 deletions

View File

@@ -1,3 +1,8 @@
var offline_mode = false;
var store = false;
var localServer = false;
var db = false;
function view_offline(id, feed_id) {
try {
@@ -547,4 +552,48 @@ function get_local_feed_unread(id) {
}
}
function init_gears() {
try {
if (window.google && google.gears) {
localServer = google.gears.factory.create("beta.localserver");
store = localServer.createManagedStore("tt-rss");
db = google.gears.factory.create('beta.database');
db.open('tt-rss');
db.execute("CREATE TABLE IF NOT EXISTS version (schema_version text)");
var rs = db.execute("SELECT schema_version FROM version");
var version = "";
if (rs.isValidRow()) {
version = rs.field(0);
}
if (version != SCHEMA_VERSION) {
db.execute("DROP TABLE cache");
db.execute("DROP TABLE feeds");
db.execute("DROP TABLE articles");
db.execute("INSERT INTO version (schema_version) VALUES (?)",
[SCHEMA_VERSION]);
}
db.execute("CREATE TABLE IF NOT EXISTS cache (id text, article text, param text, added text)");
db.execute("CREATE TABLE if not exists feeds (id integer, title text, has_icon integer)");
db.execute("CREATE TABLE if not exists articles (id integer, feed_id integer, title text, link text, guid text, updated text, content text, tags text, unread text, marked text, added text)");
window.setTimeout("update_offline_data(0)", 100);
}
cache_expire();
} catch (e) {
exception_error("init_gears", e);
}
}