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";
57 crow.className = crow.className.replace("Unread", "");
59 cleanSelected("headlinesList");
61 var upd_img_pic = h_document.getElementById("FUPDPIC-" + id);
64 upd_img_pic.src = "images/blank_icon.gif";
68 setActiveFeedId(feed_id);
70 var content = m_document.getElementById("content-frame");
73 content.src = "backend.php?op=view&addheader=true&id=" + param_escape(id) +
74 "&feed=" + param_escape(feed_id);
75 markHeadline(active_post_id);
81 function toggleMark(id, toggle) {
83 var f_document = parent.frames["feeds-frame"].document;
85 if (!xmlhttp_ready(xmlhttp_rpc)) {
90 var query = "backend.php?op=rpc&id=" + id + "&subop=mark";
92 var mark_img = document.getElementById("FMARKPIC-" + id);
93 var vfeedu = f_document.getElementById("FEEDU--1");
94 var crow = document.getElementById("RROW-" + id);
99 mark_img.src = "images/mark_set.png";
100 mark_img.alt = "Reset mark";
101 mark_img.setAttribute('onclick', 'javascript:toggleMark('+id+', false)');
102 query = query + "&mark=1";
104 if (vfeedu && crow.className.match("Unread")) {
105 vfeedu.innerHTML = (+vfeedu.innerHTML) + 1;
109 mark_img.src = "images/mark_unset.png";
110 mark_img.alt = "Set mark";
111 mark_img.setAttribute('onclick', 'javascript:toggleMark('+id+', true)');
112 query = query + "&mark=0";
114 if (vfeedu && crow.className.match("Unread")) {
115 vfeedu.innerHTML = (+vfeedu.innerHTML) - 1;
120 var vfeedctr = f_document.getElementById("FEEDCTR--1");
121 var vfeedr = f_document.getElementById("FEEDR--1");
123 if (vfeedu && vfeedctr) {
124 if ((+vfeedu.innerHTML) > 0) {
125 if (crow.className.match("Unread") && !vfeedr.className.match("Unread")) {
126 vfeedr.className = vfeedr.className + "Unread";
127 vfeedctr.className = "odd";
130 vfeedctr.className = "invisible";
131 vfeedr.className = vfeedr.className.replace("Unread", "");
135 xmlhttp_rpc.open("GET", query, true);
136 xmlhttp_rpc.onreadystatechange=rpc_notify_callback;
137 xmlhttp_rpc.send(null);
141 function moveToPost(mode) {
143 var rows = getVisibleHeadlineIds();
148 if (active_post_id == false) {
149 next_id = getFirstVisibleHeadlineId();
150 prev_id = getLastVisibleHeadlineId();
152 for (var i = 0; i < rows.length; i++) {
153 if (rows[i] == active_post_id) {
160 if (mode == "next") {
161 if (next_id != undefined) {
162 view(next_id, getActiveFeedId());
166 if (mode == "prev") {
167 if ( prev_id != undefined) {
168 view(prev_id, getActiveFeedId());
173 function localHotkeyHandler(keycode) {
176 return moveToPost('next');
180 return moveToPost('prev');
184 // if (keycode == 85) {
185 // return viewfeed(active_feed_id, active_offset, "ForceUpdate");
188 // alert("KC: " + keycode);