]>
git.wh0rd.org - tt-rss.git/blob - functions.js
817946c397737ca2153b90f5cd1b2ce823352258
1 var hotkeys_enabled
= true;
3 function browser_has_opacity() {
4 return navigator
.userAgent
.match("Gecko") != null ||
5 navigator
.userAgent
.match("Opera") != null;
8 function exception_error(location
, e
) {
12 var base_fname
= e
.fileName
.substring(e
.fileName
.lastIndexOf("/") + 1);
14 msg
= "Exception: " + e
.name
+ ", " + e
.message
+
15 "\nFunction: " + location
+ "()" +
16 "\nLocation: " + base_fname
+ ":" + e
.lineNumber
;
18 msg
= "Exception: " + e
+ "\nFunction: " + location
+ "()";
24 function disableHotkeys() {
25 hotkeys_enabled
= false;
28 function enableHotkeys() {
29 hotkeys_enabled
= true;
32 function xmlhttp_ready(obj
) {
33 return obj
.readyState
== 4 || obj
.readyState
== 0 || !obj
.readyState
;
36 function notify_callback() {
37 var container
= document
.getElementById('notify');
38 if (xmlhttp
.readyState
== 4) {
39 container
.innerHTML
=xmlhttp
.responseText
;
43 function rpc_notify_callback() {
44 var container
= document
.getElementById('notify');
45 if (xmlhttp_rpc
.readyState
== 4) {
46 container
.innerHTML
=xmlhttp_rpc
.responseText
;
50 function rpc_pnotify_callback() {
51 var container
= parent
.document
.getElementById('notify');
52 if (xmlhttp_rpc
.readyState
== 4) {
53 container
.innerHTML
=xmlhttp_rpc
.responseText
;
57 function param_escape(arg
) {
58 if (typeof encodeURIComponent
!= 'undefined')
59 return encodeURIComponent(arg
);
64 function param_unescape(arg
) {
65 if (typeof decodeURIComponent
!= 'undefined')
66 return decodeURIComponent(arg
);
73 then
=new Date().getTime();
75 while((now
-then
)<gap
) {
76 now
=new Date().getTime();
80 var notify_hide_timerid
= false;
81 var notify_last_doc
= false;
83 function hide_notify() {
84 if (notify_last_doc
) {
85 var n
= notify_last_doc
.getElementById("notify");
86 if (browser_has_opacity()) {
87 if (notify_opacity
>= 0) {
88 notify_opacity
= notify_opacity
- 0.2;
89 n
.style
.opacity
= notify_opacity
;
90 notify_hide_timerid
= window
.setTimeout("hide_notify()", 20);
92 n
.style
.display
= "none";
96 n
.style
.display
= "none";
101 function notify_real(msg
, doc
, no_hide
, is_err
) {
103 var n
= doc
.getElementById("notify");
104 var nb
= doc
.getElementById("notify_body");
106 if (!n
|| !nb
) return;
109 n
.style
.display
= "none";
111 n
.style
.display
= "block";
115 n
.style
.backgroundColor
= "#ffcccc";
116 n
.style
.color
= "black";
117 n
.style
.borderColor
= "#ff0000";
119 n
.style
.backgroundColor
= "#fff7d5";
120 n
.style
.borderColor
= "#d7c47a";
121 n
.style
.color
= "black";
126 if (notify_hide_timerid
) {
127 window
.clearTimeout(notify_hide_timerid
);
130 notify_last_doc
= doc
;
134 notify_hide_timerid
= window
.setTimeout("hide_notify()", 3000);
138 function p_notify(msg
, no_hide
, is_err
) {
139 notify_real(msg
, parent
.document
, no_hide
, is_err
);
142 function notify(msg
, no_hide
, is_err
) {
143 notify_real(msg
, document
, no_hide
, is_err
);
146 function printLockingError() {
147 notify("Please wait until operation finishes");}
151 function hotkey_handler(e
) {
155 if (!hotkeys_enabled
) return;
158 keycode
= window
.event
.keyCode
;
163 if (keycode
== 13 || keycode
== 27) {
166 seq
= seq
+ "" + keycode
;
169 if (document
.getElementById("piggie")) {
171 if (seq
.match("807371717369")) {
173 localPiggieFunction(true);
175 localPiggieFunction(false);
179 if (typeof localHotkeyHandler
!= 'undefined') {
181 localHotkeyHandler(keycode
);
183 exception_error("hotkey_handler", e
);
189 function cleanSelectedList(element
) {
190 var content
= document
.getElementById(element
);
192 if (!document
.getElementById("feedCatHolder")) {
193 for (i
= 0; i
< content
.childNodes
.length
; i
++) {
194 var child
= content
.childNodes
[i
];
196 child
.className
= child
.className
.replace("Selected", "");
202 for (i
= 0; i
< content
.childNodes
.length
; i
++) {
203 var child
= content
.childNodes
[i
];
204 if (child
.id
== "feedCatHolder") {
205 parent
.debug(child
.id
);
206 var fcat
= child
.lastChild
;
207 for (j
= 0; j
< fcat
.childNodes
.length
; j
++) {
208 var feed
= fcat
.childNodes
[j
];
209 feed
.className
= feed
.className
.replace("Selected", "");
217 function cleanSelected(element
) {
218 var content
= document
.getElementById(element
);
220 for (i
= 0; i
< content
.rows
.length
; i
++) {
221 content
.rows
[i
].className
= content
.rows
[i
].className
.replace("Selected", "");
225 function getVisibleUnreadHeadlines() {
226 var content
= document
.getElementById("headlinesList");
228 var rows
= new Array();
230 for (i
= 0; i
< content
.rows
.length
; i
++) {
231 var row_id
= content
.rows
[i
].id
.replace("RROW-", "");
232 if (row_id
.length
> 0 && content
.rows
[i
].className
.match("Unread")) {
239 function getVisibleHeadlineIds() {
241 var content
= document
.getElementById("headlinesList");
243 var rows
= new Array();
245 for (i
= 0; i
< content
.rows
.length
; i
++) {
246 var row_id
= content
.rows
[i
].id
.replace("RROW-", "");
247 if (row_id
.length
> 0) {
254 function getFirstVisibleHeadlineId() {
255 var rows
= getVisibleHeadlineIds();
259 function getLastVisibleHeadlineId() {
260 var rows
= getVisibleHeadlineIds();
261 return rows
[rows
.length
-1];
264 function markHeadline(id
) {
265 var row
= document
.getElementById("RROW-" + id
);
267 var is_active
= false;
269 if (row
.className
.match("Active")) {
272 row
.className
= row
.className
.replace("Selected", "");
273 row
.className
= row
.className
.replace("Active", "");
274 row
.className
= row
.className
.replace("Insensitive", "");
277 row
.className
= row
.className
= "Active";
280 var check
= document
.getElementById("RCHK-" + id
);
283 check
.checked
= true;
286 row
.className
= row
.className
+ "Selected";
291 function getFeedIds() {
292 var content
= document
.getElementById("feedsList");
294 var rows
= new Array();
296 for (i
= 0; i
< content
.rows
.length
; i
++) {
297 var id
= content
.rows
[i
].id
.replace("FEEDR-", "");
306 function setCookie(name
, value
, lifetime
, path
, domain
, secure
) {
312 d
.setTime(lifetime
* 1000);
315 int_setCookie(name
, value
, d
, path
, domain
, secure
);
319 function int_setCookie(name
, value
, expires
, path
, domain
, secure
) {
320 document
.cookie
= name
+ "=" + escape(value
) +
321 ((expires
) ? "; expires=" + expires
.toGMTString() : "") +
322 ((path
) ? "; path=" + path
: "") +
323 ((domain
) ? "; domain=" + domain
: "") +
324 ((secure
) ? "; secure" : "");
327 function delCookie(name
, path
, domain
) {
328 if (getCookie(name
)) {
329 document
.cookie
= name
+ "=" +
330 ((path
) ? ";path=" + path
: "") +
331 ((domain
) ? ";domain=" + domain
: "" ) +
332 ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
337 function getCookie(name
) {
339 var dc
= document
.cookie
;
340 var prefix
= name
+ "=";
341 var begin
= dc
.indexOf("; " + prefix
);
343 begin
= dc
.indexOf(prefix
);
344 if (begin
!= 0) return null;
349 var end
= document
.cookie
.indexOf(";", begin
);
353 return unescape(dc
.substring(begin
+ prefix
.length
, end
));
356 function disableContainerChildren(id
, disable
, doc
) {
358 if (!doc
) doc
= document
;
360 var container
= doc
.getElementById(id
);
362 for (var i
= 0; i
< container
.childNodes
.length
; i
++) {
363 var child
= container
.childNodes
[i
];
366 child
.disabled
= disable
;
372 if (child
.className
&& child
.className
.match("button")) {
373 child
.className
= "disabledButton";
376 if (child
.className
&& child
.className
.match("disabledButton")) {
377 child
.className
= "button";
384 function gotoPreferences() {
385 document
.location
.href
= "prefs.php";
388 function gotoMain() {
389 document
.location
.href
= "tt-rss.php";
392 function gotoExportOpml() {
393 document
.location
.href
= "opml.php?op=Export";
396 function getActiveFeedId() {
397 return getCookie("ttrss_vf_actfeed");
400 function setActiveFeedId(id
) {
401 return setCookie("ttrss_vf_actfeed", id
);
404 var xmlhttp_rpc
= false;
407 /*@if (@_jscript_version >= 5)
408 // JScript gives us Conditional compilation, we can cope with old IE versions.
409 // and security blocked creation of the objects.
411 xmlhttp_rpc = new ActiveXObject("Msxml2.XMLHTTP");
414 xmlhttp_rpc = new ActiveXObject("Microsoft.XMLHTTP");
421 if (!xmlhttp_rpc
&& typeof XMLHttpRequest
!='undefined') {
422 xmlhttp_rpc
= new XMLHttpRequest();
425 function parse_counters(reply
, f_document
, title_obj
, scheduled_call
) {
427 for (var l
= 0; l
< reply
.childNodes
.length
; l
++) {
428 if (!reply
.childNodes
[l
] ||
429 typeof(reply
.childNodes
[l
].getAttribute
) == "undefined") {
430 // where did this come from?
434 var id
= reply
.childNodes
[l
].getAttribute("id");
435 var t
= reply
.childNodes
[l
].getAttribute("type");
436 var ctr
= reply
.childNodes
[l
].getAttribute("counter");
437 var error
= reply
.childNodes
[l
].getAttribute("error");
438 var has_img
= reply
.childNodes
[l
].getAttribute("hi");
439 var updated
= reply
.childNodes
[l
].getAttribute("updated");
441 if (id
== "global-unread") {
442 title_obj
.global_unread
= ctr
;
443 title_obj
.updateTitle();
447 if (t
== "category") {
448 var catctr
= f_document
.getElementById("FCATCTR-" + id
);
450 catctr
.innerHTML
= "(" + ctr
+ " unread)";
455 var feedctr
= f_document
.getElementById("FEEDCTR-" + id
);
456 var feedu
= f_document
.getElementById("FEEDU-" + id
);
457 var feedr
= f_document
.getElementById("FEEDR-" + id
);
458 var feed_img
= f_document
.getElementById("FIMG-" + id
);
459 var feedlink
= f_document
.getElementById("FEEDL-" + id
);
461 if (updated
&& feedlink
) {
463 feedlink
.title
= "Error: " + error
+ " (" + updated
+ ")";
465 feedlink
.title
= "Updated: " + updated
;
469 if (feedctr
&& feedu
&& feedr
) {
471 if (feedu
.innerHTML
!= ctr
&& id
== getActiveFeedId() && scheduled_call
) {
472 var hf
= title_obj
.parent
.frames
["headlines-frame"];
473 hf
.location
.reload(true);
476 feedu
.innerHTML
= ctr
;
479 feedr
.className
= feedr
.className
.replace("feed", "error");
481 feedr
.className
= feedr
.className
.replace("error", "feed");
485 feedctr
.className
= "odd";
486 if (!feedr
.className
.match("Unread")) {
487 var is_selected
= feedr
.className
.match("Selected");
489 feedr
.className
= feedr
.className
.replace("Selected", "");
490 feedr
.className
= feedr
.className
.replace("Unread", "");
492 feedr
.className
= feedr
.className
+ "Unread";
495 feedr
.className
= feedr
.className
+ "Selected";
500 feedctr
.className
= "invisible";
501 feedr
.className
= feedr
.className
.replace("Unread", "");
506 exception_error("parse_counters", e
);
510 // this one is called from feedlist context
511 // thus title_obj passed to parse_counters is parent (e.g. main ttrss window)
513 function all_counters_callback() {
514 if (xmlhttp_rpc
.readyState
== 4) {
516 if (!xmlhttp_rpc
.responseXML
|| !xmlhttp_rpc
.responseXML
.firstChild
) {
517 notify("[all_counters_callback] backend did not return valid XML");
521 if (!parent
.frames
["feeds-frame"]) {
522 notify("[all_counters_callback] no parent feeds-frame");
526 var reply
= xmlhttp_rpc
.responseXML
.firstChild
;
527 var f_document
= parent
.frames
["feeds-frame"].document
;
529 parse_counters(reply
, f_document
, parent
);
532 exception_error("all_counters_callback", e
);
537 function update_all_counters(feed
) {
538 if (xmlhttp_ready(xmlhttp_rpc
)) {
539 var query
= "backend.php?op=rpc&subop=getAllCounters";
542 query
= query
+ "&aid=" + feed
;
545 xmlhttp_rpc
.open("GET", query
, true);
546 xmlhttp_rpc
.onreadystatechange
=all_counters_callback
;
547 xmlhttp_rpc
.send(null);
551 function popupHelp(tid
) {
552 var w
= window
.open("backend.php?op=help&tid=" + tid
,
554 "menubar=no,location=no,resizable=yes,scrollbars=yes,status=no");
557 /** * @(#)isNumeric.js * * Copyright (c) 2000 by Sundar Dorai-Raj
558 * * @author Sundar Dorai-Raj
559 * * Email: sdoraira@vt.edu
560 * * This program is free software; you can redistribute it and/or
561 * * modify it under the terms of the GNU General Public License
562 * * as published by the Free Software Foundation; either version 2
563 * * of the License, or (at your option) any later version,
564 * * provided that any use properly credits the author.
565 * * This program is distributed in the hope that it will be useful,
566 * * but WITHOUT ANY WARRANTY; without even the implied warranty of
567 * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
568 * * GNU General Public License for more details at http://www.gnu.org * * */
570 var numbers
=".0123456789";
571 function isNumeric(x
) {
572 // is x a String or a character?
574 // remove negative sign
576 for(j
=0;j
<x
.length
;j
++) {
577 // call isNumeric recursively for each character
578 number
=isNumeric(x
.substring(j
,j
+1));
579 if(!number
) return number
;
584 // if x is number return true
585 if(numbers
.indexOf(x
)>=0) return true;
591 function hideOrShowFeeds(doc
, hide
) {
593 if (!doc
.styleSheets
) return;
595 var css_rules
= doc
.styleSheets
[0].cssRules
;
597 if (!css_rules
|| !css_rules
.length
) return;
599 for (i
= 0; i
< css_rules
.length
; i
++) {
600 var rule
= css_rules
[i
];
602 if (rule
.selectorText
== "ul.feedList li.feed") {
604 rule
.style
.display
= "block";
606 rule
.style
.display
= "none";
614 function selectTableRow(r
, do_select
) {
615 r
.className
= r
.className
.replace("Selected", "");
618 r
.className
= r
.className
+ "Selected";
622 function selectTableRowById(elem_id
, check_id
, do_select
) {
626 var row
= document
.getElementById(elem_id
);
629 selectTableRow(row
, do_select
);
632 var check
= document
.getElementById(check_id
);
635 check
.checked
= do_select
;
638 exception_error("selectTableRowById", e
);
642 function selectTableRowsByIdPrefix(content_id
, prefix
, check_prefix
, do_select
,
643 classcheck
, reset_others
) {
645 var content
= document
.getElementById(content_id
);
648 alert("[selectTableRows] Element " + content_id
+ " not found.");
652 for (i
= 0; i
< content
.rows
.length
; i
++) {
653 if (!classcheck
|| content
.rows
[i
].className
.match(classcheck
)) {
655 if (content
.rows
[i
].id
.match(prefix
)) {
656 selectTableRow(content
.rows
[i
], do_select
);
658 var row_id
= content
.rows
[i
].id
.replace(prefix
, "");
659 var check
= document
.getElementById(check_prefix
+ row_id
);
662 check
.checked
= do_select
;
664 } else if (reset_others
) {
665 selectTableRow(content
.rows
[i
], false);
667 var row_id
= content
.rows
[i
].id
.replace(prefix
, "");
668 var check
= document
.getElementById(check_prefix
+ row_id
);
671 check
.checked
= false;
675 } else if (reset_others
) {
676 selectTableRow(content
.rows
[i
], false);
678 var row_id
= content
.rows
[i
].id
.replace(prefix
, "");
679 var check
= document
.getElementById(check_prefix
+ row_id
);
682 check
.checked
= false;
689 function getSelectedTableRowIds(content_id
, prefix
) {
691 var content
= document
.getElementById(content_id
);
694 alert("[getSelectedTableRowIds] Element " + content_id
+ " not found.");
698 var sel_rows
= new Array();
700 for (i
= 0; i
< content
.rows
.length
; i
++) {
701 if (content
.rows
[i
].id
.match(prefix
) &&
702 content
.rows
[i
].className
.match("Selected")) {
704 var row_id
= content
.rows
[i
].id
.replace(prefix
+ "-", "");
705 sel_rows
.push(row_id
);
713 function toggleSelectRowById(sender
, id
) {
714 var row
= document
.getElementById(id
);
716 if (sender
.checked
) {
717 if (!row
.className
.match("Selected")) {
718 row
.className
= row
.className
+ "Selected";
721 if (row
.className
.match("Selected")) {
722 row
.className
= row
.className
.replace("Selected", "");
727 function toggleSelectListRow(sender
) {
728 var parent_row
= sender
.parentNode
;
730 if (sender
.checked
) {
731 if (!parent_row
.className
.match("Selected")) {
732 parent_row
.className
= parent_row
.className
+ "Selected";
735 if (parent_row
.className
.match("Selected")) {
736 parent_row
.className
= parent_row
.className
.replace("Selected", "");
742 function toggleSelectRow(sender
) {
743 var parent_row
= sender
.parentNode
.parentNode
;
745 if (sender
.checked
) {
746 if (!parent_row
.className
.match("Selected")) {
747 parent_row
.className
= parent_row
.className
+ "Selected";
750 if (parent_row
.className
.match("Selected")) {
751 parent_row
.className
= parent_row
.className
.replace("Selected", "");
756 function openExternalUrl(url
) {
757 var w
= window
.open(url
);
760 function getRelativeFeedId(list
, id
, direction
, unread_only
) {
762 if (direction
== "next") {
763 for (i
= 0; i
< list
.childNodes
.length
; i
++) {
764 var child
= list
.childNodes
[i
];
765 if (child
.id
&& child
.id
== "feedCatHolder") {
766 if (child
.lastChild
) {
767 var cr
= getRelativeFeedId(child
.firstChild
, id
, direction
);
770 } else if (child
.id
&& child
.id
.match("FEEDR-")) {
771 return child
.id
.replace('FEEDR-', '');
776 // FIXME select last feed doesn't work when only unread feeds are visible
778 if (direction
== "prev") {
779 for (i
= list
.childNodes
.length
-1; i
>= 0; i
--) {
780 var child
= list
.childNodes
[i
];
781 if (child
.id
== "feedCatHolder") {
782 if (child
.firstChild
) {
783 var cr
= getRelativeFeedId(child
.firstChild
, id
, direction
);
786 } else if (child
.id
.match("FEEDR-")) {
788 if (getCookie("ttrss_vf_hreadf") == 1) {
789 if (child
.className
!= "feed") {
790 alert(child
.className
);
791 return child
.id
.replace('FEEDR-', '');
794 return child
.id
.replace('FEEDR-', '');
801 var feed
= list
.ownerDocument
.getElementById("FEEDR-" + getActiveFeedId());
803 if (getCookie("ttrss_vf_hreadf") == 1) {
807 if (direction
== "next") {
817 } else if (e
.parentNode
.parentNode
.nextSibling
) {
819 var this_cat
= e
.parentNode
.parentNode
;
823 if (this_cat
&& this_cat
.nextSibling
) {
824 while (!e
&& this_cat
.nextSibling
) {
825 this_cat
= this_cat
.nextSibling
;
826 if (this_cat
.id
== "feedCatHolder") {
827 e
= this_cat
.firstChild
.firstChild
;
837 if (!unread_only
|| (unread_only
&& e
.className
!= "feed" &&
838 e
.className
!= "error")) {
839 return e
.id
.replace("FEEDR-", "");
844 } else if (direction
== "prev") {
850 if (e
.previousSibling
) {
852 e
= e
.previousSibling
;
854 } else if (e
.parentNode
.parentNode
.previousSibling
) {
856 var this_cat
= e
.parentNode
.parentNode
;
860 if (this_cat
&& this_cat
.previousSibling
) {
861 while (!e
&& this_cat
.previousSibling
) {
862 this_cat
= this_cat
.previousSibling
;
863 if (this_cat
.id
== "feedCatHolder") {
864 e
= this_cat
.firstChild
.lastChild
;
874 if (!unread_only
|| (unread_only
&& e
.className
!= "feed" &&
875 e
.className
!= "error")) {
876 return e
.id
.replace("FEEDR-", "");
884 function showBlockElement(id
) {
885 var elem
= document
.getElementById(id
);
888 elem
.style
.display
= "block";
890 alert("[showBlockElement] can't find element with id " + id
);
894 function hideParentElement(e
) {
895 e
.parentNode
.style
.display
= "none";
898 function dropboxSelect(e
, v
) {
899 for (i
= 0; i
< e
.length
; i
++) {
900 if (e
[i
].value
== v
) {
907 // originally stolen from http://www.11tmr.com/11tmr.nsf/d6plinks/MWHE-695L9Z
908 // bugfixed just a little bit :-)
909 function getURLParam(strParamName
){
911 var strHref
= window
.location
.href
;
913 if (strHref
.indexOf("#") == strHref
.length
-1) {
914 strHref
= strHref
.substring(0, strHref
.length
-1);
917 if ( strHref
.indexOf("?") > -1 ){
918 var strQueryString
= strHref
.substr(strHref
.indexOf("?"));
919 var aQueryString
= strQueryString
.split("&");
920 for ( var iParam
= 0; iParam
< aQueryString
.length
; iParam
++ ){
921 if (aQueryString
[iParam
].indexOf(strParamName
+ "=") > -1 ){
922 var aParam
= aQueryString
[iParam
].split("=");
923 strReturn
= aParam
[1];
931 function leading_zero(p
) {
933 if (s
.length
== 1) s
= "0" + s
;
937 function center_element(e
) {
940 var c_width
= document
.body
.clientWidth
;
941 var c_height
= document
.body
.clientHeight
;
943 var c_scroll
= document
.body
.scrollTop
;
945 var e_width
= e
.clientWidth
;
946 var e_height
= e
.clientHeight
;
948 var set_y
= (c_height
/ 2) + c_scroll
- (e_height
/ 2);
949 var set_x
= (c_width
/ 2) - (e_width
/ 2);
951 e
.style
.top
= set_y
+ "px";
952 e
.style
.left
= set_x
+ "px";
954 exception_error("center_element", e
);
958 function closeInfoBox() {
959 var box
= document
.getElementById('infoBox');
960 var shadow
= document
.getElementById('infoBoxShadow');
963 shadow
.style
.display
= "none";
965 box
.style
.display
= "none";
972 function displayDlg(id
, param
) {
974 if (!xmlhttp_ready(xmlhttp
)) {
981 xmlhttp
.open("GET", "backend.php?op=dlg&id=" +
982 param_escape(id
) + "¶m=" + param_escape(param
), true);
983 xmlhttp
.onreadystatechange
=infobox_callback
;
990 function infobox_submit_callback() {
991 if (xmlhttp
.readyState
== 4) {
992 notify(xmlhttp
.responseText
);
995 // called from prefs, reload tab
997 selectTab(active_tab
, false);
1002 function infobox_callback() {
1003 if (xmlhttp
.readyState
== 4) {
1004 var box
= document
.getElementById('infoBox');
1005 var shadow
= document
.getElementById('infoBoxShadow');
1007 box
.innerHTML
=xmlhttp
.responseText
;
1009 shadow
.style
.display
= "block";
1011 box
.style
.display
= "block";
1017 function qaddFilter() {
1019 if (!xmlhttp_ready(xmlhttp
)) {
1020 printLockingError();
1024 var regexp
= document
.getElementById("fadd_regexp");
1025 var match
= document
.getElementById("fadd_match");
1026 var feed
= document
.getElementById("fadd_feed");
1027 var action
= document
.getElementById("fadd_action");
1029 if (regexp
.value
.length
== 0) {
1030 alert("Missing filter expression.");
1032 notify("Adding filter...");
1034 var v_match
= match
[match
.selectedIndex
].text
;
1035 var feed_id
= feed
[feed
.selectedIndex
].id
;
1036 var action_id
= action
[action
.selectedIndex
].id
;
1038 xmlhttp
.open("GET", "backend.php?op=pref-filters&quiet=1&subop=add®exp=" +
1039 param_escape(regexp
.value
) + "&match=" + v_match
+
1040 "&fid=" + param_escape(feed_id
) + "&aid=" + param_escape(action_id
), true);
1042 xmlhttp
.onreadystatechange
=infobox_submit_callback
;
1050 function toggleSubmitNotEmpty(e
, submit_id
) {
1052 document
.getElementById(submit_id
).disabled
= (e
.value
== "")
1054 exception_error("toggleSubmitNotEmpty", e
);
1058 function isValidURL(s
) {
1059 return s
.match("http://") != null || s
.match("https://") != null;