From 6361fd20fd89ba4bbda585066550b16a058eed43 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 10 Sep 2010 17:45:59 +0400 Subject: [PATCH] rudimentary support for starring/publishing articles in digest --- digest.css | 4 +- digest.js | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+), 1 deletion(-) diff --git a/digest.css b/digest.css index 30009a68a..b0d17b4fc 100644 --- a/digest.css +++ b/digest.css @@ -141,9 +141,11 @@ a:hover { } #headlines ul#headlines-content img.digest-check { - float : right; cursor : pointer; +} +#headlines ul#headlines-content div.digest-check { + float : right; } #headlines ul#headlines-content img { diff --git a/digest.js b/digest.js index 8b1a8f0ce..2a886a89b 100644 --- a/digest.js +++ b/digest.js @@ -203,7 +203,11 @@ function add_headline_entry(article, feed) { var tmp_html = "
  • " + icon_part + + "
    " + + "" + + "" + "" + + "
    " + "" + article.title + "" + @@ -296,3 +300,117 @@ function digest_init() { exception_error("digest_init", e); } } + +function tMark_afh_off(effect) { + try { + var elem = effect.effects[0].element; + + console.log("tMark_afh_off : " + elem.id); + + if (elem) { + elem.src = elem.src.replace("mark_set", "mark_unset"); + elem.alt = __("Star article"); + Element.show(elem); + } + + } catch (e) { + exception_error("tMark_afh_off", e); + } +} + +function tPub_afh_off(effect) { + try { + var elem = effect.effects[0].element; + + console.log("tPub_afh_off : " + elem.id); + + if (elem) { + elem.src = elem.src.replace("pub_set", "pub_unset"); + elem.alt = __("Publish article"); + Element.show(elem); + } + + } catch (e) { + exception_error("tPub_afh_off", e); + } +} + +function toggleMark(mark_img, id) { + + try { + + var query = "?op=rpc&id=" + id + "&subop=mark"; + + query = query + "&afid=" + _active_feed_id; + query = query + "&omode=c"; + + if (!mark_img) return; + + var vfeedu = $("FEEDU--1"); + var crow = $("RROW-" + id); + + if (mark_img.src.match("mark_unset")) { + mark_img.src = mark_img.src.replace("mark_unset", "mark_set"); + mark_img.alt = __("Unstar article"); + query = query + "&mark=1"; + } else { + mark_img.alt = __("Please wait..."); + query = query + "&mark=0"; + + mark_img.src = mark_img.src.replace("mark_set", "mark_unset"); + mark_img.alt = __("Star article"); + } + + new Ajax.Request("backend.php", { + parameters: query, + onComplete: function(transport) { + // + } }); + + } catch (e) { + exception_error("toggleMark", e); + } +} + +function togglePub(mark_img, id, note) { + + try { + + var query = "?op=rpc&id=" + id + "&subop=publ"; + + query = query + "&afid=" + _active_feed_id; + + if (note != undefined) { + query = query + "¬e=" + param_escape(note); + } else { + query = query + "¬e=undefined"; + } + + query = query + "&omode=c"; + + if (!mark_img) return; + + if (mark_img.src.match("pub_unset") || note != undefined) { + mark_img.src = mark_img.src.replace("pub_unset", "pub_set"); + mark_img.alt = __("Unpublish article"); + query = query + "&pub=1"; + + } else { + mark_img.alt = __("Please wait..."); + query = query + "&pub=0"; + + mark_img.src = mark_img.src.replace("pub_set", "pub_unset"); + mark_img.alt = __("Publish article"); + } + + new Ajax.Request("backend.php", { + parameters: query, + onComplete: function(transport) { + // + } }); + + } catch (e) { + exception_error("togglePub", e); + } +} +