]>
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 if (crow
.className
.match("Unread")) {
35 var umark
= parent
.document
.getElementById("FEEDU-" + feed_id
);
36 umark
.innerHTML
= umark
.innerHTML
- 1;
37 crow
.className
= crow
.className
.replace("Unread", "");
39 if (umark
.innerHTML
== "0") {
40 var feedr
= parent
.document
.getElementById("FEEDR-" + feed_id
);
41 feedr
.className
= feedr
.className
.replace("Unread", "");
47 cleanSelected("headlinesList");
49 var upd_img_pic
= document
.getElementById("FUPDPIC-" + id
);
52 upd_img_pic
.innerHTML
= "";
55 var unread_rows
= getVisibleUnreadHeadlines();
57 if (unread_rows
.length
== 0) {
58 var button
= document
.getElementById("btnCatchupPage");
60 button
.className
= "disabledButton";
66 active_feed_id
= feed_id
;
68 var content
= parent
.document
.getElementById("content-frame");
71 content
.src
= "backend.php?op=view&addheader=true&id=" + param_escape(id
);
72 markHeadline(active_post_id
);
77 function toggleMark(id
, toggle
) {
79 if (!xmlhttp_ready(xmlhttp_rpc
)) {
84 var mark_img
= document
.getElementById("FMARKPIC-" + id
);
86 var query
= "backend.php?op=rpc&id=" + id
+ "&subop=mark";
89 mark_img
.src
= "images/mark_set.png";
90 mark_img
.alt
= "Reset mark";
91 mark_img
.setAttribute('onclick', 'javascript:toggleMark('+id
+', false)');
92 query
= query
+ "&mark=1";
94 mark_img
.src
= "images/mark_unset.png";
95 mark_img
.alt
= "Set mark";
96 mark_img
.setAttribute('onclick', 'javascript:toggleMark('+id
+', true)');
97 query
= query
+ "&mark=0";
100 xmlhttp_rpc
.open("GET", query
, true);
101 xmlhttp_rpc
.onreadystatechange
=rpc_notify_callback
;
102 xmlhttp_rpc
.send(null);
106 function moveToPost(mode
) {
108 var rows
= getVisibleHeadlineIds();
113 if (active_post_id
== false) {
114 next_id
= getFirstVisibleHeadlineId();
115 prev_id
= getLastVisibleHeadlineId();
117 for (var i
= 0; i
< rows
.length
; i
++) {
118 if (rows
[i
] == active_post_id
) {
125 if (mode
== "next") {
126 if (next_id
!= undefined) {
127 view(next_id
, active_feed_id
);
131 if (mode
== "prev") {
132 if ( prev_id
!= undefined) {
133 view(prev_id
, active_feed_id
);
138 function localHotkeyHandler(keycode
) {
141 return moveToPost('next');
145 return moveToPost('prev');
149 // if (keycode == 85) {
150 // return viewfeed(active_feed_id, active_offset, "ForceUpdate");
153 // alert("KC: " + keycode);