1 var active_post_id = false;
4 var xmlhttp_rpc = false;
7 /*@if (@_jscript_version >= 5)
8 // JScript gives us Conditional compilation, we can cope with old IE versions.
9 // and security blocked creation of the objects.
11 xmlhttp_rpc = new ActiveXObject("Msxml2.XMLHTTP");
14 xmlhttp_rpc = new ActiveXObject("Microsoft.XMLHTTP");
21 if (!xmlhttp_rpc && typeof XMLHttpRequest!='undefined') {
22 xmlhttp_rpc = new XMLHttpRequest();
25 function view(id, feed_id) {
27 // p_notify("Loading article...");
29 var f_document = parent.frames["feeds-frame"].document;
30 var h_document = document;
31 var m_document = parent.document;
35 var crow = h_document.getElementById("RROW-" + id);
37 if (crow.className.match("Unread")) {
38 var umark = f_document.getElementById("FEEDU-" + feed_id);
40 umark.innerHTML = umark.innerHTML - 1;
41 crow.className = crow.className.replace("Unread", "");
43 if (umark.innerHTML == "0") {
44 var feedr = f_document.getElementById("FEEDR-" + feed_id);
45 feedr.className = feedr.className.replace("Unread", "");
47 var feedctr = f_document.getElementById("FEEDCTR-" + feed_id);
50 feedctr.className = "invisible";
58 cleanSelected("headlinesList");
60 var upd_img_pic = h_document.getElementById("FUPDPIC-" + id);
63 upd_img_pic.src = "images/blank_icon.gif";
66 var unread_rows = getVisibleUnreadHeadlines();
68 if (unread_rows.length == 0) {
69 var button = h_document.getElementById("btnCatchupPage");
71 button.className = "disabledButton";
77 setActiveFeedId(feed_id);
79 var content = m_document.getElementById("content-frame");
82 content.src = "backend.php?op=view&addheader=true&id=" + param_escape(id);
83 markHeadline(active_post_id);
89 function toggleMark(id, toggle) {
91 var f_document = parent.frames["feeds-frame"].document;
93 if (!xmlhttp_ready(xmlhttp_rpc)) {
98 var mark_img = document.getElementById("FMARKPIC-" + id);
100 var query = "backend.php?op=rpc&id=" + id + "&subop=mark";
102 var vfeedu = f_document.getElementById("FEEDU--1");
106 if (toggle == true) {
107 mark_img.src = "images/mark_set.png";
108 mark_img.alt = "Reset mark";
109 mark_img.setAttribute('onclick', 'javascript:toggleMark('+id+', false)');
110 query = query + "&mark=1";
112 if (vfeedu) vfeedu.innerHTML = (+vfeedu.innerHTML) + 1;
115 mark_img.src = "images/mark_unset.png";
116 mark_img.alt = "Set mark";
117 mark_img.setAttribute('onclick', 'javascript:toggleMark('+id+', true)');
118 query = query + "&mark=0";
120 if (vfeedu) vfeedu.innerHTML = (+vfeedu.innerHTML) - 1;
124 var vfeedctr = f_document.getElementById("FEEDCTR--1");
126 if (vfeedu && vfeedctr) {
127 if ((+vfeedu.innerHTML) > 0) {
128 vfeedctr.className = "odd";
130 vfeedctr.className = "invisible";
134 xmlhttp_rpc.open("GET", query, true);
135 xmlhttp_rpc.onreadystatechange=rpc_notify_callback;
136 xmlhttp_rpc.send(null);
140 function moveToPost(mode) {
142 var rows = getVisibleHeadlineIds();
147 if (active_post_id == false) {
148 next_id = getFirstVisibleHeadlineId();
149 prev_id = getLastVisibleHeadlineId();
151 for (var i = 0; i < rows.length; i++) {
152 if (rows[i] == active_post_id) {
159 if (mode == "next") {
160 if (next_id != undefined) {
161 view(next_id, getActiveFeedId());
165 if (mode == "prev") {
166 if ( prev_id != undefined) {
167 view(prev_id, getActiveFeedId());
172 function localHotkeyHandler(keycode) {
175 return moveToPost('next');
179 return moveToPost('prev');
183 // if (keycode == 85) {
184 // return viewfeed(active_feed_id, active_offset, "ForceUpdate");
187 // alert("KC: " + keycode);