]>
Commit | Line | Data |
---|---|---|
007bda35 AD |
1 | /* |
2 | This program is Copyright (c) 2003-2005 Andrew Dolgov <cthulhoo@gmail.com> | |
3 | Licensed under GPL v.2 or (at your preference) any later version. | |
4 | */ | |
5 | ||
6 | var xmlhttp = false; | |
7 | ||
8 | /*@cc_on @*/ | |
9 | /*@if (@_jscript_version >= 5) | |
10 | // JScript gives us Conditional compilation, we can cope with old IE versions. | |
11 | // and security blocked creation of the objects. | |
12 | try { | |
13 | xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); | |
14 | } catch (e) { | |
15 | try { | |
16 | xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); | |
17 | } catch (E) { | |
18 | xmlhttp = false; | |
19 | } | |
20 | } | |
21 | @end @*/ | |
22 | ||
23 | if (!xmlhttp && typeof XMLHttpRequest!='undefined') { | |
24 | xmlhttp = new XMLHttpRequest(); | |
25 | } | |
26 | ||
27 | function param_escape(arg) { | |
28 | if (typeof encodeURIComponent != 'undefined') | |
29 | return encodeURIComponent(arg); | |
30 | else | |
31 | return escape(arg); | |
32 | } | |
33 | ||
34 | function param_unescape(arg) { | |
35 | if (typeof decodeURIComponent != 'undefined') | |
36 | return decodeURIComponent(arg); | |
37 | else | |
38 | return unescape(arg); | |
39 | } | |
40 | ||
41 | function notify(msg) { | |
42 | ||
43 | var n = document.getElementById("notify"); | |
44 | ||
45 | n.innerHTML = msg; | |
46 | ||
857a9270 AD |
47 | if (msg.length == 0) { |
48 | n.style.display = "none"; | |
49 | } else { | |
50 | n.style.display = "block"; | |
51 | } | |
52 | ||
007bda35 AD |
53 | } |
54 | ||
55 | function feedlist_callback() { | |
56 | var container = document.getElementById('feeds'); | |
57 | if (xmlhttp.readyState == 4) { | |
58 | container.innerHTML=xmlhttp.responseText; | |
59 | } | |
60 | } | |
61 | ||
62 | function update_feeds() { | |
63 | ||
64 | document.getElementById("feeds").innerHTML = "Loading feeds, please wait..."; | |
65 | ||
66 | xmlhttp.open("GET", "backend.php?op=pref-feeds", true); | |
67 | xmlhttp.onreadystatechange=feedlist_callback; | |
68 | xmlhttp.send(null); | |
69 | ||
70 | } | |
71 | ||
72 | function toggleSelectRow(sender) { | |
73 | var parent_row = sender.parentNode.parentNode; | |
74 | ||
75 | if (sender.checked) { | |
76 | if (!parent_row.className.match("Selected")) { | |
77 | parent_row.className = parent_row.className + "Selected"; | |
78 | } | |
79 | } else { | |
80 | if (parent_row.className.match("Selected")) { | |
81 | parent_row.className = parent_row.className.replace("Selected", ""); | |
82 | } | |
83 | } | |
84 | } | |
85 | ||
71ad3959 AD |
86 | function addFeed() { |
87 | ||
88 | var link = document.getElementById("fadd_link").value; | |
89 | var title = document.getElementById("fadd_title").value; | |
90 | ||
91 | if (link.length == 0 || title.length == 0) { | |
92 | notify("Error: all fields must be filled in."); | |
93 | } else { | |
94 | notify("addFeed : " + link + ", " + title); | |
95 | } | |
96 | ||
97 | } | |
007bda35 AD |
98 | |
99 | function init() { | |
857a9270 | 100 | |
007bda35 AD |
101 | update_feeds(); |
102 | ||
857a9270 AD |
103 | notify(""); |
104 | ||
007bda35 | 105 | } |