]>
git.wh0rd.org - tt-rss.git/blob - viewfeed.js
1 var active_post_id
= false;
2 var last_article_view
= false;
3 var active_real_feed_id
= false;
5 var article_cache
= new Array();
7 var vgroup_last_feed
= false;
8 var post_under_pointer
= false;
10 var last_requested_article
= false;
12 var preload_id_batch
= [];
13 var preload_timeout_id
= false;
17 function headlines_callback2(transport
, feed_cur_page
) {
19 handle_rpc_json(transport
);
21 loading_set_progress(25);
23 console
.log("headlines_callback2 [page=" + feed_cur_page
+ "]");
31 reply
= JSON
.parse(transport
.responseText
);
38 is_cat
= reply
['headlines']['is_cat'];
39 feed_id
= reply
['headlines']['id'];
41 setActiveFeedId(feed_id
, is_cat
);
43 var update_btn
= document
.forms
["main_toolbar_form"].update
;
45 update_btn
.disabled
= !(feed_id
>= 0 && !is_cat
);
48 if (feed_cur_page
== 0) {
49 $("headlines-frame").scrollTop
= 0;
53 var headlines_count
= reply
['headlines-info']['count'];
54 var headlines_unread
= reply
['headlines-info']['unread'];
56 vgroup_last_feed
= reply
['headlines-info']['vgroup_last_feed'];
58 if (parseInt(headlines_count
) < getInitParam("default_article_limit")) {
59 _infscroll_disable
= 1;
61 _infscroll_disable
= 0;
64 var counters
= reply
['counters'];
65 var articles
= reply
['articles'];
66 var runtime_info
= reply
['runtime-info'];
68 if (feed_cur_page
== 0) {
69 dijit
.byId("headlines-frame").attr('content',
70 reply
['headlines']['content']);
72 dijit
.byId("headlines-toolbar").attr('content',
73 reply
['headlines']['toolbar']);
75 var hsp
= $("headlines-spacer");
76 if (!hsp
) hsp
= document
.createElement("DIV");
78 hsp
.id
= "headlines-spacer";
80 if (!_infscroll_disable
)
81 hsp
.innerHTML
= "<img src='images/indicator_tiny.gif'> " +
82 __("Loading, please wait...");
84 dijit
.byId('headlines-frame').domNode
.appendChild(hsp
);
89 if (headlines_count
> 0) {
90 console
.log("adding some more headlines...");
92 var c
= dijit
.byId("headlines-frame");
93 var ids
= getSelectedArticleIds2();
95 $("headlines-tmp").innerHTML
= reply
['headlines']['content'];
97 var hsp
= $("headlines-spacer");
100 c
.domNode
.removeChild(hsp
);
102 $$("#headlines-tmp > div").each(function(row
) {
103 c
.domNode
.appendChild(row
);
106 if (!hsp
) hsp
= document
.createElement("DIV");
108 hsp
.id
= "headlines-spacer";
110 if (!_infscroll_disable
)
111 hsp
.innerHTML
= "<img src='images/indicator_tiny.gif'> " +
112 __("Loading, please wait...");
114 c
.domNode
.appendChild(hsp
);
116 console
.log("restore selected ids: " + ids
);
118 for (var i
= 0; i
< ids
.length
; i
++) {
119 markHeadline(ids
[i
]);
125 console
.log("no new headlines received");
127 var hsp
= $("headlines-spacer");
129 if (hsp
) hsp
.innerHTML
= "";
134 for (var i
= 0; i
< articles
.length
; i
++) {
135 var a_id
= articles
[i
]['id'];
136 cache_inject(a_id
, articles
[i
]['content']);
139 console
.log("no cached articles received");
143 parse_counters(counters
);
148 console
.warn("headlines_callback: returned no XML object");
149 dijit
.byId("headlines-frame").attr('content', "<div class='whiteBox'>" +
150 __('Could not update headlines (invalid object received)') + "</div>");
153 _feed_cur_page
= feed_cur_page
;
154 _infscroll_request_sent
= 0;
159 exception_error("headlines_callback2", e
, transport
);
163 function render_article(article
) {
165 dijit
.byId("headlines-wrap-inner").addChild(
166 dijit
.byId("content-insert"));
168 var c
= dijit
.byId("content-insert");
171 c
.domNode
.scrollTop
= 0;
174 c
.attr('content', article
);
176 correctHeadlinesOffset(getActiveArticleId());
183 exception_error("render_article", e
);
187 function showArticleInHeadlines(id
) {
191 selectArticles("none");
193 var crow
= $("RROW-" + id
);
197 var article_is_unread
= crow
.hasClassName("Unread");
199 crow
.removeClassName("Unread");
201 selectArticles('none');
203 var upd_img_pic
= $("FUPDPIC-" + id
);
205 var cache_prefix
= "";
207 if (activeFeedIsCat()) {
213 var view_mode
= false;
216 view_mode
= document
.forms
['main_toolbar_form'].view_mode
;
217 view_mode
= view_mode
[view_mode
.selectedIndex
].value
;
222 if (upd_img_pic
&& (upd_img_pic
.src
.match("updated.png") ||
223 upd_img_pic
.src
.match("fresh_sign.png"))) {
225 upd_img_pic
.src
= "images/blank_icon.gif";
227 cache_invalidate(cache_prefix
+ getActiveFeedId());
229 /* cache_inject(cache_prefix + getActiveFeedId(),
230 $("headlines-frame").innerHTML,
231 getFeedUnread(getActiveFeedId())); */
233 } else if (article_is_unread
&& view_mode
== "all_articles") {
235 cache_invalidate(cache_prefix
+ getActiveFeedId());
237 /* cache_inject(cache_prefix + getActiveFeedId(),
238 $("headlines-frame").innerHTML,
239 getFeedUnread(getActiveFeedId())-1); */
241 } else if (article_is_unread
) {
242 cache_invalidate(cache_prefix
+ getActiveFeedId());
247 if (article_is_unread
)
248 _force_scheduled_update
= true;
251 exception_error("showArticleInHeadlines", e
);
255 function article_callback2(transport
, id
) {
257 console
.log("article_callback2 " + id
);
259 handle_rpc_json(transport
);
261 var reply
= JSON
.parse(transport
.responseText
);
264 var upic
= $('FUPDPIC-' + id
);
266 if (upic
) upic
.src
= 'images/blank_icon.gif';
268 if (id
!= last_requested_article
) {
269 console
.log("requested article id is out of sequence, aborting");
273 reply
.each(function(article
) {
274 if (active_post_id
== article
['id']) {
275 render_article(article
['content']);
277 cache_inject(article
['id'], article
['content']);
281 console
.warn("article_callback: returned invalid data");
283 render_article("<div class='whiteBox'>" +
284 __('Could not display article (invalid data received)') + "</div>");
287 var date
= new Date();
288 last_article_view
= date
.getTime() / 1000;
294 exception_error("article_callback2", e
, transport
);
300 console
.log("loading article: " + id
);
302 var cached_article
= cache_find(id
);
304 console
.log("cache check result: " + (cached_article
!= false));
308 var query
= "?op=view&id=" + param_escape(id
);
310 var neighbor_ids
= getRelativePostIds(active_post_id
);
312 /* only request uncached articles */
314 var cids_to_request
= Array();
316 for (var i
= 0; i
< neighbor_ids
.length
; i
++) {
317 if (!cache_check(neighbor_ids
[i
])) {
318 cids_to_request
.push(neighbor_ids
[i
]);
322 console
.log("additional ids: " + cids_to_request
.toString());
324 query
= query
+ "&cids=" + cids_to_request
.toString();
326 var crow
= $("RROW-" + id
);
327 var article_is_unread
= crow
.hasClassName("Unread");
330 showArticleInHeadlines(id
);
332 if (!cached_article
) {
334 var upic
= $('FUPDPIC-' + id
);
337 upic
.src
= getInitParam("sign_progress");
340 } else if (cached_article
&& article_is_unread
) {
342 query
= query
+ "&mode=prefetch";
344 render_article(cached_article
);
346 } else if (cached_article
) {
348 query
= query
+ "&mode=prefetch_old";
349 render_article(cached_article
);
355 last_requested_article
= id
;
359 new Ajax
.Request("backend.php", {
361 onComplete: function(transport
) {
362 article_callback2(transport
, id
);
368 exception_error("view", e
);
373 return toggleMark(id
);
377 return togglePub(id
);
380 function toggleMark(id
, client_only
) {
382 var query
= "?op=rpc&id=" + id
+ "&subop=mark";
384 var img
= $("FMPIC-" + id
);
388 if (img
.src
.match("mark_unset")) {
389 img
.src
= img
.src
.replace("mark_unset", "mark_set");
390 img
.alt
= __("Unstar article");
391 query
= query
+ "&mark=1";
394 img
.src
= img
.src
.replace("mark_set", "mark_unset");
395 img
.alt
= __("Star article");
396 query
= query
+ "&mark=0";
400 new Ajax
.Request("backend.php", {
402 onComplete: function(transport
) {
403 handle_rpc_json(transport
);
408 exception_error("toggleMark", e
);
412 function togglePub(id
, client_only
, no_effects
, note
) {
414 var query
= "?op=rpc&id=" + id
+ "&subop=publ";
416 if (note
!= undefined) {
417 query
= query
+ "¬e=" + param_escape(note
);
419 query
= query
+ "¬e=undefined";
422 var img
= $("FPPIC-" + id
);
426 if (img
.src
.match("pub_unset") || note
!= undefined) {
427 img
.src
= img
.src
.replace("pub_unset", "pub_set");
428 img
.alt
= __("Unpublish article");
429 query
= query
+ "&pub=1";
432 img
.src
= img
.src
.replace("pub_set", "pub_unset");
433 img
.alt
= __("Publish article");
435 query
= query
+ "&pub=0";
439 new Ajax
.Request("backend.php", {
441 onComplete: function(transport
) {
442 handle_rpc_json(transport
);
447 exception_error("togglePub", e
);
451 function moveToPost(mode
) {
455 var rows
= getVisibleArticleIds();
460 if (!$('RROW-' + active_post_id
)) {
461 active_post_id
= false;
464 if (active_post_id
== false) {
465 next_id
= getFirstVisibleHeadlineId();
466 prev_id
= getLastVisibleHeadlineId();
468 for (var i
= 0; i
< rows
.length
; i
++) {
469 if (rows
[i
] == active_post_id
) {
476 if (mode
== "next") {
480 cdmExpandArticle(next_id
);
481 cdmScrollToArticleId(next_id
);
484 correctHeadlinesOffset(next_id
);
485 view(next_id
, getActiveFeedId());
490 if (mode
== "prev") {
493 cdmExpandArticle(prev_id
);
494 cdmScrollToArticleId(prev_id
);
496 correctHeadlinesOffset(prev_id
);
497 view(prev_id
, getActiveFeedId());
503 exception_error("moveToPost", e
);
507 function toggleSelected(id
, force_on
) {
510 var cb
= $("RCHK-" + id
);
511 var row
= $("RROW-" + id
);
514 if (row
.hasClassName('Selected') && !force_on
) {
515 row
.removeClassName('Selected');
516 if (cb
) cb
.checked
= false;
518 row
.addClassName('Selected');
519 if (cb
) cb
.checked
= true;
523 exception_error("toggleSelected", e
);
527 function toggleUnread_afh(effect
) {
530 var elem
= effect
.element
;
531 elem
.style
.backgroundColor
= "";
534 exception_error("toggleUnread_afh", e
);
538 function toggleUnread(id
, cmode
, effect
) {
541 var row
= $("RROW-" + id
);
543 if (cmode
== undefined || cmode
== 2) {
544 if (row
.hasClassName("Unread")) {
545 row
.removeClassName("Unread");
548 new Effect
.Highlight(row
, {duration
: 1, startcolor
: "#fff7d5",
549 afterFinish
: toggleUnread_afh
,
550 queue
: { position
:'end', scope
: 'TMRQ-' + id
, limit
: 1 } } );
554 row
.addClassName("Unread");
557 } else if (cmode
== 0) {
559 row
.removeClassName("Unread");
562 new Effect
.Highlight(row
, {duration
: 1, startcolor
: "#fff7d5",
563 afterFinish
: toggleUnread_afh
,
564 queue
: { position
:'end', scope
: 'TMRQ-' + id
, limit
: 1 } } );
567 } else if (cmode
== 1) {
568 row
.addClassName("Unread");
571 if (cmode
== undefined) cmode
= 2;
573 var query
= "?op=rpc&subop=catchupSelected" +
574 "&cmode=" + param_escape(cmode
) + "&ids=" + param_escape(id
);
576 // notify_progress("Loading, please wait...");
578 new Ajax
.Request("backend.php", {
580 onComplete: function(transport
) {
581 handle_rpc_json(transport
);
587 exception_error("toggleUnread", e
);
591 function selectionRemoveLabel(id
, ids
) {
594 if (!ids
) var ids
= getSelectedArticleIds2();
596 if (ids
.length
== 0) {
597 alert(__("No articles are selected."));
601 // var ok = confirm(__("Remove selected articles from label?"));
605 var query
= "?op=rpc&subop=removeFromLabel&ids=" +
606 param_escape(ids
.toString()) + "&lid=" + param_escape(id
);
610 // notify_progress("Loading, please wait...");
612 cache_invalidate("F:" + (-11 - id
));
614 new Ajax
.Request("backend.php", {
616 onComplete: function(transport
) {
617 handle_rpc_json(transport
);
618 show_labels_in_headlines(transport
);
624 exception_error("selectionAssignLabel", e
);
629 function selectionAssignLabel(id
, ids
) {
632 if (!ids
) ids
= getSelectedArticleIds2();
634 if (ids
.length
== 0) {
635 alert(__("No articles are selected."));
639 // var ok = confirm(__("Assign selected articles to label?"));
643 cache_invalidate("F:" + (-11 - id
));
645 var query
= "?op=rpc&subop=assignToLabel&ids=" +
646 param_escape(ids
.toString()) + "&lid=" + param_escape(id
);
650 // notify_progress("Loading, please wait...");
652 new Ajax
.Request("backend.php", {
654 onComplete: function(transport
) {
655 handle_rpc_json(transport
);
656 show_labels_in_headlines(transport
);
662 exception_error("selectionAssignLabel", e
);
667 function selectionToggleUnread(set_state
, callback
, no_error
) {
669 var rows
= getSelectedArticleIds2();
671 if (rows
.length
== 0 && !no_error
) {
672 alert(__("No articles are selected."));
676 for (i
= 0; i
< rows
.length
; i
++) {
677 var row
= $("RROW-" + rows
[i
]);
679 if (set_state
== undefined) {
680 if (row
.hasClassName("Unread")) {
681 row
.removeClassName("Unread");
683 row
.addClassName("Unread");
687 if (set_state
== false) {
688 row
.removeClassName("Unread");
691 if (set_state
== true) {
692 row
.addClassName("Unread");
697 if (rows
.length
> 0) {
701 if (set_state
== undefined) {
703 } else if (set_state
== true) {
705 } else if (set_state
== false) {
709 var query
= "?op=rpc&subop=catchupSelected" +
710 "&cmode=" + cmode
+ "&ids=" + param_escape(rows
.toString());
712 notify_progress("Loading, please wait...");
714 new Ajax
.Request("backend.php", {
716 onComplete: function(transport
) {
717 handle_rpc_json(transport
);
718 if (callback
) callback(transport
);
724 exception_error("selectionToggleUnread", e
);
728 function selectionToggleMarked() {
731 var rows
= getSelectedArticleIds2();
733 if (rows
.length
== 0) {
734 alert(__("No articles are selected."));
738 for (i
= 0; i
< rows
.length
; i
++) {
739 toggleMark(rows
[i
], true, true);
742 if (rows
.length
> 0) {
744 var query
= "?op=rpc&subop=markSelected&ids=" +
745 param_escape(rows
.toString()) + "&cmode=2";
747 new Ajax
.Request("backend.php", {
749 onComplete: function(transport
) {
750 handle_rpc_json(transport
);
756 exception_error("selectionToggleMarked", e
);
760 function selectionTogglePublished() {
763 var rows
= getSelectedArticleIds2();
765 if (rows
.length
== 0) {
766 alert(__("No articles are selected."));
770 for (i
= 0; i
< rows
.length
; i
++) {
771 togglePub(rows
[i
], true, true);
774 if (rows
.length
> 0) {
776 var query
= "?op=rpc&subop=publishSelected&ids=" +
777 param_escape(rows
.toString()) + "&cmode=2";
779 new Ajax
.Request("backend.php", {
781 onComplete: function(transport
) {
782 handle_rpc_json(transport
);
788 exception_error("selectionToggleMarked", e
);
792 function getSelectedArticleIds2() {
796 $$("#headlines-frame > div[id*=RROW][class*=Selected]").each(
798 rv
.push(child
.id
.replace("RROW-", ""));
804 function getLoadedArticleIds() {
807 var children
= $$("#headlines-frame > div[id*=RROW-]");
809 children
.each(function(child
) {
810 rv
.push(child
.id
.replace("RROW-", ""));
817 // mode = all,none,unread,invert
818 function selectArticles(mode
) {
821 var children
= $$("#headlines-frame > div[id*=RROW]");
823 children
.each(function(child
) {
824 var id
= child
.id
.replace("RROW-", "");
825 var cb
= $("RCHK-" + id
);
828 child
.addClassName("Selected");
830 } else if (mode
== "unread") {
831 if (child
.hasClassName("Unread")) {
832 child
.addClassName("Selected");
835 child
.removeClassName("Selected");
838 } else if (mode
== "invert") {
839 if (child
.hasClassName("Selected")) {
840 child
.removeClassName("Selected");
843 child
.addClassName("Selected");
848 child
.removeClassName("Selected");
854 exception_error("selectArticles", e
);
858 function catchupPage() {
860 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
862 var str
= __("Mark all visible articles in %s as read?");
864 str
= str
.replace("%s", fn
);
866 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
870 selectArticles('all');
871 selectionToggleUnread(false, 'viewCurrentFeed()', true)
872 selectArticles('none');
875 function deleteSelection() {
879 var rows
= getSelectedArticleIds2();
881 if (rows
.length
== 0) {
882 alert(__("No articles are selected."));
886 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
890 if (getActiveFeedId() != 0) {
891 str
= __("Delete %d selected articles in %s?");
893 str
= __("Delete %d selected articles?");
896 str
= str
.replace("%d", rows
.length
);
897 str
= str
.replace("%s", fn
);
899 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
903 query
= "?op=rpc&subop=delete&ids=" + param_escape(rows
);
907 new Ajax
.Request("backend.php", {
909 onComplete: function(transport
) {
910 handle_rpc_json(transport
);
915 exception_error("deleteSelection", e
);
919 function archiveSelection() {
923 var rows
= getSelectedArticleIds2();
925 if (rows
.length
== 0) {
926 alert(__("No articles are selected."));
930 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
934 if (getActiveFeedId() != 0) {
935 str
= __("Archive %d selected articles in %s?");
938 str
= __("Move %d archived articles back?");
942 str
= str
.replace("%d", rows
.length
);
943 str
= str
.replace("%s", fn
);
945 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
949 query
= "?op=rpc&subop="+op
+"&ids=" + param_escape(rows
);
953 for (var i
= 0; i
< rows
.length
; i
++) {
954 cache_invalidate(rows
[i
]);
957 new Ajax
.Request("backend.php", {
959 onComplete: function(transport
) {
960 handle_rpc_json(transport
);
965 exception_error("archiveSelection", e
);
969 function catchupSelection() {
973 var rows
= getSelectedArticleIds2();
975 if (rows
.length
== 0) {
976 alert(__("No articles are selected."));
980 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
982 var str
= __("Mark %d selected articles in %s as read?");
984 str
= str
.replace("%d", rows
.length
);
985 str
= str
.replace("%s", fn
);
987 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
991 selectionToggleUnread(false, 'viewCurrentFeed()', true)
994 exception_error("catchupSelection", e
);
998 function editArticleTags(id
) {
999 var query
= "backend.php?op=dlg&id=editArticleTags¶m=" + param_escape(id
);
1001 if (dijit
.byId("editTagsDlg"))
1002 dijit
.byId("editTagsDlg").destroyRecursive();
1004 dialog
= new dijit
.Dialog({
1006 title
: __("Edit article Tags"),
1007 style
: "width: 600px",
1008 execute: function() {
1009 if (this.validate()) {
1010 var query
= dojo
.objectToQuery(this.attr('value'));
1012 notify_progress("Saving article tags...", true);
1014 new Ajax
.Request("backend.php", {
1016 onComplete: function(transport
) {
1020 var data
= JSON
.parse(transport
.responseText
);
1023 var tags_str
= data
.tags_str
;
1024 var id
= tags_str
.id
;
1026 var tags
= $("ATSTR-" + id
);
1027 var tooltip
= dijit
.byId("ATSTRTIP-" + id
);
1029 if (tags
) tags
.innerHTML
= tags_str
.content
;
1030 if (tooltip
) tooltip
.attr('label', tags_str
.content_full
);
1032 cache_invalidate(id
);
1041 var tmph
= dojo
.connect(dialog
, 'onLoad', function() {
1042 dojo
.disconnect(tmph
);
1044 new Ajax
.Autocompleter('tags_str', 'tags_choices',
1045 "backend.php?op=rpc&subop=completeTags",
1046 { tokens
: ',', paramName
: "search" });
1053 function cdmScrollToArticleId(id
) {
1055 var ctr
= $("headlines-frame");
1056 var e
= $("RROW-" + id
);
1058 if (!e
|| !ctr
) return;
1060 ctr
.scrollTop
= e
.offsetTop
;
1063 exception_error("cdmScrollToArticleId", e
);
1067 function cache_inject(id
, article
, param
) {
1070 if (!cache_check_param(id
, param
)) {
1071 //console.log("cache_article: miss: " + id + " [p=" + param + "]");
1073 var date
= new Date();
1074 var ts
= Math
.round(date
.getTime() / 1000);
1078 cache_obj
["id"] = id
;
1079 cache_obj
["data"] = article
;
1080 cache_obj
["param"] = param
;
1082 if (param
) id
= id
+ ":" + param
;
1084 cache_added
["TS:" + id
] = ts
;
1086 if (has_local_storage())
1087 sessionStorage
.setItem(id
, JSON
.stringify(cache_obj
));
1089 article_cache
.push(cache_obj
);
1092 //console.log("cache_article: hit: " + id + " [p=" + param + "]");
1095 exception_error("cache_inject", e
);
1099 function cache_find(id
) {
1101 if (has_local_storage()) {
1102 var cache_obj
= sessionStorage
.getItem(id
);
1105 cache_obj
= JSON
.parse(cache_obj
);
1108 return cache_obj
['data'];
1112 for (var i
= 0; i
< article_cache
.length
; i
++) {
1113 if (article_cache
[i
]["id"] == id
) {
1114 return article_cache
[i
]["data"];
1121 function cache_find_param(id
, param
) {
1123 if (has_local_storage()) {
1125 if (param
) id
= id
+ ":" + param
;
1127 var cache_obj
= sessionStorage
.getItem(id
);
1130 cache_obj
= JSON
.parse(cache_obj
);
1133 return cache_obj
['data'];
1137 for (var i
= 0; i
< article_cache
.length
; i
++) {
1138 if (article_cache
[i
]["id"] == id
&& article_cache
[i
]["param"] == param
) {
1139 return article_cache
[i
]["data"];
1147 function cache_check(id
) {
1148 if (has_local_storage()) {
1149 if (sessionStorage
.getItem(id
))
1152 for (var i
= 0; i
< article_cache
.length
; i
++) {
1153 if (article_cache
[i
]["id"] == id
) {
1161 function cache_check_param(id
, param
) {
1162 if (has_local_storage()) {
1164 if (param
) id
= id
+ ":" + param
;
1166 if (sessionStorage
.getItem(id
))
1170 for (var i
= 0; i
< article_cache
.length
; i
++) {
1171 if (article_cache
[i
]["id"] == id
&& article_cache
[i
]["param"] == param
) {
1179 function cache_expire() {
1180 if (has_local_storage()) {
1182 var date
= new Date();
1183 var timestamp
= Math
.round(date
.getTime() / 1000);
1185 for (var i
= 0; i
< sessionStorage
.length
; i
++) {
1187 var id
= sessionStorage
.key(i
);
1189 if (timestamp
- cache_added
["TS:" + id
] > 180) {
1190 sessionStorage
.removeItem(id
);
1195 while (article_cache
.length
> 25) {
1196 article_cache
.shift();
1201 function cache_flush() {
1202 if (has_local_storage()) {
1203 sessionStorage
.clear();
1205 article_cache
= new Array();
1209 function cache_invalidate(id
) {
1211 if (has_local_storage()) {
1215 for (var i
= 0; i
< sessionStorage
.length
; i
++) {
1216 var key
= sessionStorage
.key(i
);
1218 // console.warn("cache_invalidate: " + key_id + " cmp " + id);
1220 if (key
== id
|| key
.indexOf(id
+ ":") == 0) {
1221 sessionStorage
.removeItem(key
);
1232 while (i
< article_cache
.length
) {
1233 if (article_cache
[i
]["id"] == id
) {
1234 //console.log("cache_invalidate: removed id " + id);
1235 article_cache
.splice(i
, 1);
1242 //console.log("cache_invalidate: id not found: " + id);
1245 exception_error("cache_invalidate", e
);
1249 function getActiveArticleId() {
1250 return active_post_id
;
1253 function preloadBatchedArticles() {
1256 var query
= "?op=rpc&subop=getArticles&ids=" +
1257 preload_id_batch
.toString();
1259 new Ajax
.Request("backend.php", {
1261 onComplete: function(transport
) {
1263 preload_id_batch
= [];
1265 var articles
= JSON
.parse(transport
.responseText
);
1267 for (var i
= 0; i
< articles
.length
; i
++) {
1268 var id
= articles
[i
]['id'];
1269 if (!cache_check(id
)) {
1270 cache_inject(id
, articles
[i
]['content']);
1271 console
.log("preloaded article: " + id
);
1277 exception_error("preloadBatchedArticles", e
);
1281 function preloadArticleUnderPointer(id
) {
1283 if (getInitParam("bw_limit") == "1") return;
1285 if (post_under_pointer
== id
&& !cache_check(id
)) {
1287 console
.log("trying to preload article " + id
);
1289 var neighbor_ids
= getRelativePostIds(id
, 1);
1291 /* only request uncached articles */
1293 if (preload_id_batch
.indexOf(id
) == -1) {
1294 for (var i
= 0; i
< neighbor_ids
.length
; i
++) {
1295 if (!cache_check(neighbor_ids
[i
])) {
1296 preload_id_batch
.push(neighbor_ids
[i
]);
1301 if (preload_id_batch
.indexOf(id
) == -1)
1302 preload_id_batch
.push(id
);
1304 //console.log("preload ids batch: " + preload_id_batch.toString());
1306 window
.clearTimeout(preload_timeout_id
);
1307 preload_batch_timeout_id
= window
.setTimeout('preloadBatchedArticles()', 1000);
1311 exception_error("preloadArticleUnderPointer", e
);
1315 function postMouseIn(id
) {
1317 if (post_under_pointer
!= id
) {
1318 post_under_pointer
= id
;
1320 window
.setTimeout("preloadArticleUnderPointer(" + id
+ ")", 250);
1325 exception_error("postMouseIn", e
);
1329 function postMouseOut(id
) {
1331 post_under_pointer
= false;
1333 exception_error("postMouseOut", e
);
1337 function headlines_scroll_handler(e
) {
1339 var hsp
= $("headlines-spacer");
1341 if (!_infscroll_disable
) {
1342 if (hsp
&& (e
.scrollTop
+ e
.offsetHeight
> hsp
.offsetTop
) ||
1343 e
.scrollTop
+ e
.offsetHeight
> e
.scrollHeight
- 100) {
1348 if (hsp
) hsp
.innerHTML
= "";
1351 if (getInitParam("cdm_auto_catchup") == 1) {
1355 $$("#headlines-frame > div[id*=RROW][class*=Unread]").each(
1357 if ($("headlines-frame").scrollTop
>
1358 (child
.offsetTop
+ child
.offsetHeight
/2)) {
1360 ids
.push(child
.id
.replace("RROW-", ""));
1364 if (ids
.length
> 0) {
1366 var query
= "?op=rpc&subop=catchupSelected" +
1367 "&cmode=0&ids=" + param_escape(ids
.toString());
1369 new Ajax
.Request("backend.php", {
1371 onComplete: function(transport
) {
1372 handle_rpc_json(transport
);
1374 ids
.each(function(id
) {
1375 var elem
= $("RROW-" + id
);
1376 if (elem
) elem
.removeClassName("Unread");
1382 exception_error("headlines_scroll_handler", e
);
1386 function catchupRelativeToArticle(below
) {
1391 if (!getActiveArticleId()) {
1392 alert(__("No article is selected."));
1396 var visible_ids
= getVisibleArticleIds();
1398 var ids_to_mark
= new Array();
1401 for (var i
= 0; i
< visible_ids
.length
; i
++) {
1402 if (visible_ids
[i
] != getActiveArticleId()) {
1403 var e
= $("RROW-" + visible_ids
[i
]);
1405 if (e
&& e
.hasClassName("Unread")) {
1406 ids_to_mark
.push(visible_ids
[i
]);
1413 for (var i
= visible_ids
.length
-1; i
>= 0; i
--) {
1414 if (visible_ids
[i
] != getActiveArticleId()) {
1415 var e
= $("RROW-" + visible_ids
[i
]);
1417 if (e
&& e
.hasClassName("Unread")) {
1418 ids_to_mark
.push(visible_ids
[i
]);
1426 if (ids_to_mark
.length
== 0) {
1427 alert(__("No articles found to mark"));
1429 var msg
= __("Mark %d article(s) as read?").replace("%d", ids_to_mark
.length
);
1431 if (getInitParam("confirm_feed_catchup") != 1 || confirm(msg
)) {
1433 for (var i
= 0; i
< ids_to_mark
.length
; i
++) {
1434 var e
= $("RROW-" + ids_to_mark
[i
]);
1435 e
.removeClassName("Unread");
1438 var query
= "?op=rpc&subop=catchupSelected" +
1439 "&cmode=0" + "&ids=" + param_escape(ids_to_mark
.toString());
1441 new Ajax
.Request("backend.php", {
1443 onComplete: function(transport
) {
1444 handle_rpc_json(transport
);
1451 exception_error("catchupRelativeToArticle", e
);
1455 function cdmExpandArticle(id
) {
1460 var elem
= $("CICD-" + active_post_id
);
1462 var upd_img_pic
= $("FUPDPIC-" + id
);
1464 if (upd_img_pic
&& (upd_img_pic
.src
.match("updated.png") ||
1465 upd_img_pic
.src
.match("fresh_sign.png"))) {
1467 upd_img_pic
.src
= "images/blank_icon.gif";
1470 if (id
== active_post_id
&& Element
.visible(elem
))
1473 selectArticles("none");
1475 var old_offset
= $("RROW-" + id
).offsetTop
;
1477 if (active_post_id
&& elem
&& !getInitParam("cdm_expanded")) {
1479 Element
.show("CEXC-" + active_post_id
);
1482 active_post_id
= id
;
1484 elem
= $("CICD-" + id
);
1486 if (!Element
.visible(elem
)) {
1488 Element
.hide("CEXC-" + id
);
1490 if ($("CWRAP-" + id
).innerHTML
== "") {
1492 $("FUPDPIC-" + id
).src
= "images/indicator_tiny.gif";
1494 $("CWRAP-" + id
).innerHTML
= "<div class=\"insensitive\">" +
1495 __("Loading, please wait...") + "</div>";
1497 var query
= "?op=rpc&subop=cdmGetArticle&id=" + param_escape(id
);
1499 //console.log(query);
1501 new Ajax
.Request("backend.php", {
1503 onComplete: function(transport
) {
1504 $("FUPDPIC-" + id
).src
= 'images/blank_icon.gif';
1506 handle_rpc_json(transport
);
1508 var reply
= JSON
.parse(transport
.responseText
);
1511 var article
= reply
['article']['content'];
1512 var recv_id
= reply
['article']['id'];
1515 $("CWRAP-" + id
).innerHTML
= article
;
1518 $("CWRAP-" + id
).innerHTML
= __("Unable to load article.");
1526 var new_offset
= $("RROW-" + id
).offsetTop
;
1528 $("headlines-frame").scrollTop
+= (new_offset
-old_offset
);
1530 if ($("RROW-" + id
).offsetTop
!= old_offset
)
1531 $("headlines-frame").scrollTop
= new_offset
;
1533 toggleUnread(id
, 0, true);
1537 exception_error("cdmExpandArticle", e
);
1543 function fixHeadlinesOrder(ids
) {
1545 for (var i
= 0; i
< ids
.length
; i
++) {
1546 var e
= $("RROW-" + ids
[i
]);
1550 e
.removeClassName("even");
1551 e
.addClassName("odd");
1553 e
.removeClassName("odd");
1554 e
.addClassName("even");
1559 exception_error("fixHeadlinesOrder", e
);
1563 function getArticleUnderPointer() {
1564 return post_under_pointer
;
1567 function zoomToArticle(event
, id
) {
1569 var cached_article
= cache_find(id
);
1571 if (dijit
.byId("ATAB-" + id
))
1572 if (!event
|| !event
.shiftKey
)
1573 return dijit
.byId("content-tabs").selectChild(dijit
.byId("ATAB-" + id
));
1575 if (dijit
.byId("ATSTRTIP-" + id
))
1576 dijit
.byId("ATSTRTIP-" + id
).destroyRecursive();
1578 if (cached_article
) {
1579 //closeArticlePanel();
1581 var article_pane
= new dijit
.layout
.ContentPane({
1582 title
: __("Loading...") , content
: cached_article
,
1583 style
: 'padding : 0px;',
1587 dijit
.byId("content-tabs").addChild(article_pane
);
1589 if (!event
|| !event
.shiftKey
)
1590 dijit
.byId("content-tabs").selectChild(article_pane
);
1592 if ($("PTITLE-" + id
))
1593 article_pane
.attr('title', $("PTITLE-" + id
).innerHTML
);
1597 var query
= "?op=rpc&subop=getArticles&ids=" + param_escape(id
);
1599 notify_progress("Loading, please wait...", true);
1601 new Ajax
.Request("backend.php", {
1603 onComplete: function(transport
) {
1606 var reply
= JSON
.parse(transport
.responseText
);
1609 //closeArticlePanel();
1611 var content
= reply
[0]['content'];
1613 var article_pane
= new dijit
.layout
.ContentPane({
1614 title
: "article-" + id
, content
: content
,
1615 style
: 'padding : 0px;',
1619 dijit
.byId("content-tabs").addChild(article_pane
);
1621 if (!event
|| !event
.shiftKey
)
1622 dijit
.byId("content-tabs").selectChild(article_pane
);
1624 if ($("PTITLE-" + id
))
1625 article_pane
.attr('title', $("PTITLE-" + id
).innerHTML
);
1632 exception_error("zoomToArticle", e
);
1636 function scrollArticle(offset
) {
1639 var ci
= $("content-insert");
1641 ci
.scrollTop
+= offset
;
1644 var hi
= $("headlines-frame");
1646 hi
.scrollTop
+= offset
;
1651 exception_error("scrollArticle", e
);
1655 function show_labels_in_headlines(transport
) {
1657 var data
= JSON
.parse(transport
.responseText
);
1660 data
['info-for-headlines'].each(function(elem
) {
1661 var ctr
= $("HLLCTR-" + elem
.id
);
1663 if (ctr
) ctr
.innerHTML
= elem
.labels
;
1667 exception_error("show_labels_in_headlines", e
);
1671 function toggleHeadlineActions() {
1673 var e
= $("headlineActionsBody");
1674 var p
= $("headlineActionsDrop");
1676 if (!Element
.visible(e
)) {
1683 e
.style
.left
= (p
.offsetLeft
+ 1) + "px";
1684 e
.style
.top
= (p
.offsetTop
+ p
.offsetHeight
+ 2) + "px";
1687 exception_error("toggleHeadlineActions", e
);
1691 /* function publishWithNote(id, def_note) {
1693 if (!def_note) def_note = '';
1695 var note = prompt(__("Please enter a note for this article:"), def_note);
1697 if (note != undefined) {
1698 togglePub(id, false, false, note);
1702 exception_error("publishWithNote", e);
1706 function emailArticle(id
) {
1709 var ids
= getSelectedArticleIds2();
1711 if (ids
.length
== 0) {
1712 alert(__("No articles are selected."));
1716 id
= ids
.toString();
1719 if (dijit
.byId("emailArticleDlg"))
1720 dijit
.byId("emailArticleDlg").destroyRecursive();
1722 var query
= "backend.php?op=dlg&id=emailArticle¶m=" + param_escape(id
);
1724 dialog
= new dijit
.Dialog({
1725 id
: "emailArticleDlg",
1726 title
: __("Forward article by email"),
1727 style
: "width: 600px",
1728 execute: function() {
1729 if (this.validate()) {
1731 new Ajax
.Request("backend.php", {
1732 parameters
: dojo
.objectToQuery(this.attr('value')),
1733 onComplete: function(transport
) {
1735 var reply
= JSON
.parse(transport
.responseText
);
1737 var error
= reply
['error'];
1740 alert(__('Error sending email:') + ' ' + error
);
1742 notify_info('Your message has been sent.');
1751 var tmph
= dojo
.connect(dialog
, 'onLoad', function() {
1752 dojo
.disconnect(tmph
);
1754 new Ajax
.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices',
1755 "backend.php?op=rpc&subop=completeEmails",
1756 { tokens
: '', paramName
: "search" });
1761 /* displayDlg('emailArticle', id,
1763 document.forms['article_email_form'].destination.focus();
1765 new Ajax.Autocompleter('destination', 'destination_choices',
1766 "backend.php?op=rpc&subop=completeEmails",
1767 { tokens: '', paramName: "search" });
1772 exception_error("emailArticle", e
);
1776 function dismissArticle(id
) {
1778 var elem
= $("RROW-" + id
);
1780 toggleUnread(id
, 0, true);
1782 new Effect
.Fade(elem
, {duration
: 0.5});
1784 active_post_id
= false;
1787 exception_error("dismissArticle", e
);
1791 function dismissSelectedArticles() {
1794 var ids
= getVisibleArticleIds();
1798 for (var i
= 0; i
< ids
.length
; i
++) {
1799 var elem
= $("RROW-" + ids
[i
]);
1801 if (elem
.className
&& elem
.hasClassName("Selected") &&
1802 ids
[i
] != active_post_id
) {
1803 new Effect
.Fade(elem
, {duration
: 0.5});
1811 selectionToggleUnread(false);
1813 fixHeadlinesOrder(tmp
);
1816 exception_error("dismissSelectedArticles", e
);
1820 function dismissReadArticles() {
1823 var ids
= getVisibleArticleIds();
1826 for (var i
= 0; i
< ids
.length
; i
++) {
1827 var elem
= $("RROW-" + ids
[i
]);
1829 if (elem
.className
&& !elem
.hasClassName("Unread") &&
1830 !elem
.hasClassName("Selected")) {
1832 new Effect
.Fade(elem
, {duration
: 0.5});
1838 fixHeadlinesOrder(tmp
);
1841 exception_error("dismissSelectedArticles", e
);
1845 function getVisibleArticleIds() {
1850 getLoadedArticleIds().each(function(id
) {
1851 var elem
= $("RROW-" + id
);
1852 if (elem
&& Element
.visible(elem
))
1857 exception_error("getVisibleArticleIds", e
);
1863 function cdmClicked(event
, id
) {
1865 var shift_key
= event
.shiftKey
;
1869 if (!event
.ctrlKey
) {
1871 if (!getInitParam("cdm_expanded")) {
1872 return cdmExpandArticle(id
);
1875 selectArticles("none");
1878 var elem
= $("RROW-" + id
);
1881 elem
.removeClassName("Unread");
1883 var upd_img_pic
= $("FUPDPIC-" + id
);
1885 if (upd_img_pic
&& (upd_img_pic
.src
.match("updated.png") ||
1886 upd_img_pic
.src
.match("fresh_sign.png"))) {
1888 upd_img_pic
.src
= "images/blank_icon.gif";
1891 active_post_id
= id
;
1893 var query
= "?op=rpc&subop=catchupSelected" +
1894 "&cmode=0&ids=" + param_escape(id
);
1896 new Ajax
.Request("backend.php", {
1898 onComplete: function(transport
) {
1899 handle_rpc_json(transport
);
1906 toggleSelected(id
, true);
1907 toggleUnread(id
, 0, false);
1908 zoomToArticle(event
, id
);
1912 exception_error("cdmClicked");
1918 function postClicked(event
, id
) {
1921 if (!event
.ctrlKey
) {
1924 postOpenInNewTab(event
, id
);
1929 exception_error("postClicked");
1933 function hlOpenInNewTab(event
, id
) {
1934 toggleUnread(id
, 0, false);
1935 zoomToArticle(event
, id
);
1938 function postOpenInNewTab(event
, id
) {
1939 closeArticlePanel(id
);
1940 zoomToArticle(event
, id
);
1943 function hlClicked(event
, id
) {
1945 if (event
.which
== 2) {
1948 } else if (event
.altKey
) {
1949 openArticleInNewWindow(id
);
1950 } else if (!event
.ctrlKey
) {
1955 toggleUnread(id
, 0, false);
1956 zoomToArticle(event
, id
);
1961 exception_error("hlClicked");
1965 function getFirstVisibleHeadlineId() {
1966 var rows
= getVisibleArticleIds();
1971 function getLastVisibleHeadlineId() {
1972 var rows
= getVisibleArticleIds();
1973 return rows
[rows
.length
-1];
1976 function openArticleInNewWindow(id
) {
1977 toggleUnread(id
, 0, false);
1978 window
.open("backend.php?op=la&id=" + id
);
1981 function isCdmMode() {
1982 return getInitParam("combined_display_mode");
1985 function markHeadline(id
) {
1986 var row
= $("RROW-" + id
);
1988 var check
= $("RCHK-" + id
);
1991 check
.checked
= true;
1994 row
.addClassName("Selected");
1998 function getRelativePostIds(id
, limit
) {
2004 if (!limit
) limit
= 3;
2006 var ids
= getVisibleArticleIds();
2008 for (var i
= 0; i
< ids
.length
; i
++) {
2010 for (var k
= 1; k
<= limit
; k
++) {
2011 if (i
> k
-1) tmp
.push(ids
[i
-k
]);
2012 if (i
< ids
.length
-k
) tmp
.push(ids
[i
+k
]);
2019 exception_error("getRelativePostIds", e
);
2025 function correctHeadlinesOffset(id
) {
2029 var container
= $("headlines-frame");
2030 var row
= $("RROW-" + id
);
2032 var viewport
= container
.offsetHeight
;
2034 var rel_offset_top
= row
.offsetTop
- container
.scrollTop
;
2035 var rel_offset_bottom
= row
.offsetTop
+ row
.offsetHeight
- container
.scrollTop
;
2037 //console.log("Rtop: " + rel_offset_top + " Rbtm: " + rel_offset_bottom);
2038 //console.log("Vport: " + viewport);
2040 if (rel_offset_top
<= 0 || rel_offset_top
> viewport
) {
2041 container
.scrollTop
= row
.offsetTop
;
2042 } else if (rel_offset_bottom
> viewport
) {
2044 /* doesn't properly work with Opera in some cases because
2045 Opera fucks up element scrolling */
2047 container
.scrollTop
= row
.offsetTop
+ row
.offsetHeight
- viewport
;
2051 exception_error("correctHeadlinesOffset", e
);
2056 function headlineActionsChange(elem
) {
2059 elem
.attr('value', 'false');
2061 exception_error("headlineActionsChange", e
);
2065 function closeArticlePanel() {
2067 var tabs
= dijit
.byId("content-tabs");
2068 var child
= tabs
.selectedChildWidget
;
2070 if (child
&& tabs
.getIndexOfChild(child
) > 0) {
2071 tabs
.removeChild(child
);
2074 if (dijit
.byId("content-insert"))
2075 dijit
.byId("headlines-wrap-inner").removeChild(
2076 dijit
.byId("content-insert"));
2080 function initHeadlinesMenu() {
2082 if (dijit
.byId("headlinesMenu"))
2083 dijit
.byId("headlinesMenu").destroyRecursive();
2088 nodes
= $$("#headlines-frame > div[id*=RROW]");
2090 nodes
= $$("#headlines-frame span[id*=RTITLE]");
2093 nodes
.each(function(node
) {
2097 var menu
= new dijit
.Menu({
2098 id
: "headlinesMenu",
2102 var tmph
= dojo
.connect(menu
, '_openMyself', function (event
) {
2103 var callerNode
= event
.target
, match
= null, tries
= 0;
2105 while (match
== null && callerNode
&& tries
<= 3) {
2106 match
= callerNode
.id
.match("^[A-Z]+[-]([0-9]+)$");
2107 callerNode
= callerNode
.parentNode
;
2111 if (match
) this.callerRowId
= parseInt(match
[1]);
2115 /* if (!isCdmMode())
2116 menu.addChild(new dijit.MenuItem({
2117 label: __("View article"),
2118 onClick: function(event) {
2119 view(this.getParent().callerRowId);
2122 menu
.addChild(new dijit
.MenuItem({
2123 label
: __("Open original article"),
2124 onClick: function(event
) {
2125 openArticleInNewWindow(this.getParent().callerRowId
);
2128 menu
.addChild(new dijit
.MenuItem({
2129 label
: __("View in a tt-rss tab"),
2130 onClick: function(event
) {
2131 hlOpenInNewTab(event
, this.getParent().callerRowId
);
2134 // menu.addChild(new dijit.MenuSeparator());
2136 var labels
= dijit
.byId("feedTree").model
.getItemsInCategory(-2);
2140 menu
.addChild(new dijit
.MenuSeparator());
2142 var labelAddMenu
= new dijit
.Menu({ownerMenu
: menu
});
2143 var labelDelMenu
= new dijit
.Menu({ownerMenu
: menu
});
2145 labels
.each(function(label
) {
2146 var id
= label
.id
[0];
2147 var bare_id
= id
.substr(id
.indexOf(":")+1);
2148 var name
= label
.name
[0];
2150 bare_id
= -11-bare_id
;
2152 labelAddMenu
.addChild(new dijit
.MenuItem({
2155 onClick: function(event
) {
2156 selectionAssignLabel(this.labelId
,
2157 [this.getParent().ownerMenu
.callerRowId
]);
2160 labelDelMenu
.addChild(new dijit
.MenuItem({
2163 onClick: function(event
) {
2164 selectionRemoveLabel(this.labelId
,
2165 [this.getParent().ownerMenu
.callerRowId
]);
2170 menu
.addChild(new dijit
.PopupMenuItem({
2171 label
: __("Assign label"),
2172 popup
: labelAddMenu
,
2175 menu
.addChild(new dijit
.PopupMenuItem({
2176 label
: __("Remove label"),
2177 popup
: labelDelMenu
,
2185 exception_error("initHeadlinesMenu", e
);
2189 function tweetArticle(id
) {
2191 var query
= "?op=rpc&subop=getTweetInfo&id=" + param_escape(id
);
2196 var ts
= d
.getTime();
2198 var w
= window
.open('backend.php?op=loading', 'ttrss_tweet',
2199 "status=0,toolbar=0,location=0,width=500,height=400,scrollbars=1,menubar=0");
2201 new Ajax
.Request("backend.php", {
2203 onComplete: function(transport
) {
2204 var ti
= JSON
.parse(transport
.responseText
);
2206 var share_url
= "http://twitter.com/share?_=" + ts
+
2207 "&text=" + param_escape(ti
.title
) +
2208 "&url=" + param_escape(ti
.link
);
2210 w
.location
.href
= share_url
;
2216 exception_error("tweetArticle", e
);
2220 function editArticleNote(id
) {
2223 var query
= "backend.php?op=dlg&id=editArticleNote¶m=" + param_escape(id
);
2225 if (dijit
.byId("editNoteDlg"))
2226 dijit
.byId("editNoteDlg").destroyRecursive();
2228 dialog
= new dijit
.Dialog({
2230 title
: __("Edit article note"),
2231 style
: "width: 600px",
2232 execute: function() {
2233 if (this.validate()) {
2234 var query
= dojo
.objectToQuery(this.attr('value'));
2236 notify_progress("Saving article note...", true);
2238 new Ajax
.Request("backend.php", {
2240 onComplete: function(transport
) {
2244 var reply
= JSON
.parse(transport
.responseText
);
2246 cache_invalidate(id
);
2248 var elem
= $("POSTNOTE-" + id
);
2252 elem
.innerHTML
= reply
.note
;
2254 if (reply
.raw_length
!= 0)
2255 new Effect
.Appear(elem
);
2267 exception_error("editArticleNote", e
);
2271 function player(elem
) {
2272 var aid
= elem
.getAttribute("audio-id");
2273 var status
= elem
.getAttribute("status");
2281 elem
.innerHTML
= __("Playing...");
2282 elem
.title
= __("Click to pause");
2283 elem
.addClassName("playing");
2287 elem
.innerHTML
= __("Play");
2288 elem
.title
= __("Click to play");
2289 elem
.removeClassName("playing");
2292 elem
.setAttribute("status", status
);
2294 alert("Your browser doesn't seem to support HTML5 audio.");