]>
Commit | Line | Data |
---|---|---|
bb7cface | 1 | var active_post_id = false; |
4b6206fa | 2 | var last_article_view = false; |
0b126ac2 AD |
3 | var active_real_feed_id = false; |
4 | ||
ba0978c8 AD |
5 | var _cdm_wd_timeout = false; |
6 | var _cdm_wd_vishist = new Array(); | |
7 | ||
e097e8be AD |
8 | var article_cache = new Array(); |
9 | ||
081e527d | 10 | var vgroup_last_feed = false; |
314fcd2b | 11 | var post_under_pointer = false; |
081e527d | 12 | |
022d9e9e AD |
13 | var last_requested_article = false; |
14 | ||
b39b57ac AD |
15 | var preload_id_batch = []; |
16 | var preload_timeout_id = false; | |
17 | ||
18 | var cache_added = []; | |
19 | ||
1341ea0d AD |
20 | function catchup_callback2(transport, callback) { |
21 | try { | |
84c7b824 | 22 | console.log("catchup_callback2 " + transport + ", " + callback); |
1341ea0d | 23 | notify(""); |
f8fb4498 | 24 | handle_rpc_reply(transport); |
1341ea0d AD |
25 | if (callback) { |
26 | setTimeout(callback, 10); | |
27 | } | |
28 | } catch (e) { | |
273d1e29 | 29 | exception_error("catchup_callback2", e, transport); |
1341ea0d AD |
30 | } |
31 | } | |
32 | ||
3d72bbdb | 33 | function headlines_callback2(transport, feed_cur_page) { |
e19c1824 AD |
34 | try { |
35 | ||
f8fb4498 | 36 | if (!handle_rpc_reply(transport)) return; |
9ca945a6 | 37 | |
730dbf19 AD |
38 | loading_set_progress(100); |
39 | ||
84c7b824 | 40 | console.log("headlines_callback2 [page=" + feed_cur_page + "]"); |
e19c1824 | 41 | |
2184738a AD |
42 | if (!transport_error_check(transport)) return; |
43 | ||
3d72bbdb AD |
44 | var is_cat = false; |
45 | var feed_id = false; | |
ac541432 | 46 | |
3d72bbdb AD |
47 | if (transport.responseXML) { |
48 | var headlines = transport.responseXML.getElementsByTagName("headlines")[0]; | |
49 | if (headlines) { | |
50 | is_cat = headlines.getAttribute("is_cat"); | |
51 | feed_id = headlines.getAttribute("id"); | |
52 | setActiveFeedId(feed_id, is_cat); | |
53 | } | |
6c3b0198 | 54 | } |
f46192bb | 55 | |
428b704d AD |
56 | var update_btn = document.forms["main_toolbar_form"].update; |
57 | ||
58 | update_btn.disabled = !(feed_id >= 0 && !is_cat); | |
59 | ||
6c3b0198 AD |
60 | try { |
61 | if (feed_cur_page == 0) { | |
fcf70c51 | 62 | $("headlines-frame").scrollTop = 0; |
a49f5e05 | 63 | } |
6c3b0198 AD |
64 | } catch (e) { }; |
65 | ||
66 | if (transport.responseXML) { | |
ffbe082d | 67 | var response = transport.responseXML; |
e19c1824 | 68 | |
ffbe082d | 69 | var headlines = response.getElementsByTagName("headlines")[0]; |
6e4f4ce1 AD |
70 | |
71 | var headlines_content = headlines.getElementsByTagName("content")[0]; | |
72 | var headlines_toolbar = headlines.getElementsByTagName("toolbar")[0]; | |
73 | ||
ffbe082d | 74 | var headlines_info = response.getElementsByTagName("headlines-info")[0]; |
081e527d | 75 | |
ffbe082d AD |
76 | if (headlines_info) |
77 | headlines_info = JSON.parse(headlines_info.firstChild.nodeValue); | |
f8fb4498 AD |
78 | else { |
79 | console.error("didn't find headlines-info object in response"); | |
80 | return; | |
81 | } | |
e19c1824 | 82 | |
ffbe082d AD |
83 | var headlines_count = headlines_info.count; |
84 | var headlines_unread = headlines_info.unread; | |
85 | var disable_cache = headlines_info.disable_cache; | |
86 | ||
87 | vgroup_last_feed = headlines_info.vgroup_last_feed; | |
081e527d | 88 | |
7d12b6c8 | 89 | if (parseInt(headlines_count) < getInitParam("default_article_limit")) { |
587bef10 AD |
90 | _infscroll_disable = 1; |
91 | } else { | |
92 | _infscroll_disable = 0; | |
93 | } | |
94 | ||
ffbe082d AD |
95 | var counters = response.getElementsByTagName("counters")[0]; |
96 | var articles = response.getElementsByTagName("article"); | |
97 | var runtime_info = response.getElementsByTagName("runtime-info"); | |
6c3b0198 AD |
98 | |
99 | if (feed_cur_page == 0) { | |
100 | if (headlines) { | |
6e4f4ce1 AD |
101 | $("headlinesInnerContainer").innerHTML = headlines_content.firstChild.nodeValue; |
102 | $("headlines-toolbar").innerHTML = headlines_toolbar.firstChild.nodeValue; | |
103 | ||
fcf70c51 | 104 | dojo.parser.parse("headlines-toolbar"); |
9c99281f | 105 | //dijit.byId("main").resize(); |
e19c1824 | 106 | |
dd5865d4 AD |
107 | var cache_prefix = ""; |
108 | ||
109 | if (is_cat) { | |
110 | cache_prefix = "C:"; | |
111 | } else { | |
112 | cache_prefix = "F:"; | |
113 | } | |
114 | ||
3d72bbdb | 115 | cache_invalidate(cache_prefix + feed_id); |
7e8832b3 | 116 | |
52d7e7da | 117 | if (!disable_cache) { |
3d72bbdb | 118 | cache_inject(cache_prefix + feed_id, |
fcf70c51 | 119 | $("headlines-frame").innerHTML, headlines_unread); |
52d7e7da | 120 | } |
e19c1824 | 121 | |
6c3b0198 | 122 | } else { |
f8fb4498 | 123 | console.warn("headlines_callback: returned no data"); |
fcf70c51 | 124 | $('headlinesInnerContainer').innerHTML = "<div class='whiteBox'>" + __('Could not update headlines (missing XML data)') + "</div>"; |
6c3b0198 AD |
125 | |
126 | } | |
127 | } else { | |
128 | if (headlines) { | |
129 | if (headlines_count > 0) { | |
5ae8f858 | 130 | console.log("adding some more headlines..."); |
6c3b0198 | 131 | |
8cc5e965 | 132 | c = $("headlinesInnerContainer"); |
c32cd48a AD |
133 | |
134 | var ids = getSelectedArticleIds2(); | |
6c3b0198 AD |
135 | |
136 | c.innerHTML = c.innerHTML + headlines.firstChild.nodeValue; | |
c32cd48a | 137 | |
84c7b824 | 138 | console.log("restore selected ids: " + ids); |
c32cd48a AD |
139 | |
140 | for (var i = 0; i < ids.length; i++) { | |
141 | markHeadline(ids[i]); | |
142 | } | |
143 | ||
6c3b0198 | 144 | } else { |
84c7b824 | 145 | console.log("no new headlines received"); |
29dfb258 | 146 | } |
29dfb258 | 147 | } else { |
f8fb4498 | 148 | console.warn("headlines_callback: returned no data"); |
6c3b0198 AD |
149 | notify_error("Error while trying to load more headlines"); |
150 | } | |
730dbf19 | 151 | |
6c3b0198 AD |
152 | } |
153 | ||
154 | if (articles) { | |
155 | for (var i = 0; i < articles.length; i++) { | |
156 | var a_id = articles[i].getAttribute("id"); | |
f8fb4498 | 157 | //console.log("found id: " + a_id); |
6c3b0198 | 158 | cache_inject(a_id, articles[i].firstChild.nodeValue); |
ac541432 | 159 | } |
007a38d4 | 160 | } else { |
84c7b824 | 161 | console.log("no cached articles received"); |
961f4c73 | 162 | } |
d36f5607 AD |
163 | |
164 | if (counters) | |
165 | parse_counters(counters); | |
166 | else | |
167 | request_counters(); | |
f8fb4498 | 168 | |
6c3b0198 | 169 | if (runtime_info) { |
6c3b0198 | 170 | parse_runtime_info(runtime_info[0]); |
f8fb4498 | 171 | } |
6c3b0198 | 172 | |
3de0261a | 173 | } else { |
f8fb4498 | 174 | console.warn("headlines_callback: returned no XML object"); |
fcf70c51 | 175 | $('headlinesInnerContainer').innerHTML = "<div class='whiteBox'>" + __('Could not update headlines (missing XML object)') + "</div>"; |
3de0261a | 176 | } |
6c3b0198 | 177 | |
5225d420 | 178 | |
6c3b0198 | 179 | if (_cdm_wd_timeout) window.clearTimeout(_cdm_wd_timeout); |
8cc5e965 | 180 | |
e69fb880 | 181 | if (isCdmMode() && |
a969b30b | 182 | getActiveFeedId() != -3 && |
6c3b0198 | 183 | getInitParam("cdm_auto_catchup") == 1) { |
84c7b824 | 184 | console.log("starting CDM watchdog"); |
6c3b0198 AD |
185 | _cdm_wd_timeout = window.setTimeout("cdmWatchdog()", 5000); |
186 | _cdm_wd_vishist = new Array(); | |
ac7bcd71 | 187 | } else { |
84c7b824 | 188 | console.log("not in CDM mode or watchdog disabled"); |
ba0978c8 | 189 | } |
6c3b0198 | 190 | |
6c3b0198 | 191 | _feed_cur_page = feed_cur_page; |
82764a41 AD |
192 | _infscroll_request_sent = 0; |
193 | ||
6c3b0198 | 194 | notify(""); |
730dbf19 AD |
195 | |
196 | remove_splash(); | |
197 | ||
6c3b0198 | 198 | } catch (e) { |
273d1e29 | 199 | exception_error("headlines_callback2", e, transport); |
6b4163cb AD |
200 | } |
201 | } | |
202 | ||
e097e8be AD |
203 | function render_article(article) { |
204 | try { | |
acac8448 | 205 | var f = $("content-frame"); |
44cc6f20 AD |
206 | try { |
207 | f.scrollTop = 0; | |
208 | } catch (e) { }; | |
e097e8be | 209 | |
6f3976c9 AD |
210 | dijit.byId("headlines-wrap-inner").addChild( |
211 | dijit.byId("content-insert")); | |
212 | ||
acac8448 | 213 | var fi = $("content-insert"); |
17042fc0 | 214 | |
e5ebee09 AD |
215 | try { |
216 | fi.scrollTop = 0; | |
217 | } catch (e) { }; | |
95f67d2e | 218 | |
17042fc0 | 219 | fi.innerHTML = article; |
95f67d2e | 220 | |
51682b23 | 221 | // article.evalScripts(); |
e097e8be AD |
222 | |
223 | } catch (e) { | |
224 | exception_error("render_article", e); | |
225 | } | |
226 | } | |
227 | ||
71d277de | 228 | function showArticleInHeadlines(id) { |
e097e8be | 229 | |
868d0ed2 | 230 | try { |
e097e8be | 231 | |
8cc5e965 AD |
232 | selectArticles("none"); |
233 | ||
acac8448 | 234 | var crow = $("RROW-" + id); |
76283a4c AD |
235 | |
236 | if (!crow) return; | |
237 | ||
ca8e3d75 | 238 | var article_is_unread = crow.hasClassName("Unread"); |
868d0ed2 | 239 | |
ca8e3d75 | 240 | crow.removeClassName("Unread"); |
fdcdf2de | 241 | |
e69fb880 AD |
242 | selectArticles('none'); |
243 | ||
acac8448 | 244 | var upd_img_pic = $("FUPDPIC-" + id); |
ebda016b | 245 | |
fdcdf2de | 246 | var cache_prefix = ""; |
ebda016b | 247 | |
fdcdf2de AD |
248 | if (activeFeedIsCat()) { |
249 | cache_prefix = "C:"; | |
250 | } else { | |
251 | cache_prefix = "F:"; | |
252 | } | |
11063ec6 AD |
253 | |
254 | var view_mode = false; | |
255 | ||
256 | try { | |
257 | view_mode = document.forms['main_toolbar_form'].view_mode; | |
258 | view_mode = view_mode[view_mode.selectedIndex].value; | |
259 | } catch (e) { | |
273d1e29 | 260 | // |
11063ec6 AD |
261 | } |
262 | ||
784ac51f AD |
263 | if (upd_img_pic && (upd_img_pic.src.match("updated.png") || |
264 | upd_img_pic.src.match("fresh_sign.png"))) { | |
265 | ||
fdcdf2de | 266 | upd_img_pic.src = "images/blank_icon.gif"; |
ebda016b AD |
267 | |
268 | cache_invalidate(cache_prefix + getActiveFeedId()); | |
ce411c4b AD |
269 | |
270 | cache_inject(cache_prefix + getActiveFeedId(), | |
acac8448 | 271 | $("headlines-frame").innerHTML, |
ce411c4b | 272 | get_feed_unread(getActiveFeedId())); |
fdcdf2de | 273 | |
11063ec6 | 274 | } else if (article_is_unread && view_mode == "all_articles") { |
fdcdf2de AD |
275 | |
276 | cache_invalidate(cache_prefix + getActiveFeedId()); | |
277 | ||
278 | cache_inject(cache_prefix + getActiveFeedId(), | |
acac8448 | 279 | $("headlines-frame").innerHTML, |
fdcdf2de AD |
280 | get_feed_unread(getActiveFeedId())-1); |
281 | ||
3de99e6b AD |
282 | } else if (article_is_unread) { |
283 | cache_invalidate(cache_prefix + getActiveFeedId()); | |
868d0ed2 | 284 | } |
e097e8be | 285 | |
4c009c78 AD |
286 | markHeadline(id); |
287 | ||
ac49453b AD |
288 | if (article_is_unread) |
289 | _force_scheduled_update = true; | |
290 | ||
868d0ed2 AD |
291 | } catch (e) { |
292 | exception_error("showArticleInHeadlines", e); | |
293 | } | |
71d277de | 294 | } |
e097e8be | 295 | |
a491a7f1 | 296 | function article_callback2(transport, id) { |
71d277de | 297 | try { |
84c7b824 | 298 | console.log("article_callback2 " + id); |
e097e8be | 299 | |
f8fb4498 | 300 | if (!handle_rpc_reply(transport)) return; |
9ca945a6 | 301 | |
71d277de | 302 | if (transport.responseXML) { |
e097e8be | 303 | |
2184738a AD |
304 | if (!transport_error_check(transport)) return; |
305 | ||
b1039124 AD |
306 | var upic = $('FUPDPIC-' + id); |
307 | ||
308 | if (upic) { | |
309 | upic.src = 'images/blank_icon.gif'; | |
310 | } | |
311 | ||
6e35a862 | 312 | if (id != last_requested_article) { |
84c7b824 | 313 | console.log("requested article id is out of sequence, aborting"); |
6e35a862 AD |
314 | return; |
315 | } | |
316 | ||
5caea522 | 317 | // active_post_id = id; |
6e35a862 | 318 | |
f8fb4498 | 319 | //console.log("looking for articles to cache..."); |
71d277de AD |
320 | |
321 | var articles = transport.responseXML.getElementsByTagName("article"); | |
322 | ||
323 | for (var i = 0; i < articles.length; i++) { | |
324 | var a_id = articles[i].getAttribute("id"); | |
325 | ||
f8fb4498 | 326 | //console.log("found id: " + a_id); |
71d277de AD |
327 | |
328 | if (a_id == active_post_id) { | |
f8fb4498 | 329 | //console.log("active article, rendering..."); |
71d277de | 330 | render_article(articles[i].firstChild.nodeValue); |
e097e8be | 331 | } |
71d277de AD |
332 | |
333 | cache_inject(a_id, articles[i].firstChild.nodeValue); | |
e097e8be | 334 | } |
fbcabe1e | 335 | |
fbcabe1e | 336 | |
5caea522 | 337 | // showArticleInHeadlines(id); |
fbcabe1e AD |
338 | |
339 | var reply = transport.responseXML.firstChild.firstChild; | |
71d277de AD |
340 | |
341 | } else { | |
f8fb4498 | 342 | console.warn("article_callback: returned no XML object"); |
acac8448 | 343 | //var f = $("content-frame"); |
17042fc0 | 344 | //f.innerHTML = "<div class='whiteBox'>" + __('Could not display article (missing XML object)') + "</div>"; |
e097e8be | 345 | } |
4b6206fa AD |
346 | |
347 | var date = new Date(); | |
348 | last_article_view = date.getTime() / 1000; | |
349 | ||
9c99281f | 350 | request_counters(); |
9ec58704 AD |
351 | |
352 | notify(""); | |
71d277de | 353 | } catch (e) { |
273d1e29 | 354 | exception_error("article_callback2", e, transport); |
6b4163cb AD |
355 | } |
356 | } | |
357 | ||
a491a7f1 | 358 | function view(id) { |
ee1f45f4 | 359 | try { |
84c7b824 | 360 | console.log("loading article: " + id); |
12e55b90 | 361 | |
e097e8be AD |
362 | var cached_article = cache_find(id); |
363 | ||
84c7b824 | 364 | console.log("cache check result: " + (cached_article != false)); |
ee1f45f4 | 365 | |
ee1f45f4 | 366 | enableHotkeys(); |
664306d3 AD |
367 | hideAuxDlg(); |
368 | ||
a491a7f1 | 369 | var query = "?op=view&id=" + param_escape(id); |
6b4163cb | 370 | |
71d277de | 371 | var neighbor_ids = getRelativePostIds(active_post_id); |
e097e8be | 372 | |
71d277de | 373 | /* only request uncached articles */ |
e097e8be | 374 | |
71d277de | 375 | var cids_to_request = Array(); |
5a94a953 | 376 | |
71d277de AD |
377 | for (var i = 0; i < neighbor_ids.length; i++) { |
378 | if (!cache_check(neighbor_ids[i])) { | |
379 | cids_to_request.push(neighbor_ids[i]); | |
5a94a953 | 380 | } |
71d277de | 381 | } |
5a94a953 | 382 | |
84c7b824 | 383 | console.log("additional ids: " + cids_to_request.toString()); |
b39b57ac | 384 | |
71d277de | 385 | query = query + "&cids=" + cids_to_request.toString(); |
e097e8be | 386 | |
acac8448 | 387 | var crow = $("RROW-" + id); |
ca8e3d75 | 388 | var article_is_unread = crow.hasClassName("Unread"); |
e097e8be | 389 | |
5caea522 | 390 | active_post_id = id; |
3f70f90f AD |
391 | showArticleInHeadlines(id); |
392 | ||
71d277de | 393 | if (!cached_article) { |
e097e8be | 394 | |
b1039124 AD |
395 | var upic = $('FUPDPIC-' + id); |
396 | ||
397 | if (upic) { | |
883fee8d | 398 | upic.src = getInitParam("sign_progress"); |
6e35a862 | 399 | } |
e097e8be | 400 | |
71d277de | 401 | } else if (cached_article && article_is_unread) { |
addb5836 | 402 | |
71d277de | 403 | query = query + "&mode=prefetch"; |
addb5836 | 404 | |
71d277de | 405 | render_article(cached_article); |
addb5836 | 406 | |
71d277de | 407 | } else if (cached_article) { |
e097e8be | 408 | |
71d277de AD |
409 | query = query + "&mode=prefetch_old"; |
410 | render_article(cached_article); | |
997d9d7c | 411 | |
71d277de | 412 | } |
e097e8be | 413 | |
71d277de | 414 | cache_expire(); |
86173d9a | 415 | |
022d9e9e AD |
416 | last_requested_article = id; |
417 | ||
b4e75b2a AD |
418 | new Ajax.Request("backend.php", { |
419 | parameters: query, | |
71d277de | 420 | onComplete: function(transport) { |
a491a7f1 | 421 | article_callback2(transport, id); |
71d277de | 422 | } }); |
6b4163cb | 423 | |
a7764e51 AD |
424 | return false; |
425 | ||
ee1f45f4 AD |
426 | } catch (e) { |
427 | exception_error("view", e); | |
428 | } | |
f0601b87 AD |
429 | } |
430 | ||
67343d9f AD |
431 | function tMark(id) { |
432 | return toggleMark(id); | |
433 | } | |
434 | ||
e4f4b46f AD |
435 | function tPub(id) { |
436 | return togglePub(id); | |
437 | } | |
438 | ||
4ad8c93b | 439 | function toggleMark(id, client_only) { |
b685ba25 | 440 | try { |
b4e75b2a | 441 | var query = "?op=rpc&id=" + id + "&subop=mark"; |
b685ba25 | 442 | |
4ad8c93b | 443 | var img = $("FMPIC-" + id); |
56ff7564 | 444 | |
4ad8c93b | 445 | if (!img) return; |
b685ba25 | 446 | |
4ad8c93b AD |
447 | if (img.src.match("mark_unset")) { |
448 | img.src = img.src.replace("mark_unset", "mark_set"); | |
449 | img.alt = __("Unstar article"); | |
b685ba25 | 450 | query = query + "&mark=1"; |
ee8768db | 451 | |
b685ba25 | 452 | } else { |
4ad8c93b AD |
453 | img.src = img.src.replace("mark_set", "mark_unset"); |
454 | img.alt = __("Star article"); | |
b685ba25 | 455 | query = query + "&mark=0"; |
ace1a6da | 456 | } |
772bc83b | 457 | |
f5e0338d | 458 | if (!client_only) { |
b4e75b2a AD |
459 | new Ajax.Request("backend.php", { |
460 | parameters: query, | |
1341ea0d | 461 | onComplete: function(transport) { |
f8fb4498 | 462 | handle_rpc_reply(transport); |
1341ea0d | 463 | } }); |
f5e0338d | 464 | } |
f0601b87 | 465 | |
b685ba25 AD |
466 | } catch (e) { |
467 | exception_error("toggleMark", e); | |
468 | } | |
f0601b87 AD |
469 | } |
470 | ||
c7e51de1 | 471 | function togglePub(id, client_only, no_effects, note) { |
2bc2147f | 472 | try { |
b4e75b2a | 473 | var query = "?op=rpc&id=" + id + "&subop=publ"; |
2bc2147f | 474 | |
c7e51de1 AD |
475 | if (note != undefined) { |
476 | query = query + "¬e=" + param_escape(note); | |
477 | } else { | |
478 | query = query + "¬e=undefined"; | |
479 | } | |
56ff7564 | 480 | |
4ad8c93b | 481 | var img = $("FPPIC-" + id); |
56ff7564 | 482 | |
4ad8c93b | 483 | if (!img) return; |
2bc2147f | 484 | |
4ad8c93b AD |
485 | if (img.src.match("pub_unset") || note != undefined) { |
486 | img.src = img.src.replace("pub_unset", "pub_set"); | |
487 | img.alt = __("Unpublish article"); | |
2bc2147f | 488 | query = query + "&pub=1"; |
ee8768db | 489 | |
e4f4b46f | 490 | } else { |
4ad8c93b AD |
491 | img.src = img.src.replace("pub_set", "pub_unset"); |
492 | img.alt = __("Publish article"); | |
8cc5e965 | 493 | |
4ad8c93b | 494 | query = query + "&pub=0"; |
e4f4b46f | 495 | } |
b685ba25 | 496 | |
f5e0338d | 497 | if (!client_only) { |
b4e75b2a AD |
498 | new Ajax.Request("backend.php", { |
499 | parameters: query, | |
1341ea0d | 500 | onComplete: function(transport) { |
f8fb4498 | 501 | handle_rpc_reply(transport); |
a5819bb3 AD |
502 | |
503 | var note = transport.responseXML.getElementsByTagName("note")[0]; | |
504 | ||
505 | if (note) { | |
506 | var note_id = note.getAttribute("id"); | |
507 | var note_size = note.getAttribute("size"); | |
508 | var note_content = note.firstChild.nodeValue; | |
509 | ||
510 | var container = $('POSTNOTE-' + note_id); | |
511 | ||
512 | cache_invalidate(note_id); | |
513 | ||
514 | if (container) { | |
515 | if (note_size == "0") { | |
516 | Element.hide(container); | |
517 | } else { | |
518 | container.innerHTML = note_content; | |
519 | Element.show(container); | |
520 | } | |
521 | } | |
522 | } | |
523 | ||
1341ea0d | 524 | } }); |
f5e0338d | 525 | } |
b685ba25 | 526 | |
2bc2147f | 527 | } catch (e) { |
2bc2147f AD |
528 | exception_error("togglePub", e); |
529 | } | |
e4f4b46f AD |
530 | } |
531 | ||
bb7cface | 532 | function moveToPost(mode) { |
f0601b87 | 533 | |
b8e6acea AD |
534 | try { |
535 | ||
e69fb880 | 536 | var rows = getVisibleArticleIds(); |
5ad9d132 | 537 | |
5ad9d132 AD |
538 | var prev_id = false; |
539 | var next_id = false; | |
b8e6acea | 540 | |
acac8448 | 541 | if (!$('RROW-' + active_post_id)) { |
5ad9d132 AD |
542 | active_post_id = false; |
543 | } | |
b8e6acea | 544 | |
5ad9d132 AD |
545 | if (active_post_id == false) { |
546 | next_id = getFirstVisibleHeadlineId(); | |
547 | prev_id = getLastVisibleHeadlineId(); | |
548 | } else { | |
549 | for (var i = 0; i < rows.length; i++) { | |
550 | if (rows[i] == active_post_id) { | |
551 | prev_id = rows[i-1]; | |
552 | next_id = rows[i+1]; | |
b8e6acea AD |
553 | } |
554 | } | |
5ad9d132 | 555 | } |
b8e6acea | 556 | |
5ad9d132 AD |
557 | if (mode == "next") { |
558 | if (next_id) { | |
559 | if (isCdmMode()) { | |
560 | ||
dad14b51 AD |
561 | cdmExpandArticle(next_id); |
562 | cdmScrollToArticleId(next_id); | |
5ad9d132 AD |
563 | |
564 | } else { | |
b8e6acea AD |
565 | correctHeadlinesOffset(next_id); |
566 | view(next_id, getActiveFeedId()); | |
567 | } | |
568 | } | |
5ad9d132 | 569 | } |
b8e6acea | 570 | |
5ad9d132 AD |
571 | if (mode == "prev") { |
572 | if (prev_id) { | |
573 | if (isCdmMode()) { | |
dad14b51 | 574 | cdmExpandArticle(prev_id); |
5ad9d132 | 575 | cdmScrollToArticleId(prev_id); |
5ad9d132 | 576 | } else { |
b8e6acea AD |
577 | correctHeadlinesOffset(prev_id); |
578 | view(prev_id, getActiveFeedId()); | |
579 | } | |
5ad9d132 AD |
580 | } |
581 | } | |
582 | ||
b8e6acea | 583 | } catch (e) { |
438f2ce9 | 584 | exception_error("moveToPost", e); |
bb7cface | 585 | } |
b8e6acea AD |
586 | } |
587 | ||
6f3976c9 | 588 | function toggleSelected(id, force_on) { |
b8e6acea AD |
589 | try { |
590 | ||
acac8448 | 591 | var cb = $("RCHK-" + id); |
acac8448 | 592 | var row = $("RROW-" + id); |
5ad9d132 | 593 | |
ca8e3d75 | 594 | if (row) { |
6f3976c9 | 595 | if (row.hasClassName('Selected') && !force_on) { |
ca8e3d75 AD |
596 | row.removeClassName('Selected'); |
597 | if (cb) cb.checked = false; | |
b8e6acea | 598 | } else { |
ca8e3d75 AD |
599 | row.addClassName('Selected'); |
600 | if (cb) cb.checked = true; | |
b8e6acea | 601 | } |
bb7cface | 602 | } |
b8e6acea | 603 | } catch (e) { |
438f2ce9 | 604 | exception_error("toggleSelected", e); |
b8e6acea | 605 | } |
bb7cface AD |
606 | } |
607 | ||
0df009c3 | 608 | function toggleUnread_afh(effect) { |
b8e6acea AD |
609 | try { |
610 | ||
611 | var elem = effect.element; | |
0df009c3 | 612 | elem.style.backgroundColor = ""; |
b8e6acea | 613 | |
b8e6acea | 614 | } catch (e) { |
438f2ce9 | 615 | exception_error("toggleUnread_afh", e); |
b8e6acea | 616 | } |
0df009c3 | 617 | } |
b8e6acea AD |
618 | |
619 | function toggleUnread(id, cmode, effect) { | |
5f51022a | 620 | try { |
5f51022a | 621 | |
acac8448 | 622 | var row = $("RROW-" + id); |
5f51022a | 623 | if (row) { |
a70ab740 | 624 | if (cmode == undefined || cmode == 2) { |
ca8e3d75 AD |
625 | if (row.hasClassName("Unread")) { |
626 | row.removeClassName("Unread"); | |
b8e6acea | 627 | |
0df009c3 | 628 | if (effect) { |
b8e6acea AD |
629 | new Effect.Highlight(row, {duration: 1, startcolor: "#fff7d5", |
630 | afterFinish: toggleUnread_afh, | |
631 | queue: { position:'end', scope: 'TMRQ-' + id, limit: 1 } } ); | |
0df009c3 | 632 | } |
b8e6acea | 633 | |
a70ab740 | 634 | } else { |
ca8e3d75 | 635 | row.addClassName("Unread"); |
a70ab740 | 636 | } |
1a003258 | 637 | |
a70ab740 | 638 | } else if (cmode == 0) { |
ca8e3d75 AD |
639 | |
640 | row.removeClassName("Unread"); | |
b8e6acea | 641 | |
54eb7d20 | 642 | if (effect) { |
b8e6acea | 643 | new Effect.Highlight(row, {duration: 1, startcolor: "#fff7d5", |
54eb7d20 | 644 | afterFinish: toggleUnread_afh, |
b8e6acea | 645 | queue: { position:'end', scope: 'TMRQ-' + id, limit: 1 } } ); |
54eb7d20 | 646 | } |
1a003258 | 647 | |
a70ab740 | 648 | } else if (cmode == 1) { |
ca8e3d75 | 649 | row.addClassName("Unread"); |
5f51022a AD |
650 | } |
651 | ||
a70ab740 | 652 | if (cmode == undefined) cmode = 2; |
5f51022a | 653 | |
b4e75b2a AD |
654 | var query = "?op=rpc&subop=catchupSelected" + |
655 | "&cmode=" + param_escape(cmode) + "&ids=" + param_escape(id); | |
5f51022a | 656 | |
1341ea0d | 657 | // notify_progress("Loading, please wait..."); |
9ec58704 | 658 | |
b4e75b2a AD |
659 | new Ajax.Request("backend.php", { |
660 | parameters: query, | |
1341ea0d | 661 | onComplete: function(transport) { |
f8fb4498 | 662 | handle_rpc_reply(transport); |
1341ea0d | 663 | } }); |
5f51022a AD |
664 | |
665 | } | |
666 | ||
5f51022a AD |
667 | } catch (e) { |
668 | exception_error("toggleUnread", e); | |
669 | } | |
670 | } | |
671 | ||
933ba4ee AD |
672 | function selectionRemoveLabel(id) { |
673 | try { | |
674 | ||
675 | var ids = getSelectedArticleIds2(); | |
676 | ||
677 | if (ids.length == 0) { | |
678 | alert(__("No articles are selected.")); | |
679 | return; | |
680 | } | |
681 | ||
37843d70 | 682 | // var ok = confirm(__("Remove selected articles from label?")); |
933ba4ee | 683 | |
37843d70 | 684 | // if (ok) { |
933ba4ee | 685 | |
b4e75b2a | 686 | var query = "?op=rpc&subop=removeFromLabel&ids=" + |
933ba4ee AD |
687 | param_escape(ids.toString()) + "&lid=" + param_escape(id); |
688 | ||
905ff52a AD |
689 | console.log(query); |
690 | ||
933ba4ee AD |
691 | // notify_progress("Loading, please wait..."); |
692 | ||
898e8562 AD |
693 | cache_invalidate("F:" + (-11 - id)); |
694 | ||
b4e75b2a AD |
695 | new Ajax.Request("backend.php", { |
696 | parameters: query, | |
933ba4ee | 697 | onComplete: function(transport) { |
1c9c6025 | 698 | show_labels_in_headlines(transport); |
f8fb4498 | 699 | handle_rpc_reply(transport); |
933ba4ee AD |
700 | } }); |
701 | ||
37843d70 | 702 | // } |
933ba4ee AD |
703 | |
704 | } catch (e) { | |
705 | exception_error("selectionAssignLabel", e); | |
706 | ||
707 | } | |
708 | } | |
709 | ||
b8a637f3 AD |
710 | function selectionAssignLabel(id) { |
711 | try { | |
712 | ||
713 | var ids = getSelectedArticleIds2(); | |
714 | ||
715 | if (ids.length == 0) { | |
716 | alert(__("No articles are selected.")); | |
717 | return; | |
718 | } | |
719 | ||
37843d70 | 720 | // var ok = confirm(__("Assign selected articles to label?")); |
b8a637f3 | 721 | |
37843d70 | 722 | // if (ok) { |
b8a637f3 | 723 | |
898e8562 AD |
724 | cache_invalidate("F:" + (-11 - id)); |
725 | ||
b4e75b2a | 726 | var query = "?op=rpc&subop=assignToLabel&ids=" + |
b8a637f3 AD |
727 | param_escape(ids.toString()) + "&lid=" + param_escape(id); |
728 | ||
905ff52a AD |
729 | console.log(query); |
730 | ||
b8a637f3 AD |
731 | // notify_progress("Loading, please wait..."); |
732 | ||
b4e75b2a AD |
733 | new Ajax.Request("backend.php", { |
734 | parameters: query, | |
b8a637f3 | 735 | onComplete: function(transport) { |
f9247195 | 736 | show_labels_in_headlines(transport); |
f8fb4498 | 737 | handle_rpc_reply(transport); |
b8a637f3 AD |
738 | } }); |
739 | ||
37843d70 | 740 | // } |
b8a637f3 AD |
741 | |
742 | } catch (e) { | |
743 | exception_error("selectionAssignLabel", e); | |
744 | ||
745 | } | |
746 | } | |
747 | ||
50eefedb | 748 | function selectionToggleUnread(set_state, callback_func, no_error) { |
1572afe5 | 749 | try { |
b83d72b1 | 750 | var rows = getSelectedArticleIds2(); |
1572afe5 | 751 | |
2228d0e4 | 752 | if (rows.length == 0 && !no_error) { |
9cc600d1 AD |
753 | alert(__("No articles are selected.")); |
754 | return; | |
755 | } | |
756 | ||
1572afe5 | 757 | for (i = 0; i < rows.length; i++) { |
acac8448 | 758 | var row = $("RROW-" + rows[i]); |
f1f2db64 | 759 | if (row) { |
a5ae125a | 760 | if (set_state == undefined) { |
ca8e3d75 AD |
761 | if (row.hasClassName("Unread")) { |
762 | row.removeClassName("Unread"); | |
a5ae125a | 763 | } else { |
ca8e3d75 | 764 | row.addClassName("Unread"); |
a5ae125a AD |
765 | } |
766 | } | |
767 | ||
768 | if (set_state == false) { | |
ca8e3d75 | 769 | row.removeClassName("Unread"); |
a5ae125a AD |
770 | } |
771 | ||
772 | if (set_state == true) { | |
ca8e3d75 | 773 | row.addClassName("Unread"); |
f1f2db64 AD |
774 | } |
775 | } | |
1572afe5 AD |
776 | } |
777 | ||
778 | if (rows.length > 0) { | |
779 | ||
b47b5af7 AD |
780 | var cmode = ""; |
781 | ||
782 | if (set_state == undefined) { | |
783 | cmode = "2"; | |
784 | } else if (set_state == true) { | |
785 | cmode = "1"; | |
786 | } else if (set_state == false) { | |
787 | cmode = "0"; | |
788 | } | |
789 | ||
b4e75b2a AD |
790 | var query = "?op=rpc&subop=catchupSelected" + |
791 | "&cmode=" + cmode + "&ids=" + param_escape(rows.toString()); | |
1572afe5 | 792 | |
9ec58704 AD |
793 | notify_progress("Loading, please wait..."); |
794 | ||
b4e75b2a AD |
795 | new Ajax.Request("backend.php", { |
796 | parameters: query, | |
1341ea0d AD |
797 | onComplete: function(transport) { |
798 | catchup_callback2(transport, callback_func); | |
799 | } }); | |
1572afe5 AD |
800 | |
801 | } | |
802 | ||
803 | } catch (e) { | |
83f043bb | 804 | exception_error("selectionToggleUnread", e); |
1572afe5 AD |
805 | } |
806 | } | |
807 | ||
50eefedb | 808 | function selectionToggleMarked() { |
1572afe5 | 809 | try { |
1572afe5 | 810 | |
b83d72b1 | 811 | var rows = getSelectedArticleIds2(); |
386cbf27 | 812 | |
9cc600d1 AD |
813 | if (rows.length == 0) { |
814 | alert(__("No articles are selected.")); | |
815 | return; | |
816 | } | |
817 | ||
1572afe5 | 818 | for (i = 0; i < rows.length; i++) { |
f5e0338d | 819 | toggleMark(rows[i], true, true); |
1572afe5 AD |
820 | } |
821 | ||
822 | if (rows.length > 0) { | |
823 | ||
b4e75b2a | 824 | var query = "?op=rpc&subop=markSelected&ids=" + |
1572afe5 AD |
825 | param_escape(rows.toString()) + "&cmode=2"; |
826 | ||
b4e75b2a AD |
827 | new Ajax.Request("backend.php", { |
828 | parameters: query, | |
1341ea0d | 829 | onComplete: function(transport) { |
f8fb4498 | 830 | handle_rpc_reply(transport); |
1341ea0d | 831 | } }); |
1572afe5 AD |
832 | |
833 | } | |
834 | ||
835 | } catch (e) { | |
83f043bb | 836 | exception_error("selectionToggleMarked", e); |
1572afe5 AD |
837 | } |
838 | } | |
839 | ||
50eefedb | 840 | function selectionTogglePublished() { |
e4f4b46f | 841 | try { |
e4f4b46f | 842 | |
b83d72b1 | 843 | var rows = getSelectedArticleIds2(); |
e4f4b46f AD |
844 | |
845 | if (rows.length == 0) { | |
846 | alert(__("No articles are selected.")); | |
847 | return; | |
848 | } | |
849 | ||
850 | for (i = 0; i < rows.length; i++) { | |
f5e0338d | 851 | togglePub(rows[i], true, true); |
e4f4b46f AD |
852 | } |
853 | ||
854 | if (rows.length > 0) { | |
855 | ||
b4e75b2a | 856 | var query = "?op=rpc&subop=publishSelected&ids=" + |
e4f4b46f AD |
857 | param_escape(rows.toString()) + "&cmode=2"; |
858 | ||
b4e75b2a AD |
859 | new Ajax.Request("backend.php", { |
860 | parameters: query, | |
1341ea0d | 861 | onComplete: function(transport) { |
f8fb4498 | 862 | handle_rpc_reply(transport); |
1341ea0d | 863 | } }); |
e4f4b46f AD |
864 | |
865 | } | |
866 | ||
867 | } catch (e) { | |
868 | exception_error("selectionToggleMarked", e); | |
869 | } | |
870 | } | |
871 | ||
e69fb880 | 872 | function getSelectedArticleIds2() { |
386cbf27 | 873 | |
ca8e3d75 | 874 | var rv = []; |
e69fb880 | 875 | |
ca8e3d75 AD |
876 | $$("#headlinesInnerContainer > div[id*=RROW][class*=Selected]").each( |
877 | function(child) { | |
878 | rv.push(child.id.replace("RROW-", "")); | |
879 | }); | |
386cbf27 | 880 | |
ca8e3d75 | 881 | return rv; |
386cbf27 AD |
882 | } |
883 | ||
e69fb880 | 884 | function getLoadedArticleIds() { |
ca8e3d75 | 885 | var rv = []; |
8be83f42 | 886 | |
ca8e3d75 | 887 | var children = $$("#headlinesInnerContainer > div[id*=RROW-]"); |
3a40e8a2 | 888 | |
ca8e3d75 AD |
889 | children.each(function(child) { |
890 | rv.push(child.id.replace("RROW-", "")); | |
891 | }); | |
8be83f42 | 892 | |
ca8e3d75 | 893 | return rv; |
8be83f42 | 894 | |
8be83f42 AD |
895 | } |
896 | ||
e69fb880 AD |
897 | // mode = all,none,unread,invert |
898 | function selectArticles(mode) { | |
899 | try { | |
8be83f42 | 900 | |
ca8e3d75 | 901 | var children = $$("#headlinesInnerContainer > div[id*=RROW]"); |
06d1a1c1 | 902 | |
ca8e3d75 AD |
903 | children.each(function(child) { |
904 | var id = child.id.replace("RROW-", ""); | |
905 | var cb = $("RCHK-" + id); | |
06d1a1c1 | 906 | |
ca8e3d75 AD |
907 | if (mode == "all") { |
908 | child.addClassName("Selected"); | |
909 | cb.checked = true; | |
910 | } else if (mode == "unread") { | |
911 | if (child.hasClassName("Unread")) { | |
912 | child.addClassName("Selected"); | |
913 | cb.checked = true; | |
e69fb880 | 914 | } else { |
ca8e3d75 | 915 | child.removeClassName("Selected"); |
e69fb880 | 916 | cb.checked = false; |
386cbf27 | 917 | } |
ca8e3d75 AD |
918 | } else if (mode == "invert") { |
919 | if (child.hasClassName("Selected")) { | |
920 | child.removeClassName("Selected"); | |
921 | cb.checked = false; | |
922 | } else { | |
923 | child.addClassName("Selected"); | |
924 | cb.checked = true; | |
925 | } | |
926 | ||
927 | } else { | |
928 | child.removeClassName("Selected"); | |
929 | cb.checked = false; | |
930 | } | |
931 | }); | |
e69fb880 AD |
932 | |
933 | } catch (e) { | |
934 | exception_error("selectArticles", e); | |
386cbf27 AD |
935 | } |
936 | } | |
937 | ||
98bea1b1 | 938 | function catchupPage() { |
b47b5af7 | 939 | |
3d72bbdb | 940 | var fn = getFeedName(getActiveFeedId(), activeFeedIsCat()); |
8a5b4579 | 941 | |
a5ae125a AD |
942 | var str = __("Mark all visible articles in %s as read?"); |
943 | ||
944 | str = str.replace("%s", fn); | |
8a5b4579 AD |
945 | |
946 | if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str)) { | |
947 | return; | |
948 | } | |
949 | ||
e69fb880 AD |
950 | selectArticles('all'); |
951 | selectionToggleUnread(false, 'viewCurrentFeed()', true) | |
952 | selectArticles('none'); | |
98bea1b1 AD |
953 | } |
954 | ||
e04c18a2 AD |
955 | function deleteSelection() { |
956 | ||
957 | try { | |
e04c18a2 | 958 | |
b83d72b1 AD |
959 | var rows = getSelectedArticleIds2(); |
960 | ||
e04c18a2 AD |
961 | if (rows.length == 0) { |
962 | alert(__("No articles are selected.")); | |
963 | return; | |
964 | } | |
965 | ||
e04c18a2 AD |
966 | var fn = getFeedName(getActiveFeedId(), activeFeedIsCat()); |
967 | var str; | |
968 | var op; | |
969 | ||
970 | if (getActiveFeedId() != 0) { | |
971 | str = __("Delete %d selected articles in %s?"); | |
972 | } else { | |
973 | str = __("Delete %d selected articles?"); | |
974 | } | |
975 | ||
976 | str = str.replace("%d", rows.length); | |
977 | str = str.replace("%s", fn); | |
978 | ||
979 | if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str)) { | |
980 | return; | |
981 | } | |
982 | ||
b4e75b2a | 983 | query = "?op=rpc&subop=delete&ids=" + param_escape(rows); |
e04c18a2 | 984 | |
84c7b824 | 985 | console.log(query); |
e04c18a2 | 986 | |
b4e75b2a AD |
987 | new Ajax.Request("backend.php", { |
988 | parameters: query, | |
e04c18a2 AD |
989 | onComplete: function(transport) { |
990 | viewCurrentFeed(); | |
991 | } }); | |
992 | ||
993 | } catch (e) { | |
a12eb9c3 | 994 | exception_error("deleteSelection", e); |
e04c18a2 AD |
995 | } |
996 | } | |
997 | ||
998 | function archiveSelection() { | |
999 | ||
1000 | try { | |
1001 | ||
b83d72b1 AD |
1002 | var rows = getSelectedArticleIds2(); |
1003 | ||
e04c18a2 AD |
1004 | if (rows.length == 0) { |
1005 | alert(__("No articles are selected.")); | |
1006 | return; | |
1007 | } | |
1008 | ||
e04c18a2 AD |
1009 | var fn = getFeedName(getActiveFeedId(), activeFeedIsCat()); |
1010 | var str; | |
1011 | var op; | |
1012 | ||
1013 | if (getActiveFeedId() != 0) { | |
1014 | str = __("Archive %d selected articles in %s?"); | |
1015 | op = "archive"; | |
1016 | } else { | |
1017 | str = __("Move %d archived articles back?"); | |
1018 | op = "unarchive"; | |
1019 | } | |
1020 | ||
1021 | str = str.replace("%d", rows.length); | |
1022 | str = str.replace("%s", fn); | |
1023 | ||
1024 | if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str)) { | |
1025 | return; | |
1026 | } | |
1027 | ||
b4e75b2a | 1028 | query = "?op=rpc&subop="+op+"&ids=" + param_escape(rows); |
e04c18a2 | 1029 | |
84c7b824 | 1030 | console.log(query); |
e04c18a2 | 1031 | |
a12eb9c3 AD |
1032 | for (var i = 0; i < rows.length; i++) { |
1033 | cache_invalidate(rows[i]); | |
1034 | } | |
1035 | ||
b4e75b2a AD |
1036 | new Ajax.Request("backend.php", { |
1037 | parameters: query, | |
e04c18a2 AD |
1038 | onComplete: function(transport) { |
1039 | viewCurrentFeed(); | |
1040 | } }); | |
1041 | ||
1042 | } catch (e) { | |
1043 | exception_error("archiveSelection", e); | |
1044 | } | |
1045 | } | |
1046 | ||
a5ae125a AD |
1047 | function catchupSelection() { |
1048 | ||
1049 | try { | |
1050 | ||
b83d72b1 AD |
1051 | var rows = getSelectedArticleIds2(); |
1052 | ||
a5ae125a AD |
1053 | if (rows.length == 0) { |
1054 | alert(__("No articles are selected.")); | |
1055 | return; | |
1056 | } | |
1057 | ||
3d72bbdb | 1058 | var fn = getFeedName(getActiveFeedId(), activeFeedIsCat()); |
a5ae125a | 1059 | |
ba5fac1b | 1060 | var str = __("Mark %d selected articles in %s as read?"); |
a5ae125a | 1061 | |
ba5fac1b | 1062 | str = str.replace("%d", rows.length); |
a5ae125a AD |
1063 | str = str.replace("%s", fn); |
1064 | ||
1065 | if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str)) { | |
1066 | return; | |
1067 | } | |
1068 | ||
8cc5e965 | 1069 | selectionToggleUnread(false, 'viewCurrentFeed()', true) |
a5ae125a AD |
1070 | |
1071 | } catch (e) { | |
1072 | exception_error("catchupSelection", e); | |
1073 | } | |
1074 | } | |
1075 | ||
13f08f75 | 1076 | function editArticleTags(id, feed_id, cdm_enabled) { |
542aebac AL |
1077 | displayDlg('editArticleTags', id, |
1078 | function () { | |
126cd3c8 AD |
1079 | $("tags_str").focus(); |
1080 | ||
1081 | new Ajax.Autocompleter('tags_str', 'tags_choices', | |
542aebac AL |
1082 | "backend.php?op=rpc&subop=completeTags", |
1083 | { tokens: ',', paramName: "search" }); | |
1084 | }); | |
0b126ac2 AD |
1085 | } |
1086 | ||
0b126ac2 AD |
1087 | function editTagsSave() { |
1088 | ||
42c32916 | 1089 | notify_progress("Saving article tags..."); |
88040f57 | 1090 | |
0b126ac2 AD |
1091 | var form = document.forms["tag_edit_form"]; |
1092 | ||
1093 | var query = Form.serialize("tag_edit_form"); | |
1094 | ||
b4e75b2a | 1095 | query = "?op=rpc&subop=setArticleTags&" + query; |
14b6c54b | 1096 | |
6f3976c9 | 1097 | console.log(query); |
14b6c54b | 1098 | |
b4e75b2a AD |
1099 | new Ajax.Request("backend.php", { |
1100 | parameters: query, | |
2ef1af84 | 1101 | onComplete: function(transport) { |
a5819bb3 | 1102 | try { |
f8fb4498 | 1103 | //console.log("tags saved..."); |
a5819bb3 AD |
1104 | |
1105 | closeInfoBox(); | |
1106 | notify(""); | |
9c99281f | 1107 | |
a5819bb3 AD |
1108 | if (transport.responseXML) { |
1109 | var tags_str = transport.responseXML.getElementsByTagName("tags-str")[0]; | |
1110 | ||
1111 | if (tags_str) { | |
1112 | var id = tags_str.getAttribute("id"); | |
1113 | ||
1114 | if (id) { | |
1115 | var tags = $("ATSTR-" + id); | |
1116 | if (tags) { | |
1117 | tags.innerHTML = tags_str.firstChild.nodeValue; | |
1118 | } | |
bd3f2ade AD |
1119 | |
1120 | cache_invalidate(id); | |
a5819bb3 AD |
1121 | } |
1122 | } | |
1123 | } | |
1124 | ||
1125 | } catch (e) { | |
1126 | exception_error("editTagsSave", e); | |
1127 | } | |
2ef1af84 | 1128 | } }); |
0b126ac2 | 1129 | } |
d62a3b63 AD |
1130 | |
1131 | function editTagsInsert() { | |
1132 | try { | |
1133 | ||
1134 | var form = document.forms["tag_edit_form"]; | |
1135 | ||
1136 | var found_tags = form.found_tags; | |
1137 | var tags_str = form.tags_str; | |
1138 | ||
1139 | var tag = found_tags[found_tags.selectedIndex].value; | |
1140 | ||
1141 | if (tags_str.value.length > 0 && | |
1142 | tags_str.value.lastIndexOf(", ") != tags_str.value.length - 2) { | |
1143 | ||
1144 | tags_str.value = tags_str.value + ", "; | |
1145 | } | |
1146 | ||
1147 | tags_str.value = tags_str.value + tag + ", "; | |
1148 | ||
1149 | found_tags.selectedIndex = 0; | |
1150 | ||
1151 | } catch (e) { | |
438f2ce9 | 1152 | exception_error("editTagsInsert", e); |
d62a3b63 AD |
1153 | } |
1154 | } | |
ba0978c8 | 1155 | |
b8e6acea AD |
1156 | function cdmScrollToArticleId(id) { |
1157 | try { | |
9eac2f0d | 1158 | var ctr = $("headlines-frame"); |
acac8448 | 1159 | var e = $("RROW-" + id); |
b8e6acea AD |
1160 | |
1161 | if (!e || !ctr) return; | |
1162 | ||
1163 | ctr.scrollTop = e.offsetTop; | |
1164 | ||
1165 | } catch (e) { | |
438f2ce9 | 1166 | exception_error("cdmScrollToArticleId", e); |
b8e6acea AD |
1167 | } |
1168 | } | |
1169 | ||
ba0978c8 AD |
1170 | function cdmWatchdog() { |
1171 | ||
1172 | try { | |
1173 | ||
acac8448 | 1174 | var ctr = $("headlinesInnerContainer"); |
ba0978c8 | 1175 | |
9acd22e8 AD |
1176 | if (!ctr) return; |
1177 | ||
ba0978c8 AD |
1178 | var ids = new Array(); |
1179 | ||
1180 | var e = ctr.firstChild; | |
1181 | ||
1182 | while (e) { | |
ca8e3d75 | 1183 | if (e.className && e.hasClassName("Unread") && e.id && |
ba0978c8 AD |
1184 | e.id.match("RROW-")) { |
1185 | ||
1186 | // article fits in viewport OR article is longer than viewport and | |
1187 | // its bottom is visible | |
1188 | ||
1189 | if (ctr.scrollTop <= e.offsetTop && e.offsetTop + e.offsetHeight <= | |
1190 | ctr.scrollTop + ctr.offsetHeight) { | |
1191 | ||
84c7b824 | 1192 | // console.log(e.id + " is visible " + e.offsetTop + "." + |
ba0978c8 AD |
1193 | // (e.offsetTop + e.offsetHeight) + " vs " + ctr.scrollTop + "." + |
1194 | // (ctr.scrollTop + ctr.offsetHeight)); | |
1195 | ||
1196 | ids.push(e.id.replace("RROW-", "")); | |
1197 | ||
1198 | } else if (e.offsetHeight > ctr.offsetHeight && | |
1199 | e.offsetTop + e.offsetHeight >= ctr.scrollTop && | |
1200 | e.offsetTop + e.offsetHeight <= ctr.scrollTop + ctr.offsetHeight) { | |
1201 | ||
1202 | ids.push(e.id.replace("RROW-", "")); | |
1203 | ||
1204 | } | |
1205 | ||
c50e2b30 AD |
1206 | // method 2: article bottom is visible and is in upper 1/2 of the viewport |
1207 | ||
1208 | /* if (e.offsetTop + e.offsetHeight >= ctr.scrollTop && | |
1209 | e.offsetTop + e.offsetHeight <= ctr.scrollTop + ctr.offsetHeight/2) { | |
1210 | ||
1211 | ids.push(e.id.replace("RROW-", "")); | |
1212 | ||
1213 | } */ | |
1214 | ||
ba0978c8 AD |
1215 | } |
1216 | ||
1217 | e = e.nextSibling; | |
1218 | } | |
1219 | ||
84c7b824 | 1220 | console.log("cdmWatchdog, ids= " + ids.toString()); |
ba0978c8 | 1221 | |
1341ea0d | 1222 | if (ids.length > 0) { |
ba0978c8 AD |
1223 | |
1224 | for (var i = 0; i < ids.length; i++) { | |
acac8448 | 1225 | var e = $("RROW-" + ids[i]); |
ba0978c8 | 1226 | if (e) { |
ca8e3d75 | 1227 | e.removeClassName("Unread"); |
ba0978c8 AD |
1228 | } |
1229 | } | |
1230 | ||
b4e75b2a AD |
1231 | var query = "?op=rpc&subop=catchupSelected" + |
1232 | "&cmode=0" + "&ids=" + param_escape(ids.toString()); | |
ba0978c8 | 1233 | |
b4e75b2a AD |
1234 | new Ajax.Request("backend.php", { |
1235 | parameters: query, | |
1341ea0d | 1236 | onComplete: function(transport) { |
f8fb4498 | 1237 | handle_rpc_reply(transport); |
1341ea0d | 1238 | } }); |
ba0978c8 AD |
1239 | |
1240 | } | |
1241 | ||
c50e2b30 | 1242 | _cdm_wd_timeout = window.setTimeout("cdmWatchdog()", 4000); |
ba0978c8 AD |
1243 | |
1244 | } catch (e) { | |
438f2ce9 | 1245 | exception_error("cdmWatchdog", e); |
ba0978c8 AD |
1246 | } |
1247 | ||
1248 | } | |
e097e8be AD |
1249 | |
1250 | ||
e19c1824 | 1251 | function cache_inject(id, article, param) { |
b39b57ac | 1252 | |
fb456d28 AD |
1253 | try { |
1254 | if (!cache_check_param(id, param)) { | |
f8fb4498 | 1255 | //console.log("cache_article: miss: " + id + " [p=" + param + "]"); |
e097e8be | 1256 | |
b39b57ac AD |
1257 | var date = new Date(); |
1258 | var ts = Math.round(date.getTime() / 1000); | |
1259 | ||
75c51032 | 1260 | var cache_obj = {}; |
fb456d28 | 1261 | |
75c51032 AD |
1262 | cache_obj["id"] = id; |
1263 | cache_obj["data"] = article; | |
1264 | cache_obj["param"] = param; | |
ff0010c1 | 1265 | |
75c51032 | 1266 | if (param) id = id + ":" + param; |
ff0010c1 | 1267 | |
75c51032 AD |
1268 | cache_added["TS:" + id] = ts; |
1269 | ||
1270 | if (has_local_storage()) | |
1271 | localStorage.setItem(id, JSON.stringify(cache_obj)); | |
1272 | else | |
1273 | article_cache.push(cache_obj); | |
b39b57ac | 1274 | |
fb456d28 | 1275 | } else { |
f8fb4498 | 1276 | //console.log("cache_article: hit: " + id + " [p=" + param + "]"); |
fb456d28 AD |
1277 | } |
1278 | } catch (e) { | |
1279 | exception_error("cache_inject", e); | |
e097e8be AD |
1280 | } |
1281 | } | |
1282 | ||
1283 | function cache_find(id) { | |
fb456d28 | 1284 | |
75c51032 AD |
1285 | if (has_local_storage()) { |
1286 | var cache_obj = localStorage.getItem(id); | |
31234407 | 1287 | |
75c51032 AD |
1288 | if (cache_obj) { |
1289 | cache_obj = JSON.parse(cache_obj); | |
03c96380 | 1290 | |
75c51032 AD |
1291 | if (cache_obj) |
1292 | return cache_obj['data']; | |
1293 | } | |
03c96380 | 1294 | |
fb456d28 | 1295 | } else { |
75c51032 AD |
1296 | for (var i = 0; i < article_cache.length; i++) { |
1297 | if (article_cache[i]["id"] == id) { | |
1298 | return article_cache[i]["data"]; | |
fb456d28 | 1299 | } |
fed4387d | 1300 | } |
e097e8be | 1301 | } |
fed4387d | 1302 | return false; |
e097e8be AD |
1303 | } |
1304 | ||
5d17ead9 | 1305 | function cache_find_param(id, param) { |
fb456d28 | 1306 | |
75c51032 | 1307 | if (has_local_storage()) { |
fb456d28 | 1308 | |
75c51032 | 1309 | if (param) id = id + ":" + param; |
fb456d28 | 1310 | |
75c51032 | 1311 | var cache_obj = localStorage.getItem(id); |
03c96380 | 1312 | |
75c51032 AD |
1313 | if (cache_obj) { |
1314 | cache_obj = JSON.parse(cache_obj); | |
03c96380 | 1315 | |
75c51032 AD |
1316 | if (cache_obj) |
1317 | return cache_obj['data']; | |
1318 | } | |
ff0010c1 | 1319 | |
75c51032 AD |
1320 | } else { |
1321 | for (var i = 0; i < article_cache.length; i++) { | |
1322 | if (article_cache[i]["id"] == id && article_cache[i]["param"] == param) { | |
1323 | return article_cache[i]["data"]; | |
fb456d28 | 1324 | } |
e19c1824 AD |
1325 | } |
1326 | } | |
75c51032 | 1327 | |
e19c1824 AD |
1328 | return false; |
1329 | } | |
1330 | ||
e097e8be | 1331 | function cache_check(id) { |
75c51032 AD |
1332 | if (has_local_storage()) { |
1333 | if (localStorage.getItem(id)) | |
1334 | return true; | |
fb456d28 | 1335 | } else { |
75c51032 AD |
1336 | for (var i = 0; i < article_cache.length; i++) { |
1337 | if (article_cache[i]["id"] == id) { | |
b39b57ac | 1338 | return true; |
fb456d28 | 1339 | } |
fed4387d AD |
1340 | } |
1341 | } | |
1342 | return false; | |
e097e8be AD |
1343 | } |
1344 | ||
e19c1824 | 1345 | function cache_check_param(id, param) { |
75c51032 | 1346 | if (has_local_storage()) { |
5d17ead9 | 1347 | |
75c51032 | 1348 | if (param) id = id + ":" + param; |
fb456d28 | 1349 | |
75c51032 AD |
1350 | if (localStorage.getItem(id)) |
1351 | return true; | |
03c96380 | 1352 | |
fb456d28 | 1353 | } else { |
75c51032 AD |
1354 | for (var i = 0; i < article_cache.length; i++) { |
1355 | if (article_cache[i]["id"] == id && article_cache[i]["param"] == param) { | |
b39b57ac | 1356 | return true; |
fb456d28 | 1357 | } |
e19c1824 AD |
1358 | } |
1359 | } | |
1360 | return false; | |
1361 | } | |
1362 | ||
e097e8be | 1363 | function cache_expire() { |
75c51032 | 1364 | if (has_local_storage()) { |
b39b57ac | 1365 | |
75c51032 AD |
1366 | var date = new Date(); |
1367 | var timestamp = Math.round(date.getTime() / 1000); | |
b39b57ac | 1368 | |
75c51032 | 1369 | for (var i = 0; i < localStorage.length; i++) { |
23d064cc | 1370 | |
75c51032 | 1371 | var id = localStorage.key(i); |
23d064cc | 1372 | |
75c51032 AD |
1373 | if (timestamp - cache_added["TS:" + id] > 180) { |
1374 | localStorage.removeItem(id); | |
ff0010c1 | 1375 | } |
75c51032 | 1376 | } |
b39b57ac | 1377 | |
75c51032 AD |
1378 | } else { |
1379 | while (article_cache.length > 25) { | |
1380 | article_cache.shift(); | |
fb456d28 | 1381 | } |
fed4387d | 1382 | } |
e097e8be | 1383 | } |
b07b61da | 1384 | |
641444d3 | 1385 | function cache_flush() { |
75c51032 | 1386 | if (has_local_storage()) { |
5225d420 AD |
1387 | localStorage.clear(); |
1388 | } else { | |
1389 | article_cache = new Array(); | |
1390 | } | |
3c2d7945 AD |
1391 | } |
1392 | ||
b07b61da | 1393 | function cache_invalidate(id) { |
c1b18749 | 1394 | try { |
75c51032 | 1395 | if (has_local_storage()) { |
c1b18749 | 1396 | |
75c51032 | 1397 | var found = false; |
b39b57ac | 1398 | |
75c51032 AD |
1399 | for (var i = 0; i < localStorage.length; i++) { |
1400 | var key = localStorage.key(i); | |
b39b57ac AD |
1401 | |
1402 | // console.warn("cache_invalidate: " + key_id + " cmp " + id); | |
ff0010c1 | 1403 | |
75c51032 AD |
1404 | if (key == id || key.indexOf(id + ":") == 0) { |
1405 | localStorage.removeItem(key); | |
1406 | found = true; | |
1407 | break; | |
ff0010c1 | 1408 | } |
75c51032 | 1409 | } |
b39b57ac | 1410 | |
75c51032 | 1411 | return found; |
b39b57ac | 1412 | |
75c51032 AD |
1413 | } else { |
1414 | var i = 0 | |
ff0010c1 | 1415 | |
75c51032 AD |
1416 | while (i < article_cache.length) { |
1417 | if (article_cache[i]["id"] == id) { | |
1418 | //console.log("cache_invalidate: removed id " + id); | |
1419 | article_cache.splice(i, 1); | |
1420 | return true; | |
fb456d28 | 1421 | } |
75c51032 | 1422 | i++; |
c1b18749 | 1423 | } |
b07b61da | 1424 | } |
fb456d28 | 1425 | |
f8fb4498 | 1426 | //console.log("cache_invalidate: id not found: " + id); |
c1b18749 AD |
1427 | return false; |
1428 | } catch (e) { | |
1429 | exception_error("cache_invalidate", e); | |
b07b61da | 1430 | } |
b07b61da | 1431 | } |
298f3f78 AD |
1432 | |
1433 | function getActiveArticleId() { | |
1434 | return active_post_id; | |
1435 | } | |
e4914b62 | 1436 | |
b39b57ac AD |
1437 | function preloadBatchedArticles() { |
1438 | try { | |
1439 | ||
1440 | var query = "?op=rpc&subop=getArticles&ids=" + | |
1441 | preload_id_batch.toString(); | |
1442 | ||
1443 | new Ajax.Request("backend.php", { | |
1444 | parameters: query, | |
1445 | onComplete: function(transport) { | |
1446 | ||
1447 | preload_id_batch = []; | |
1448 | ||
1449 | var articles = transport.responseXML.getElementsByTagName("article"); | |
1450 | ||
1451 | for (var i = 0; i < articles.length; i++) { | |
1452 | var id = articles[i].getAttribute("id"); | |
1453 | if (!cache_check(id)) { | |
1454 | cache_inject(id, articles[i].firstChild.nodeValue); | |
1455 | console.log("preloaded article: " + id); | |
1456 | } | |
1457 | } | |
1458 | } }); | |
1459 | ||
1460 | } catch (e) { | |
1461 | exception_error("preloadBatchedArticles", e); | |
1462 | } | |
1463 | } | |
1464 | ||
aa0fa9df AD |
1465 | function preloadArticleUnderPointer(id) { |
1466 | try { | |
a598370d AD |
1467 | if (getInitParam("bw_limit") == "1") return; |
1468 | ||
b2bb787c | 1469 | if (post_under_pointer == id && !cache_check(id)) { |
aa0fa9df | 1470 | |
84c7b824 | 1471 | console.log("trying to preload article " + id); |
aa0fa9df AD |
1472 | |
1473 | var neighbor_ids = getRelativePostIds(id, 1); | |
1474 | ||
1475 | /* only request uncached articles */ | |
1476 | ||
b39b57ac AD |
1477 | if (preload_id_batch.indexOf(id) == -1) { |
1478 | for (var i = 0; i < neighbor_ids.length; i++) { | |
1479 | if (!cache_check(neighbor_ids[i])) { | |
1480 | preload_id_batch.push(neighbor_ids[i]); | |
1481 | } | |
aa0fa9df AD |
1482 | } |
1483 | } | |
aa0fa9df | 1484 | |
b39b57ac AD |
1485 | if (preload_id_batch.indexOf(id) == -1) |
1486 | preload_id_batch.push(id); | |
aa0fa9df | 1487 | |
f8fb4498 | 1488 | //console.log("preload ids batch: " + preload_id_batch.toString()); |
b4e75b2a | 1489 | |
b39b57ac AD |
1490 | window.clearTimeout(preload_timeout_id); |
1491 | preload_batch_timeout_id = window.setTimeout('preloadBatchedArticles()', 1000); | |
a5819bb3 | 1492 | |
aa0fa9df AD |
1493 | } |
1494 | } catch (e) { | |
1495 | exception_error("preloadArticleUnderPointer", e); | |
1496 | } | |
1497 | } | |
1498 | ||
314fcd2b AD |
1499 | function postMouseIn(id) { |
1500 | try { | |
aa0fa9df AD |
1501 | if (post_under_pointer != id) { |
1502 | post_under_pointer = id; | |
1503 | if (!isCdmMode()) { | |
1504 | window.setTimeout("preloadArticleUnderPointer(" + id + ")", 250); | |
1505 | } | |
1506 | } | |
1507 | ||
314fcd2b AD |
1508 | } catch (e) { |
1509 | exception_error("postMouseIn", e); | |
1510 | } | |
1511 | } | |
1512 | ||
1513 | function postMouseOut(id) { | |
1514 | try { | |
1515 | post_under_pointer = false; | |
1516 | } catch (e) { | |
1517 | exception_error("postMouseOut", e); | |
1518 | } | |
1519 | } | |
1520 | ||
ac541432 AD |
1521 | function headlines_scroll_handler() { |
1522 | try { | |
1523 | ||
acac8448 | 1524 | var e = $("headlinesInnerContainer"); |
ac541432 | 1525 | |
4764c27e AD |
1526 | var toolbar_form = document.forms["main_toolbar_form"]; |
1527 | ||
dad14b51 AD |
1528 | // console.log((e.scrollTop + e.offsetHeight) + " vs " + e.scrollHeight + " dis? " + |
1529 | // _infscroll_disable); | |
587bef10 | 1530 | |
6f068202 AD |
1531 | if (e.scrollTop + e.offsetHeight > e.scrollHeight - 100) { |
1532 | if (!_infscroll_disable) { | |
6f068202 | 1533 | viewNextFeedPage(); |
29dfb258 | 1534 | } |
ac541432 AD |
1535 | } |
1536 | ||
1537 | } catch (e) { | |
1538 | exception_error("headlines_scroll_handler", e); | |
1539 | } | |
1540 | } | |
8be83f42 AD |
1541 | |
1542 | function catchupRelativeToArticle(below) { | |
1543 | ||
1544 | try { | |
1545 | ||
49fd1e94 | 1546 | |
8be83f42 AD |
1547 | if (!getActiveArticleId()) { |
1548 | alert(__("No article is selected.")); | |
1549 | return; | |
1550 | } | |
1551 | ||
e69fb880 | 1552 | var visible_ids = getVisibleArticleIds(); |
8be83f42 AD |
1553 | |
1554 | var ids_to_mark = new Array(); | |
1555 | ||
1556 | if (!below) { | |
1557 | for (var i = 0; i < visible_ids.length; i++) { | |
1558 | if (visible_ids[i] != getActiveArticleId()) { | |
acac8448 | 1559 | var e = $("RROW-" + visible_ids[i]); |
8be83f42 | 1560 | |
ca8e3d75 | 1561 | if (e && e.hasClassName("Unread")) { |
8be83f42 AD |
1562 | ids_to_mark.push(visible_ids[i]); |
1563 | } | |
1564 | } else { | |
1565 | break; | |
1566 | } | |
1567 | } | |
1568 | } else { | |
1569 | for (var i = visible_ids.length-1; i >= 0; i--) { | |
1570 | if (visible_ids[i] != getActiveArticleId()) { | |
acac8448 | 1571 | var e = $("RROW-" + visible_ids[i]); |
8be83f42 | 1572 | |
ca8e3d75 | 1573 | if (e && e.hasClassName("Unread")) { |
8be83f42 AD |
1574 | ids_to_mark.push(visible_ids[i]); |
1575 | } | |
1576 | } else { | |
1577 | break; | |
1578 | } | |
1579 | } | |
1580 | } | |
1581 | ||
1582 | if (ids_to_mark.length == 0) { | |
1583 | alert(__("No articles found to mark")); | |
1584 | } else { | |
1585 | var msg = __("Mark %d article(s) as read?").replace("%d", ids_to_mark.length); | |
1586 | ||
fb45339a | 1587 | if (getInitParam("confirm_feed_catchup") != 1 || confirm(msg)) { |
8be83f42 AD |
1588 | |
1589 | for (var i = 0; i < ids_to_mark.length; i++) { | |
acac8448 | 1590 | var e = $("RROW-" + ids_to_mark[i]); |
ca8e3d75 | 1591 | e.removeClassName("Unread"); |
8be83f42 AD |
1592 | } |
1593 | ||
b4e75b2a AD |
1594 | var query = "?op=rpc&subop=catchupSelected" + |
1595 | "&cmode=0" + "&ids=" + param_escape(ids_to_mark.toString()); | |
8be83f42 | 1596 | |
b4e75b2a AD |
1597 | new Ajax.Request("backend.php", { |
1598 | parameters: query, | |
5fe7767c AD |
1599 | onComplete: function(transport) { |
1600 | catchup_callback2(transport); | |
1601 | } }); | |
1602 | ||
8be83f42 AD |
1603 | } |
1604 | } | |
1605 | ||
1606 | } catch (e) { | |
1607 | exception_error("catchupRelativeToArticle", e); | |
1608 | } | |
1609 | } | |
a04c8e8d | 1610 | |
dad14b51 | 1611 | function cdmExpandArticle(id) { |
a04c8e8d | 1612 | try { |
a04c8e8d | 1613 | |
e69fb880 AD |
1614 | hideAuxDlg(); |
1615 | ||
dad14b51 | 1616 | var elem = $("CICD-" + active_post_id); |
3cd4239a | 1617 | |
62b800b4 AD |
1618 | var upd_img_pic = $("FUPDPIC-" + id); |
1619 | ||
1620 | if (upd_img_pic && (upd_img_pic.src.match("updated.png") || | |
1621 | upd_img_pic.src.match("fresh_sign.png"))) { | |
1622 | ||
1623 | upd_img_pic.src = "images/blank_icon.gif"; | |
1624 | } | |
1625 | ||
dad14b51 AD |
1626 | if (id == active_post_id && Element.visible(elem)) |
1627 | return true; | |
1628 | ||
e69fb880 | 1629 | selectArticles("none"); |
dad14b51 AD |
1630 | |
1631 | var old_offset = $("RROW-" + id).offsetTop; | |
1632 | ||
5ae8f858 | 1633 | if (active_post_id && elem && !getInitParam("cdm_expanded")) { |
dad14b51 AD |
1634 | Element.hide(elem); |
1635 | Element.show("CEXC-" + active_post_id); | |
1636 | } | |
a04c8e8d | 1637 | |
dad14b51 | 1638 | active_post_id = id; |
a04c8e8d | 1639 | |
dad14b51 AD |
1640 | elem = $("CICD-" + id); |
1641 | ||
1642 | if (!Element.visible(elem)) { | |
1643 | Element.show(elem); | |
1644 | Element.hide("CEXC-" + id); | |
dd1c0680 | 1645 | |
20f16e71 | 1646 | if ($("CWRAP-" + id).innerHTML == "") { |
dd1c0680 | 1647 | |
20f16e71 | 1648 | $("FUPDPIC-" + id).src = "images/indicator_tiny.gif"; |
dd1c0680 | 1649 | |
20f16e71 AD |
1650 | $("CWRAP-" + id).innerHTML = "<div class=\"insensitive\">" + |
1651 | __("Loading, please wait...") + "</div>"; | |
1652 | ||
1653 | var query = "?op=rpc&subop=cdmGetArticle&id=" + param_escape(id); | |
1654 | ||
1655 | //console.log(query); | |
1656 | ||
1657 | new Ajax.Request("backend.php", { | |
1658 | parameters: query, | |
1659 | onComplete: function(transport) { | |
1660 | $("FUPDPIC-" + id).src = 'images/blank_icon.gif'; | |
1661 | ||
1662 | if (transport.responseXML) { | |
1663 | var article = transport.responseXML.getElementsByTagName("article")[0]; | |
1664 | var recv_id = article.getAttribute("id"); | |
1665 | ||
1666 | if (recv_id == id) | |
1667 | $("CWRAP-" + id).innerHTML = article.firstChild.nodeValue; | |
1668 | ||
1669 | } else { | |
1670 | $("CWRAP-" + id).innerHTML = __("Unable to load article."); | |
1671 | ||
1672 | } | |
1673 | }}); | |
1674 | ||
1675 | } | |
dad14b51 AD |
1676 | } |
1677 | ||
1678 | var new_offset = $("RROW-" + id).offsetTop; | |
1679 | ||
9eac2f0d | 1680 | $("headlines-frame").scrollTop += (new_offset-old_offset); |
dad14b51 AD |
1681 | |
1682 | if ($("RROW-" + id).offsetTop != old_offset) | |
9eac2f0d | 1683 | $("headlines-frame").scrollTop = new_offset; |
dad14b51 AD |
1684 | |
1685 | toggleUnread(id, 0, true); | |
1686 | toggleSelected(id); | |
a04c8e8d AD |
1687 | |
1688 | } catch (e) { | |
d5ed5446 | 1689 | exception_error("cdmExpandArticle", e); |
a04c8e8d AD |
1690 | } |
1691 | ||
dad14b51 | 1692 | return false; |
a04c8e8d AD |
1693 | } |
1694 | ||
3818a89b AD |
1695 | function fixHeadlinesOrder(ids) { |
1696 | try { | |
1697 | for (var i = 0; i < ids.length; i++) { | |
acac8448 | 1698 | var e = $("RROW-" + ids[i]); |
3818a89b AD |
1699 | |
1700 | if (e) { | |
1701 | if (i % 2 == 0) { | |
ca8e3d75 AD |
1702 | e.removeClassName("even"); |
1703 | e.addClassName("odd"); | |
3818a89b | 1704 | } else { |
ca8e3d75 AD |
1705 | e.removeClassName("odd"); |
1706 | e.addClassName("even"); | |
3818a89b AD |
1707 | } |
1708 | } | |
1709 | } | |
1710 | } catch (e) { | |
1711 | exception_error("fixHeadlinesOrder", e); | |
1712 | } | |
1713 | } | |
1714 | ||
314fcd2b AD |
1715 | function getArticleUnderPointer() { |
1716 | return post_under_pointer; | |
7a822893 | 1717 | } |
eedfb635 | 1718 | |
41c67dd2 | 1719 | function zoomToArticle(event, id) { |
eedfb635 | 1720 | try { |
6f3976c9 | 1721 | /* var w = window.open("backend.php?op=view&mode=zoom&id=" + param_escape(id), |
eedfb635 | 1722 | "ttrss_zoom_" + id, |
6f3976c9 AD |
1723 | "status=0,toolbar=0,location=0,width=450,height=300,scrollbars=1,menubar=0"); */ |
1724 | ||
1725 | var cached_article = cache_find(id); | |
1726 | ||
e3387e2d | 1727 | if (dijit.byId("ATAB-" + id)) |
41c67dd2 AD |
1728 | if (!event || !event.shiftKey) |
1729 | return dijit.byId("content-tabs").selectChild(dijit.byId("ATAB-" + id)); | |
e3387e2d | 1730 | |
6f3976c9 AD |
1731 | if (cached_article) { |
1732 | ||
1733 | var article_pane = new dijit.layout.ContentPane({ | |
1734 | title: __("Loading...") , content: cached_article, | |
1735 | style: 'padding : 0px;', | |
e3387e2d | 1736 | id: 'ATAB-' + id, |
6f3976c9 AD |
1737 | closable: true }); |
1738 | ||
1739 | dijit.byId("content-tabs").addChild(article_pane); | |
41c67dd2 AD |
1740 | |
1741 | if (!event || !event.shiftKey) | |
1742 | dijit.byId("content-tabs").selectChild(article_pane); | |
6f3976c9 AD |
1743 | |
1744 | if ($("PTITLE-" + id)) | |
1745 | article_pane.attr('title', $("PTITLE-" + id).innerHTML); | |
1746 | ||
1747 | } else { | |
1748 | ||
1749 | var query = "?op=rpc&subop=getArticles&ids=" + param_escape(id); | |
1750 | ||
1751 | notify_progress("Loading, please wait...", true); | |
1752 | ||
1753 | new Ajax.Request("backend.php", { | |
1754 | parameters: query, | |
1755 | onComplete: function(transport) { | |
1756 | notify(''); | |
1757 | ||
1758 | if (transport.responseXML) { | |
1759 | closeArticlePanel(); | |
1760 | ||
1761 | var article = transport.responseXML.getElementsByTagName("article")[0]; | |
1762 | var content = article.firstChild.nodeValue; | |
1763 | ||
1764 | var article_pane = new dijit.layout.ContentPane({ | |
1765 | title: "article-" + id , content: content, | |
1766 | style: 'padding : 0px;', | |
e3387e2d | 1767 | id: 'ATAB-' + id, |
6f3976c9 AD |
1768 | closable: true }); |
1769 | ||
1770 | dijit.byId("content-tabs").addChild(article_pane); | |
41c67dd2 AD |
1771 | |
1772 | if (!event || !event.shiftKey) | |
1773 | dijit.byId("content-tabs").selectChild(article_pane); | |
6f3976c9 AD |
1774 | |
1775 | if ($("PTITLE-" + id)) | |
1776 | article_pane.attr('title', $("PTITLE-" + id).innerHTML); | |
1777 | } | |
1778 | ||
1779 | } }); | |
1780 | } | |
eedfb635 AD |
1781 | |
1782 | } catch (e) { | |
1783 | exception_error("zoomToArticle", e); | |
1784 | } | |
1785 | } | |
a411875b AD |
1786 | |
1787 | function scrollArticle(offset) { | |
1788 | try { | |
1789 | if (!isCdmMode()) { | |
acac8448 | 1790 | var ci = $("content-insert"); |
a411875b AD |
1791 | if (ci) { |
1792 | ci.scrollTop += offset; | |
1793 | } | |
1794 | } else { | |
acac8448 | 1795 | var hi = $("headlinesInnerContainer"); |
a411875b AD |
1796 | if (hi) { |
1797 | hi.scrollTop += offset; | |
1798 | } | |
1799 | ||
1800 | } | |
1801 | } catch (e) { | |
1802 | exception_error("scrollArticle", e); | |
1803 | } | |
1804 | } | |
f9247195 AD |
1805 | |
1806 | function show_labels_in_headlines(transport) { | |
1807 | try { | |
1808 | if (transport.responseXML) { | |
1809 | var info = transport.responseXML.getElementsByTagName("info-for-headlines")[0]; | |
1810 | ||
1811 | var elems = info.getElementsByTagName("entry"); | |
1812 | ||
1813 | for (var l = 0; l < elems.length; l++) { | |
1814 | var e_id = elems[l].getAttribute("id"); | |
1815 | ||
1816 | if (e_id) { | |
1817 | ||
acac8448 | 1818 | var ctr = $("HLLCTR-" + e_id); |
f9247195 AD |
1819 | |
1820 | if (ctr) { | |
1821 | ctr.innerHTML = elems[l].firstChild.nodeValue; | |
1822 | } | |
1823 | } | |
1824 | ||
1825 | } | |
1826 | ||
1827 | } | |
1828 | } catch (e) { | |
1829 | exception_error("show_labels_in_headlines", e); | |
1830 | ||
1831 | } | |
1832 | } | |
bf3c9838 AD |
1833 | |
1834 | function toggleHeadlineActions() { | |
1835 | try { | |
acac8448 AD |
1836 | var e = $("headlineActionsBody"); |
1837 | var p = $("headlineActionsDrop"); | |
bf3c9838 AD |
1838 | |
1839 | if (!Element.visible(e)) { | |
1840 | Element.show(e); | |
1841 | } else { | |
1842 | Element.hide(e); | |
1843 | } | |
1844 | ||
b62f6ff4 | 1845 | e.scrollTop = 0; |
bf3c9838 | 1846 | e.style.left = (p.offsetLeft + 1) + "px"; |
b4dc02e2 | 1847 | e.style.top = (p.offsetTop + p.offsetHeight + 2) + "px"; |
bf3c9838 AD |
1848 | |
1849 | } catch (e) { | |
1850 | exception_error("toggleHeadlineActions", e); | |
1851 | } | |
1852 | } | |
c7e51de1 AD |
1853 | |
1854 | function publishWithNote(id, def_note) { | |
1855 | try { | |
1856 | if (!def_note) def_note = ''; | |
1857 | ||
1858 | var note = prompt(__("Please enter a note for this article:"), def_note); | |
1859 | ||
1860 | if (note != undefined) { | |
1861 | togglePub(id, false, false, note); | |
1862 | } | |
1863 | ||
1864 | } catch (e) { | |
1865 | exception_error("publishWithNote", e); | |
1866 | } | |
1867 | } | |
31a53903 AD |
1868 | |
1869 | function emailArticle(id) { | |
1870 | try { | |
f72a7b66 AD |
1871 | if (!id) { |
1872 | var ids = getSelectedArticleIds2(); | |
1873 | ||
1874 | if (ids.length == 0) { | |
1875 | alert(__("No articles are selected.")); | |
1876 | return; | |
1877 | } | |
1878 | ||
1879 | id = ids.toString(); | |
1880 | } | |
1881 | ||
31a53903 AD |
1882 | displayDlg('emailArticle', id, |
1883 | function () { | |
1884 | document.forms['article_email_form'].destination.focus(); | |
1885 | ||
1886 | new Ajax.Autocompleter('destination', 'destination_choices', | |
1887 | "backend.php?op=rpc&subop=completeEmails", | |
1888 | { tokens: '', paramName: "search" }); | |
1889 | ||
1890 | }); | |
1891 | ||
1892 | } catch (e) { | |
1893 | exception_error("emailArticle", e); | |
1894 | } | |
1895 | } | |
1896 | ||
f72a7b66 | 1897 | function emailArticleDo() { |
31a53903 AD |
1898 | try { |
1899 | var f = document.forms['article_email_form']; | |
1900 | ||
1901 | if (f.destination.value == "") { | |
1902 | alert("Please fill in the destination email."); | |
1903 | return; | |
1904 | } | |
1905 | ||
1906 | if (f.subject.value == "") { | |
1907 | alert("Please fill in the subject."); | |
1908 | return; | |
1909 | } | |
1910 | ||
1911 | var query = Form.serialize("article_email_form"); | |
1912 | ||
1913 | // console.log(query); | |
1914 | ||
1915 | new Ajax.Request("backend.php", { | |
1916 | parameters: query, | |
1917 | onComplete: function(transport) { | |
1918 | try { | |
1919 | ||
1920 | var error = transport.responseXML.getElementsByTagName('error')[0]; | |
1921 | ||
1922 | if (error) { | |
1923 | alert(__('Error sending email:') + ' ' + error.firstChild.nodeValue); | |
1924 | } else { | |
1925 | notify_info('Your message has been sent.'); | |
1926 | closeInfoBox(); | |
1927 | } | |
1928 | ||
1929 | } catch (e) { | |
1930 | exception_error("sendEmailDo", e); | |
1931 | } | |
1932 | ||
1933 | } }); | |
1934 | ||
1935 | } catch (e) { | |
1936 | exception_error("emailArticleDo", e); | |
1937 | } | |
1938 | } | |
dad14b51 | 1939 | |
1ede5814 | 1940 | function dismissArticle(id) { |
dad14b51 AD |
1941 | try { |
1942 | var elem = $("RROW-" + id); | |
1943 | ||
1944 | toggleUnread(id, 0, true); | |
1945 | ||
1946 | new Effect.Fade(elem, {duration : 0.5}); | |
1947 | ||
35c0e3a2 AD |
1948 | active_post_id = false; |
1949 | ||
dad14b51 | 1950 | } catch (e) { |
1ede5814 | 1951 | exception_error("dismissArticle", e); |
dad14b51 AD |
1952 | } |
1953 | } | |
bfa0e792 | 1954 | |
1ede5814 | 1955 | function dismissSelectedArticles() { |
bfa0e792 AD |
1956 | try { |
1957 | ||
e69fb880 AD |
1958 | var ids = getVisibleArticleIds(); |
1959 | var tmp = []; | |
1960 | var sel = []; | |
bfa0e792 AD |
1961 | |
1962 | for (var i = 0; i < ids.length; i++) { | |
1963 | var elem = $("RROW-" + ids[i]); | |
e69fb880 | 1964 | |
ca8e3d75 | 1965 | if (elem.className && elem.hasClassName("Selected") && |
35c0e3a2 | 1966 | ids[i] != active_post_id) { |
e69fb880 AD |
1967 | new Effect.Fade(elem, {duration : 0.5}); |
1968 | sel.push(ids[i]); | |
1969 | } else { | |
1970 | tmp.push(ids[i]); | |
1971 | } | |
bfa0e792 AD |
1972 | } |
1973 | ||
e69fb880 | 1974 | if (sel.length > 0) |
bfa0e792 AD |
1975 | selectionToggleUnread(false); |
1976 | ||
e69fb880 AD |
1977 | fixHeadlinesOrder(tmp); |
1978 | ||
bfa0e792 | 1979 | } catch (e) { |
1ede5814 | 1980 | exception_error("dismissSelectedArticles", e); |
bfa0e792 AD |
1981 | } |
1982 | } | |
1ede5814 AD |
1983 | |
1984 | function dismissReadArticles() { | |
1985 | try { | |
1986 | ||
1987 | var ids = getVisibleArticleIds(); | |
e69fb880 | 1988 | var tmp = []; |
1ede5814 AD |
1989 | |
1990 | for (var i = 0; i < ids.length; i++) { | |
1991 | var elem = $("RROW-" + ids[i]); | |
1992 | ||
ca8e3d75 AD |
1993 | if (elem.className && !elem.hasClassName("Unread") && |
1994 | !elem.hasClassName("Selected")) { | |
1ede5814 AD |
1995 | |
1996 | new Effect.Fade(elem, {duration : 0.5}); | |
e69fb880 AD |
1997 | } else { |
1998 | tmp.push(ids[i]); | |
1ede5814 AD |
1999 | } |
2000 | } | |
2001 | ||
e69fb880 AD |
2002 | fixHeadlinesOrder(tmp); |
2003 | ||
1ede5814 AD |
2004 | } catch (e) { |
2005 | exception_error("dismissSelectedArticles", e); | |
2006 | } | |
2007 | } | |
2008 | ||
2009 | function getVisibleArticleIds() { | |
e69fb880 AD |
2010 | var ids = []; |
2011 | ||
1ede5814 | 2012 | try { |
ca8e3d75 AD |
2013 | |
2014 | getLoadedArticleIds().each(function(id) { | |
2015 | var elem = $("RROW-" + id); | |
e69fb880 | 2016 | if (elem && Element.visible(elem)) |
ca8e3d75 AD |
2017 | ids.push(id); |
2018 | }); | |
e69fb880 | 2019 | |
1ede5814 | 2020 | } catch (e) { |
e69fb880 | 2021 | exception_error("getVisibleArticleIds", e); |
1ede5814 | 2022 | } |
e69fb880 AD |
2023 | |
2024 | return ids; | |
1ede5814 AD |
2025 | } |
2026 | ||
2027 | function cdmClicked(event, id) { | |
2028 | try { | |
2029 | var shift_key = event.shiftKey; | |
2030 | ||
e69fb880 AD |
2031 | hideAuxDlg(); |
2032 | ||
1ede5814 | 2033 | if (!event.ctrlKey) { |
62b800b4 | 2034 | |
6f3976c9 AD |
2035 | if (!getInitParam("cdm_expanded")) { |
2036 | return cdmExpandArticle(id); | |
2037 | } else { | |
62b800b4 | 2038 | |
6f3976c9 AD |
2039 | selectArticles("none"); |
2040 | toggleSelected(id); | |
2041 | ||
2042 | var elem = $("RROW-" + id); | |
2043 | ||
2044 | if (elem) | |
2045 | elem.removeClassName("Unread"); | |
2046 | ||
2047 | var upd_img_pic = $("FUPDPIC-" + id); | |
2048 | ||
2049 | if (upd_img_pic && (upd_img_pic.src.match("updated.png") || | |
2050 | upd_img_pic.src.match("fresh_sign.png"))) { | |
2051 | ||
2052 | upd_img_pic.src = "images/blank_icon.gif"; | |
2053 | } | |
2054 | ||
2055 | active_post_id = id; | |
2056 | ||
2057 | var query = "?op=rpc&subop=catchupSelected" + | |
2058 | "&cmode=0&ids=" + param_escape(id); | |
2059 | ||
2060 | new Ajax.Request("backend.php", { | |
2061 | parameters: query, | |
2062 | onComplete: function(transport) { | |
2063 | handle_rpc_reply(transport); | |
2064 | } }); | |
62b800b4 AD |
2065 | } |
2066 | ||
1ede5814 | 2067 | } else { |
6f3976c9 AD |
2068 | toggleSelected(id, true); |
2069 | toggleUnread(id, 0, false); | |
41c67dd2 | 2070 | zoomToArticle(event, id); |
1ede5814 AD |
2071 | } |
2072 | ||
2073 | } catch (e) { | |
2074 | exception_error("cdmClicked"); | |
2075 | } | |
2076 | ||
2077 | return false; | |
2078 | } | |
2079 | ||
2080 | function hlClicked(event, id) { | |
2081 | try { | |
1ede5814 AD |
2082 | |
2083 | if (!event.ctrlKey) { | |
2084 | view(id); | |
3974aad8 | 2085 | return true; |
1ede5814 | 2086 | } else { |
90044154 AD |
2087 | selectArticles('none'); |
2088 | toggleSelected(id); | |
6f3976c9 | 2089 | toggleUnread(id, 0, false); |
41c67dd2 | 2090 | zoomToArticle(event, id); |
3974aad8 | 2091 | return false; |
1ede5814 AD |
2092 | } |
2093 | ||
2094 | } catch (e) { | |
2095 | exception_error("hlClicked"); | |
2096 | } | |
2097 | ||
2098 | return false; | |
2099 | } | |
e69fb880 AD |
2100 | |
2101 | function getFirstVisibleHeadlineId() { | |
2102 | var rows = getVisibleArticleIds(); | |
2103 | return rows[0]; | |
2104 | ||
2105 | } | |
2106 | ||
2107 | function getLastVisibleHeadlineId() { | |
2108 | var rows = getVisibleArticleIds(); | |
2109 | return rows[rows.length-1]; | |
2110 | } | |
2111 | ||
e69fb880 AD |
2112 | function openArticleInNewWindow(id) { |
2113 | try { | |
2114 | console.log("openArticleInNewWindow: " + id); | |
2115 | ||
2116 | var query = "?op=rpc&subop=getArticleLink&id=" + id; | |
2117 | var wname = "ttrss_article_" + id; | |
2118 | ||
2119 | console.log(query + " " + wname); | |
2120 | ||
2121 | var w = window.open("", wname); | |
2122 | ||
2123 | if (!w) notify_error("Failed to open window for the article"); | |
2124 | ||
2125 | new Ajax.Request("backend.php", { | |
2126 | parameters: query, | |
2127 | onComplete: function(transport) { | |
2128 | ||
2129 | var link = transport.responseXML.getElementsByTagName("link")[0]; | |
2130 | var id = transport.responseXML.getElementsByTagName("id")[0]; | |
2131 | ||
2132 | console.log("open_article received link: " + link); | |
2133 | ||
2134 | if (link && id) { | |
2135 | ||
2136 | var wname = "ttrss_article_" + id.firstChild.nodeValue; | |
2137 | ||
2138 | console.log("link url: " + link.firstChild.nodeValue + ", wname " + wname); | |
2139 | ||
2140 | var w = window.open(link.firstChild.nodeValue, wname); | |
2141 | ||
2142 | if (!w) { notify_error("Failed to load article in new window"); } | |
2143 | ||
2144 | if (id) { | |
2145 | id = id.firstChild.nodeValue; | |
8cc5e965 | 2146 | window.setTimeout("toggleUnread(" + id + ", 0)", 100); |
e69fb880 AD |
2147 | } |
2148 | } else { | |
2149 | notify_error("Can't open article: received invalid article link"); | |
2150 | } | |
2151 | } }); | |
2152 | ||
2153 | } catch (e) { | |
2154 | exception_error("openArticleInNewWindow", e); | |
2155 | } | |
2156 | } | |
2157 | ||
2158 | function isCdmMode() { | |
8cc5e965 | 2159 | return getInitParam("combined_display_mode"); |
e69fb880 AD |
2160 | } |
2161 | ||
2162 | function markHeadline(id) { | |
2163 | var row = $("RROW-" + id); | |
2164 | if (row) { | |
e69fb880 AD |
2165 | var check = $("RCHK-" + id); |
2166 | ||
2167 | if (check) { | |
2168 | check.checked = true; | |
2169 | } | |
2170 | ||
ca8e3d75 | 2171 | row.addClassName("Selected"); |
e69fb880 AD |
2172 | } |
2173 | } | |
2174 | ||
8cc5e965 AD |
2175 | function getRelativePostIds(id, limit) { |
2176 | ||
2177 | var tmp = []; | |
2178 | ||
2179 | try { | |
2180 | ||
2181 | if (!limit) limit = 3; | |
2182 | ||
2183 | var ids = getVisibleArticleIds(); | |
2184 | ||
2185 | for (var i = 0; i < ids.length; i++) { | |
2186 | if (ids[i] == id) { | |
2187 | for (var k = 1; k <= limit; k++) { | |
2188 | if (i > k-1) tmp.push(ids[i-k]); | |
2189 | if (i < ids.length-k) tmp.push(ids[i+k]); | |
2190 | } | |
2191 | break; | |
2192 | } | |
2193 | } | |
2194 | ||
2195 | } catch (e) { | |
2196 | exception_error("getRelativePostIds", e); | |
2197 | } | |
2198 | ||
2199 | return tmp; | |
2200 | } | |
2201 | ||
2202 | function correctHeadlinesOffset(id) { | |
2203 | ||
2204 | try { | |
2205 | ||
9eac2f0d | 2206 | var container = $("headlines-frame"); |
8cc5e965 AD |
2207 | var row = $("RROW-" + id); |
2208 | ||
2209 | var viewport = container.offsetHeight; | |
2210 | ||
2211 | var rel_offset_top = row.offsetTop - container.scrollTop; | |
2212 | var rel_offset_bottom = row.offsetTop + row.offsetHeight - container.scrollTop; | |
2213 | ||
2214 | //console.log("Rtop: " + rel_offset_top + " Rbtm: " + rel_offset_bottom); | |
2215 | //console.log("Vport: " + viewport); | |
2216 | ||
2217 | if (rel_offset_top <= 0 || rel_offset_top > viewport) { | |
2218 | container.scrollTop = row.offsetTop; | |
2219 | } else if (rel_offset_bottom > viewport) { | |
2220 | ||
2221 | /* doesn't properly work with Opera in some cases because | |
2222 | Opera fucks up element scrolling */ | |
2223 | ||
2224 | container.scrollTop = row.offsetTop + row.offsetHeight - viewport; | |
2225 | } | |
2226 | ||
2227 | } catch (e) { | |
2228 | exception_error("correctHeadlinesOffset", e); | |
2229 | } | |
2230 | ||
2231 | } | |
2232 | ||
fcf70c51 AD |
2233 | function headlineActionsChange(elem) { |
2234 | try { | |
2235 | var op = elem[elem.selectedIndex].value; | |
2236 | ||
2237 | eval(op); | |
2238 | ||
2239 | elem.selectedIndex = 0; | |
e69fb880 | 2240 | |
fcf70c51 AD |
2241 | } catch (e) { |
2242 | exception_error("headlineActionsChange", e); | |
2243 | } | |
2244 | } | |
6f3976c9 | 2245 | |
0b461ed5 | 2246 | function closeArticlePanel() { |
e3387e2d | 2247 | |
0b461ed5 AD |
2248 | var tabs = dijit.byId("content-tabs"); |
2249 | var child = tabs.selectedChildWidget; | |
2250 | ||
2251 | if (child && tabs.getIndexOfChild(child) > 0) { | |
2252 | tabs.removeChild(child); | |
2253 | child.destroy(); | |
2254 | } else { | |
2255 | if (dijit.byId("content-insert")) | |
2256 | dijit.byId("headlines-wrap-inner").removeChild( | |
2257 | dijit.byId("content-insert")); | |
2258 | } | |
2259 | ||
2260 | ||
2261 | /* if (id) | |
e3387e2d AD |
2262 | if (dijit.byId("ATAB-" + id)) |
2263 | return dijit.byId("content-tabs").removeChild(dijit.byId("ATAB-" + id)); | |
2264 | ||
6f3976c9 AD |
2265 | if (dijit.byId("content-insert")) |
2266 | dijit.byId("headlines-wrap-inner").removeChild( | |
0b461ed5 | 2267 | dijit.byId("content-insert")); */ |
6f3976c9 | 2268 | } |