From 779ba0752b4d4ee206d037d0a40455e455806bcd Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 4 Feb 2009 15:42:59 +0300 Subject: [PATCH] offline: add CDM generator --- offline.js | 128 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 97 insertions(+), 31 deletions(-) diff --git a/offline.js b/offline.js index 8480035e..2ce8920a 100644 --- a/offline.js +++ b/offline.js @@ -139,10 +139,22 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off tmp += feed_title; tmp += ""; - var sel_all_link = "javascript:selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, '', true)"; - var sel_unread_link = "javascript:selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, 'Unread', true)"; - var sel_none_link = "javascript:selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false)"; - var sel_inv_link = "javascript:invertHeadlineSelection()"; + var sel_all_link; + var sel_unread_link; + var sel_none_link; + var sel_inv_link; + + if (document.getElementById("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)"; + sel_inv_link = "javascript:invertHeadlineSelection()"; + } else { + sel_all_link = "javascript:cdmSelectArticles('all')"; + sel_unread_link = "javascript:cdmSelectArticles('unread')"; + sel_none_link = "javascript:cdmSelectArticles('none')"; + sel_inv_link = "javascript:invertHeadlineSelection()"; + } tmp += __('Select:')+ " "+__('All')+", "+ @@ -155,8 +167,9 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off tmp += ""; tmp += "
"; - - tmp += ""; + if (document.getElementById("content-frame")) { + tmp += "
"; + } } @@ -242,37 +255,86 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off var mouseover_attrs = "onmouseover='postMouseIn($id)' "+ "onmouseout='postMouseOut($id)'"; + + var content_preview = truncate_string(strip_tags(rs.fieldByName("content")), + 100); - tmp += ""; - - tmp += ""; + if (document.getElementById("content-frame")) { - tmp += ""; - - tmp += ""; + tmp += ""; + + tmp += ""; - tmp += ""; + + tmp += ""; + + tmp += ""; + tmp += " - "+content_preview+""; + + tmp += ""; - tmp += ""; + tmp += ""; + + tmp += ""; + + tmp += ""; + } else { - tmp += ""; + var add_class = ""; + + if (rs.fieldByName("unread") == "1") { + add_class = "Unread"; + } + + tmp += "
"; + + tmp += "
"; + tmp += "
"+ + rs.fieldByName("updated").substring(0,16)+"
"; + + tmp += ""+ + ""+rs.fieldByName("title")+""; + tmp += "
"; + + tmp += "
"; + tmp += rs.fieldByName("content"); + tmp += "
" + tmp += "
"; + + tmp += "
"; + tmp += __("Select:")+ + " "; + + tmp += ""+marked_pic+" "; + + tmp += ""+ + "Tags"+ + ""+rs.fieldByName("tags")+""+ + ""; + + tmp += "Toggle: "+ + "Unread"; + tmp += "
"; + + tmp += "
"; + } rs.next(); line_num++; @@ -651,6 +713,10 @@ function init_gears() { 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, comments text)"); + + + db.execute("DELETE FROM cache WHERE id LIKE 'F:%' OR id LIKE 'C:%'"); + window.setTimeout("update_offline_data(0)", 100); } -- 2.39.5
"+ - ""+marked_pic+"
"; + tmp += ""+ + ""+marked_pic+""; + + tmp += ""+ + rs.fieldByName("title"); - tmp += ""+ - rs.fieldByName("title"); - - var content_preview = truncate_string(strip_tags(rs.fieldByName("content")), - 100); - - tmp += " - "+content_preview+""; - - tmp += ""; - - tmp += ""+ - ""+rs.fieldByName("updated").substring(0,16)+""+ + ""+rs.fieldByName("updated").substring(0,16)+"