]>
git.wh0rd.org - tt-rss.git/blob - viewfeed.js
1 var active_feed_id
= false;
2 var active_post_id
= false;
5 var xmlhttp_rpc
= false;
8 /*@if (@_jscript_version >= 5)
9 // JScript gives us Conditional compilation, we can cope with old IE versions.
10 // and security blocked creation of the objects.
12 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
15 xmlhttp_rpc = new ActiveXObject("Microsoft.XMLHTTP");
22 if (!xmlhttp_rpc
&& typeof XMLHttpRequest
!='undefined') {
23 xmlhttp_rpc
= new XMLHttpRequest();
26 function view(id
, feed_id
) {
28 // p_notify("Loading article...");
32 var crow
= document
.getElementById("RROW-" + id
);
34 var f_doc
= parent
.frames
["feeds-frame"].document
;
36 if (crow
.className
.match("Unread")) {
37 var umark
= f_doc
.getElementById("FEEDU-" + feed_id
);
39 umark
.innerHTML
= umark
.innerHTML
- 1;
40 crow
.className
= crow
.className
.replace("Unread", "");
42 if (umark
.innerHTML
== "0") {
43 var feedr
= f_doc
.getElementById("FEEDR-" + feed_id
);
44 feedr
.className
= feedr
.className
.replace("Unread", "");
46 var feedctr
= f_doc
.getElementById("FEEDCTR-" + feed_id
);
49 feedctr
.innerHTML
= "";
57 cleanSelected("headlinesList");
59 var upd_img_pic
= document
.getElementById("FUPDPIC-" + id
);
62 upd_img_pic
.innerHTML
= "";
65 var unread_rows
= getVisibleUnreadHeadlines();
67 if (unread_rows
.length
== 0) {
68 var button
= document
.getElementById("btnCatchupPage");
70 button
.className
= "disabledButton";
76 active_feed_id
= feed_id
;
78 var content
= parent
.document
.getElementById("content-frame");
81 content
.src
= "backend.php?op=view&addheader=true&id=" + param_escape(id
);
82 markHeadline(active_post_id
);
87 function toggleMark(id
, toggle
) {
89 if (!xmlhttp_ready(xmlhttp_rpc
)) {
94 var mark_img
= document
.getElementById("FMARKPIC-" + id
);
96 var query
= "backend.php?op=rpc&id=" + id
+ "&subop=mark";
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 mark_img
.src
= "images/mark_unset.png";
105 mark_img
.alt
= "Set mark";
106 mark_img
.setAttribute('onclick', 'javascript:toggleMark('+id
+', true)');
107 query
= query
+ "&mark=0";
110 xmlhttp_rpc
.open("GET", query
, true);
111 xmlhttp_rpc
.onreadystatechange
=rpc_notify_callback
;
112 xmlhttp_rpc
.send(null);
116 function moveToPost(mode
) {
118 var rows
= getVisibleHeadlineIds();
123 if (active_post_id
== false) {
124 next_id
= getFirstVisibleHeadlineId();
125 prev_id
= getLastVisibleHeadlineId();
127 for (var i
= 0; i
< rows
.length
; i
++) {
128 if (rows
[i
] == active_post_id
) {
135 if (mode
== "next") {
136 if (next_id
!= undefined) {
137 view(next_id
, active_feed_id
);
141 if (mode
== "prev") {
142 if ( prev_id
!= undefined) {
143 view(prev_id
, active_feed_id
);
148 function localHotkeyHandler(keycode
) {
151 return moveToPost('next');
155 return moveToPost('prev');
159 // if (keycode == 85) {
160 // return viewfeed(active_feed_id, active_offset, "ForceUpdate");
163 // alert("KC: " + keycode);