]>
git.wh0rd.org - tt-rss.git/blob - viewfeed.js
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 mark_img
= document
.getElementById("FMARKPIC-" + id
);
92 var query
= "backend.php?op=rpc&id=" + id
+ "&subop=mark";
94 var vfeedu
= f_document
.getElementById("FEEDU--1");
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
) vfeedu
.innerHTML
= (+vfeedu
.innerHTML
) + 1;
107 mark_img
.src
= "images/mark_unset.png";
108 mark_img
.alt
= "Set mark";
109 mark_img
.setAttribute('onclick', 'javascript:toggleMark('+id
+', true)');
110 query
= query
+ "&mark=0";
112 if (vfeedu
) vfeedu
.innerHTML
= (+vfeedu
.innerHTML
) - 1;
116 var vfeedctr
= f_document
.getElementById("FEEDCTR--1");
118 if (vfeedu
&& vfeedctr
) {
119 if ((+vfeedu
.innerHTML
) > 0) {
120 vfeedctr
.className
= "odd";
122 vfeedctr
.className
= "invisible";
126 xmlhttp_rpc
.open("GET", query
, true);
127 xmlhttp_rpc
.onreadystatechange
=rpc_notify_callback
;
128 xmlhttp_rpc
.send(null);
132 function moveToPost(mode
) {
134 var rows
= getVisibleHeadlineIds();
139 if (active_post_id
== false) {
140 next_id
= getFirstVisibleHeadlineId();
141 prev_id
= getLastVisibleHeadlineId();
143 for (var i
= 0; i
< rows
.length
; i
++) {
144 if (rows
[i
] == active_post_id
) {
151 if (mode
== "next") {
152 if (next_id
!= undefined) {
153 view(next_id
, getActiveFeedId());
157 if (mode
== "prev") {
158 if ( prev_id
!= undefined) {
159 view(prev_id
, getActiveFeedId());
164 function localHotkeyHandler(keycode
) {
167 return moveToPost('next');
171 return moveToPost('prev');
175 // if (keycode == 85) {
176 // return viewfeed(active_feed_id, active_offset, "ForceUpdate");
179 // alert("KC: " + keycode);