From c01f40f4d9c8fae847ecec5a18ff52c0a15dd57b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 9 Sep 2010 16:50:10 +0400 Subject: [PATCH] add experimental digest thingie (2) --- digest.css | 170 +++++++++++++++++++++++++++++++++++++++++++++++++++++ digest.js | 108 ++++++++++++++++++++++++++++++++++ digest.php | 113 +++++++++++++++++++++++++++++++++++ 3 files changed, 391 insertions(+) create mode 100644 digest.css create mode 100644 digest.js create mode 100644 digest.php diff --git a/digest.css b/digest.css new file mode 100644 index 000000000..5139114f0 --- /dev/null +++ b/digest.css @@ -0,0 +1,170 @@ +body { + background : #f0f0f0; + color : gray; + font-family : sans-serif; + font-size : 12px; +} + +a { + color : #0069D8; + text-decoration : none; +} + +a:hover { + color : gray; +} + +#header a, #footer a { + color : gray; +} + +#header { + font-weight : bold; + font-size : 14px; + font-family : "Lucida Grande", "Segoe UI", Tahoma, Arial, sans-serif; + margin-left : 1em; + margin-right : 1em; +} + +#header div.links { + float : right; +} + +#search { + float : right; + clear : left; + +} + +#content { + border : 1px solid #e0e0e0; + background : white; + padding : 0.8em; + margin : 0.5em; +} + +#footer { + font-size : 12px; + text-align : center; +} + +/*#content h1 { + font-weight : bold; + font-size : 25px; + font-family : "Lucida Grande", "Segoe UI", Tahoma, Arial, sans-serif; + letter-spacing : -2; + margin : 0px 0px 0.5em 0px; + color : black; +} + +#content h2 { + font-weight : bold; + font-size : 20px; + font-family : "Lucida Grande", "Segoe UI", Tahoma, Arial, sans-serif; + letter-spacing : 2; + margin : 0px 0px 0.5em 0px; + color : #684C99; +} + +#content h3 { + font-weight : bold; + font-size : 16px; + font-family : "Lucida Grande", "Segoe UI", Tahoma, Arial, sans-serif; + letter-spacing : 2; + margin : 0px 0px 0.5em 0px; + color : #659a4c; +} */ + +#content h1 { + margin : 0px 0px 20px 0px; + font-family : "Lucida Grande", "Segoe UI", Tahoma, Arial, sans-serif; + font-size : 18px; + letter-spacing : 1px; + color : #684C99; +} + +#title { +} + +#latest { + padding : 5px; +} + +#feeds { + float : right; + width : 30%; + min-width : 300px; + padding : 5px; + font-size : 14px; +} + +#feeds h1 { + text-align : right; +} + +#feeds ul#feeds-content img { + width : 16px; + height : 16px; + vertical-align : middle; + margin-right : 5px; +} + +#feeds ul#feeds-content div.unread-ctr { + color : gray; + float : right; +} + +#feeds ul#feeds-content li { + margin : 0px 0px 2px 0px; +} + +#feeds ul#feeds-content { + list-style-type : none; + font-weight : bold; + color : #659a4c; + margin : 0px; + padding : 0px; +} + +#headlines { + padding : 5px; + font-size : 14px; +} + +#headlines ul#headlines-content img { + width : 16px; + height : 16px; + vertical-align : middle; + margin-right : 5px; +} + +#headlines ul#headlines-content { + list-style-type : none; + color : gray; + margin : 0px; + padding : 0px; +} + +#headlines ul#headlines-content li { + margin : 0px 0px 10px 0px; + color : #909090; +} + +#headlines ul#headlines-content a.title { + font-weight : bold; + font-size : 16px; +} + +#headlines ul#headlines-content div.excerpt { + margin-left : 22px; + color : #404040; +} + +#headlines ul#headlines-content div.info { + margin-left : 22px; +} + +#headlines ul#headlines-content div.info a { + color : gray; +} + diff --git a/digest.js b/digest.js new file mode 100644 index 000000000..7bfd9df27 --- /dev/null +++ b/digest.js @@ -0,0 +1,108 @@ +var last_feeds = []; + +function find_feed(feeds, feed_id) { + try { + for (var i = 0; i < feeds.length; i++) { + if (feeds[i].id == feed_id) + return feeds[i]; + } + + return false; + + } catch (e) { + exception_error("find_feed", e); + } +} + +function add_feed_entry(feed) { + try { + var icon_part = ""; + + if (feed.has_icon) + icon_part = "zz"; + + var tmp_html = "
  • " + + icon_part + + feed.title + + "
    " + feed.unread + "
    " + + "
  • "; + + $("feeds-content").innerHTML += tmp_html; + + } catch (e) { + exception_error("add_feed_entry", e); + } +} + +function add_latest_entry(article) { + try { + + } catch (e) { + exception_error("add_latest_entry", e); + } +} + +function add_headline_entry(article, feed) { + try { + + var icon_part = ""; + + if (article.has_icon) + icon_part = "zz"; + + var tmp_html = "
  • " + + icon_part + + "" + article.title + "" + + "
    " + article.excerpt + "
    " + + "
    " + feed.title + " " + " @ " + + article.updated + "
    " + + "
  • "; + + $("headlines-content").innerHTML += tmp_html; + + } catch (e) { + exception_error("add_headline_entry", e); + } +} + +function digest_update(transport) { + try { + var feeds = transport.responseXML.getElementsByTagName('feeds')[0]; + var headlines = transport.responseXML.getElementsByTagName('headlines')[0]; + + if (feeds) { + last_feeds = feeds; + + feeds = eval("(" + feeds.firstChild.nodeValue + ")"); + + for (var i = 0; i < feeds.length; i++) { + add_feed_entry(feeds[i]); + } + } + + if (headlines) { + headlines = eval("(" + headlines.firstChild.nodeValue + ")"); + + for (var i = 0; i < headlines.length; i++) { + add_headline_entry(headlines[i], find_feed(feeds, headlines[i].feed_id)); + } + } + + } catch (e) { + exception_error("digest_update", e); + } + } + +function digest_init() { + try { + + new Ajax.Request("backend.php", { + parameters: "backend.php?op=rpc&subop=digest-init", + onComplete: function(transport) { + digest_update(transport); + } }); + + } catch (e) { + exception_error("digest_init", e); + } +} diff --git a/digest.php b/digest.php new file mode 100644 index 000000000..cfe16cfe4 --- /dev/null +++ b/digest.php @@ -0,0 +1,113 @@ + + + + + + Tiny Tiny Digest + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + +
    + +
    +

    latest articles

    + + TODO + +
    +
    + +
    +

    feeds

    + +
    +
    + +
    +

    headlines

    + +
    +
    + +
    + +
    + + + +