]>
git.wh0rd.org - tt-rss.git/blob - functions.js
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.1;
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;
108 if (notify_hide_timerid
) {
109 window
.clearTimeout(notify_hide_timerid
);
112 notify_last_doc
= doc
;
116 if (n
.style
.display
== "block") {
117 notify_hide_timerid
= window
.setTimeout("hide_notify()", 0);
121 n
.style
.display
= "block";
125 n
.style
.backgroundColor
= "#ffcccc";
126 n
.style
.color
= "black";
127 n
.style
.borderColor
= "#ff0000";
129 n
.style
.backgroundColor
= "#fff7d5";
130 n
.style
.borderColor
= "#d7c47a";
131 n
.style
.color
= "black";
137 notify_hide_timerid
= window
.setTimeout("hide_notify()", 3000);
141 function p_notify(msg
, no_hide
, is_err
) {
142 notify_real(msg
, parent
.document
, no_hide
, is_err
);
145 function notify(msg
, no_hide
, is_err
) {
146 notify_real(msg
, document
, no_hide
, is_err
);
149 function printLockingError() {
150 notify("Please wait until operation finishes");}
154 function hotkey_handler(e
) {
158 if (!hotkeys_enabled
) return;
161 keycode
= window
.event
.keyCode
;
166 if (keycode
== 13 || keycode
== 27) {
169 seq
= seq
+ "" + keycode
;
172 if (document
.getElementById("piggie")) {
174 if (seq
.match("807371717369")) {
176 localPiggieFunction(true);
178 localPiggieFunction(false);
182 if (typeof localHotkeyHandler
!= 'undefined') {
184 localHotkeyHandler(keycode
);
186 exception_error("hotkey_handler", e
);
192 function cleanSelectedList(element
) {
193 var content
= document
.getElementById(element
);
195 if (!document
.getElementById("feedCatHolder")) {
196 for (i
= 0; i
< content
.childNodes
.length
; i
++) {
197 var child
= content
.childNodes
[i
];
199 child
.className
= child
.className
.replace("Selected", "");
205 for (i
= 0; i
< content
.childNodes
.length
; i
++) {
206 var child
= content
.childNodes
[i
];
207 if (child
.id
== "feedCatHolder") {
208 parent
.debug(child
.id
);
209 var fcat
= child
.lastChild
;
210 for (j
= 0; j
< fcat
.childNodes
.length
; j
++) {
211 var feed
= fcat
.childNodes
[j
];
212 feed
.className
= feed
.className
.replace("Selected", "");
220 function cleanSelected(element
) {
221 var content
= document
.getElementById(element
);
223 for (i
= 0; i
< content
.rows
.length
; i
++) {
224 content
.rows
[i
].className
= content
.rows
[i
].className
.replace("Selected", "");
228 function getVisibleUnreadHeadlines() {
229 var content
= document
.getElementById("headlinesList");
231 var rows
= new Array();
233 for (i
= 0; i
< content
.rows
.length
; i
++) {
234 var row_id
= content
.rows
[i
].id
.replace("RROW-", "");
235 if (row_id
.length
> 0 && content
.rows
[i
].className
.match("Unread")) {
242 function getVisibleHeadlineIds() {
244 var content
= document
.getElementById("headlinesList");
246 var rows
= new Array();
248 for (i
= 0; i
< content
.rows
.length
; i
++) {
249 var row_id
= content
.rows
[i
].id
.replace("RROW-", "");
250 if (row_id
.length
> 0) {
257 function getFirstVisibleHeadlineId() {
258 var rows
= getVisibleHeadlineIds();
262 function getLastVisibleHeadlineId() {
263 var rows
= getVisibleHeadlineIds();
264 return rows
[rows
.length
-1];
267 function markHeadline(id
) {
268 var row
= document
.getElementById("RROW-" + id
);
270 var is_active
= false;
272 if (row
.className
.match("Active")) {
275 row
.className
= row
.className
.replace("Selected", "");
276 row
.className
= row
.className
.replace("Active", "");
277 row
.className
= row
.className
.replace("Insensitive", "");
280 row
.className
= row
.className
= "Active";
283 var check
= document
.getElementById("RCHK-" + id
);
286 check
.checked
= true;
289 row
.className
= row
.className
+ "Selected";
294 function getFeedIds() {
295 var content
= document
.getElementById("feedsList");
297 var rows
= new Array();
299 for (i
= 0; i
< content
.rows
.length
; i
++) {
300 var id
= content
.rows
[i
].id
.replace("FEEDR-", "");
309 function setCookie(name
, value
, lifetime
, path
, domain
, secure
) {
315 d
.setTime(lifetime
* 1000);
318 int_setCookie(name
, value
, d
, path
, domain
, secure
);
322 function int_setCookie(name
, value
, expires
, path
, domain
, secure
) {
323 document
.cookie
= name
+ "=" + escape(value
) +
324 ((expires
) ? "; expires=" + expires
.toGMTString() : "") +
325 ((path
) ? "; path=" + path
: "") +
326 ((domain
) ? "; domain=" + domain
: "") +
327 ((secure
) ? "; secure" : "");
330 function delCookie(name
, path
, domain
) {
331 if (getCookie(name
)) {
332 document
.cookie
= name
+ "=" +
333 ((path
) ? ";path=" + path
: "") +
334 ((domain
) ? ";domain=" + domain
: "" ) +
335 ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
340 function getCookie(name
) {
342 var dc
= document
.cookie
;
343 var prefix
= name
+ "=";
344 var begin
= dc
.indexOf("; " + prefix
);
346 begin
= dc
.indexOf(prefix
);
347 if (begin
!= 0) return null;
352 var end
= document
.cookie
.indexOf(";", begin
);
356 return unescape(dc
.substring(begin
+ prefix
.length
, end
));
359 function disableContainerChildren(id
, disable
, doc
) {
361 if (!doc
) doc
= document
;
363 var container
= doc
.getElementById(id
);
365 for (var i
= 0; i
< container
.childNodes
.length
; i
++) {
366 var child
= container
.childNodes
[i
];
369 child
.disabled
= disable
;
375 if (child
.className
&& child
.className
.match("button")) {
376 child
.className
= "disabledButton";
379 if (child
.className
&& child
.className
.match("disabledButton")) {
380 child
.className
= "button";
387 function gotoPreferences() {
388 document
.location
.href
= "prefs.php";
391 function gotoMain() {
392 document
.location
.href
= "tt-rss.php";
395 function gotoExportOpml() {
396 document
.location
.href
= "opml.php?op=Export";
399 function getActiveFeedId() {
400 return getCookie("ttrss_vf_actfeed");
403 function setActiveFeedId(id
) {
404 return setCookie("ttrss_vf_actfeed", id
);
407 var xmlhttp_rpc
= false;
410 /*@if (@_jscript_version >= 5)
411 // JScript gives us Conditional compilation, we can cope with old IE versions.
412 // and security blocked creation of the objects.
414 xmlhttp_rpc = new ActiveXObject("Msxml2.XMLHTTP");
417 xmlhttp_rpc = new ActiveXObject("Microsoft.XMLHTTP");
424 if (!xmlhttp_rpc
&& typeof XMLHttpRequest
!='undefined') {
425 xmlhttp_rpc
= new XMLHttpRequest();
428 function parse_counters(reply
, f_document
, title_obj
, scheduled_call
) {
430 for (var l
= 0; l
< reply
.childNodes
.length
; l
++) {
431 if (!reply
.childNodes
[l
] ||
432 typeof(reply
.childNodes
[l
].getAttribute
) == "undefined") {
433 // where did this come from?
437 var id
= reply
.childNodes
[l
].getAttribute("id");
438 var t
= reply
.childNodes
[l
].getAttribute("type");
439 var ctr
= reply
.childNodes
[l
].getAttribute("counter");
440 var error
= reply
.childNodes
[l
].getAttribute("error");
441 var has_img
= reply
.childNodes
[l
].getAttribute("hi");
442 var updated
= reply
.childNodes
[l
].getAttribute("updated");
444 if (id
== "global-unread") {
445 title_obj
.global_unread
= ctr
;
446 title_obj
.updateTitle();
450 if (t
== "category") {
451 var catctr
= f_document
.getElementById("FCATCTR-" + id
);
453 catctr
.innerHTML
= "(" + ctr
+ " unread)";
458 var feedctr
= f_document
.getElementById("FEEDCTR-" + id
);
459 var feedu
= f_document
.getElementById("FEEDU-" + id
);
460 var feedr
= f_document
.getElementById("FEEDR-" + id
);
461 var feed_img
= f_document
.getElementById("FIMG-" + id
);
462 var feedlink
= f_document
.getElementById("FEEDL-" + id
);
464 if (updated
&& feedlink
) {
466 feedlink
.title
= "Error: " + error
+ " (" + updated
+ ")";
468 feedlink
.title
= "Updated: " + updated
;
472 if (feedctr
&& feedu
&& feedr
) {
474 if (feedu
.innerHTML
!= ctr
&& id
== getActiveFeedId() && scheduled_call
) {
475 var hf
= title_obj
.parent
.frames
["headlines-frame"];
476 hf
.location
.reload(true);
479 feedu
.innerHTML
= ctr
;
482 feedr
.className
= feedr
.className
.replace("feed", "error");
484 feedr
.className
= feedr
.className
.replace("error", "feed");
488 feedctr
.className
= "odd";
489 if (!feedr
.className
.match("Unread")) {
490 var is_selected
= feedr
.className
.match("Selected");
492 feedr
.className
= feedr
.className
.replace("Selected", "");
493 feedr
.className
= feedr
.className
.replace("Unread", "");
495 feedr
.className
= feedr
.className
+ "Unread";
498 feedr
.className
= feedr
.className
+ "Selected";
503 feedctr
.className
= "invisible";
504 feedr
.className
= feedr
.className
.replace("Unread", "");
509 exception_error("parse_counters", e
);
513 // this one is called from feedlist context
514 // thus title_obj passed to parse_counters is parent (e.g. main ttrss window)
516 function all_counters_callback() {
517 if (xmlhttp_rpc
.readyState
== 4) {
519 if (!xmlhttp_rpc
.responseXML
|| !xmlhttp_rpc
.responseXML
.firstChild
) {
520 notify("[all_counters_callback] backend did not return valid XML");
524 if (!parent
.frames
["feeds-frame"]) {
525 notify("[all_counters_callback] no parent feeds-frame");
529 var reply
= xmlhttp_rpc
.responseXML
.firstChild
;
530 var f_document
= parent
.frames
["feeds-frame"].document
;
532 parse_counters(reply
, f_document
, parent
);
535 exception_error("all_counters_callback", e
);
540 function update_all_counters(feed
) {
541 if (xmlhttp_ready(xmlhttp_rpc
)) {
542 var query
= "backend.php?op=rpc&subop=getAllCounters";
545 query
= query
+ "&aid=" + feed
;
548 xmlhttp_rpc
.open("GET", query
, true);
549 xmlhttp_rpc
.onreadystatechange
=all_counters_callback
;
550 xmlhttp_rpc
.send(null);
554 function popupHelp(tid
) {
555 var w
= window
.open("backend.php?op=help&tid=" + tid
,
557 "menubar=no,location=no,resizable=yes,scrollbars=yes,status=no");
560 /** * @(#)isNumeric.js * * Copyright (c) 2000 by Sundar Dorai-Raj
561 * * @author Sundar Dorai-Raj
562 * * Email: sdoraira@vt.edu
563 * * This program is free software; you can redistribute it and/or
564 * * modify it under the terms of the GNU General Public License
565 * * as published by the Free Software Foundation; either version 2
566 * * of the License, or (at your option) any later version,
567 * * provided that any use properly credits the author.
568 * * This program is distributed in the hope that it will be useful,
569 * * but WITHOUT ANY WARRANTY; without even the implied warranty of
570 * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
571 * * GNU General Public License for more details at http://www.gnu.org * * */
573 var numbers
=".0123456789";
574 function isNumeric(x
) {
575 // is x a String or a character?
577 // remove negative sign
579 for(j
=0;j
<x
.length
;j
++) {
580 // call isNumeric recursively for each character
581 number
=isNumeric(x
.substring(j
,j
+1));
582 if(!number
) return number
;
587 // if x is number return true
588 if(numbers
.indexOf(x
)>=0) return true;
594 function hideOrShowFeeds(doc
, hide
) {
596 if (!doc
.styleSheets
) return;
598 var css_rules
= doc
.styleSheets
[0].cssRules
;
600 if (!css_rules
|| !css_rules
.length
) return;
602 for (i
= 0; i
< css_rules
.length
; i
++) {
603 var rule
= css_rules
[i
];
605 if (rule
.selectorText
== "ul.feedList li.feed") {
607 rule
.style
.display
= "block";
609 rule
.style
.display
= "none";
617 function selectTableRow(r
, do_select
) {
618 r
.className
= r
.className
.replace("Selected", "");
621 r
.className
= r
.className
+ "Selected";
625 function selectTableRowById(elem_id
, check_id
, do_select
) {
629 var row
= document
.getElementById(elem_id
);
632 selectTableRow(row
, do_select
);
635 var check
= document
.getElementById(check_id
);
638 check
.checked
= do_select
;
641 exception_error("selectTableRowById", e
);
645 function selectTableRowsByIdPrefix(content_id
, prefix
, check_prefix
, do_select
,
646 classcheck
, reset_others
) {
648 var content
= document
.getElementById(content_id
);
651 alert("[selectTableRows] Element " + content_id
+ " not found.");
655 for (i
= 0; i
< content
.rows
.length
; i
++) {
656 if (!classcheck
|| content
.rows
[i
].className
.match(classcheck
)) {
658 if (content
.rows
[i
].id
.match(prefix
)) {
659 selectTableRow(content
.rows
[i
], do_select
);
661 var row_id
= content
.rows
[i
].id
.replace(prefix
, "");
662 var check
= document
.getElementById(check_prefix
+ row_id
);
665 check
.checked
= do_select
;
667 } else if (reset_others
) {
668 selectTableRow(content
.rows
[i
], false);
670 var row_id
= content
.rows
[i
].id
.replace(prefix
, "");
671 var check
= document
.getElementById(check_prefix
+ row_id
);
674 check
.checked
= false;
678 } else if (reset_others
) {
679 selectTableRow(content
.rows
[i
], false);
681 var row_id
= content
.rows
[i
].id
.replace(prefix
, "");
682 var check
= document
.getElementById(check_prefix
+ row_id
);
685 check
.checked
= false;
692 function getSelectedTableRowIds(content_id
, prefix
) {
694 var content
= document
.getElementById(content_id
);
697 alert("[getSelectedTableRowIds] Element " + content_id
+ " not found.");
701 var sel_rows
= new Array();
703 for (i
= 0; i
< content
.rows
.length
; i
++) {
704 if (content
.rows
[i
].id
.match(prefix
) &&
705 content
.rows
[i
].className
.match("Selected")) {
707 var row_id
= content
.rows
[i
].id
.replace(prefix
+ "-", "");
708 sel_rows
.push(row_id
);
716 function toggleSelectRowById(sender
, id
) {
717 var row
= document
.getElementById(id
);
719 if (sender
.checked
) {
720 if (!row
.className
.match("Selected")) {
721 row
.className
= row
.className
+ "Selected";
724 if (row
.className
.match("Selected")) {
725 row
.className
= row
.className
.replace("Selected", "");
730 function toggleSelectListRow(sender
) {
731 var parent_row
= sender
.parentNode
;
733 if (sender
.checked
) {
734 if (!parent_row
.className
.match("Selected")) {
735 parent_row
.className
= parent_row
.className
+ "Selected";
738 if (parent_row
.className
.match("Selected")) {
739 parent_row
.className
= parent_row
.className
.replace("Selected", "");
745 function toggleSelectRow(sender
) {
746 var parent_row
= sender
.parentNode
.parentNode
;
748 if (sender
.checked
) {
749 if (!parent_row
.className
.match("Selected")) {
750 parent_row
.className
= parent_row
.className
+ "Selected";
753 if (parent_row
.className
.match("Selected")) {
754 parent_row
.className
= parent_row
.className
.replace("Selected", "");
759 function openExternalUrl(url
) {
760 var w
= window
.open(url
);
763 function getRelativeFeedId(list
, id
, direction
, unread_only
) {
765 if (direction
== "next") {
766 for (i
= 0; i
< list
.childNodes
.length
; i
++) {
767 var child
= list
.childNodes
[i
];
768 if (child
.id
&& child
.id
== "feedCatHolder") {
769 if (child
.lastChild
) {
770 var cr
= getRelativeFeedId(child
.firstChild
, id
, direction
);
773 } else if (child
.id
&& child
.id
.match("FEEDR-")) {
774 return child
.id
.replace('FEEDR-', '');
779 // FIXME select last feed doesn't work when only unread feeds are visible
781 if (direction
== "prev") {
782 for (i
= list
.childNodes
.length
-1; i
>= 0; i
--) {
783 var child
= list
.childNodes
[i
];
784 if (child
.id
== "feedCatHolder") {
785 if (child
.firstChild
) {
786 var cr
= getRelativeFeedId(child
.firstChild
, id
, direction
);
789 } else if (child
.id
.match("FEEDR-")) {
791 if (getCookie("ttrss_vf_hreadf") == 1) {
792 if (child
.className
!= "feed") {
793 alert(child
.className
);
794 return child
.id
.replace('FEEDR-', '');
797 return child
.id
.replace('FEEDR-', '');
804 var feed
= list
.ownerDocument
.getElementById("FEEDR-" + getActiveFeedId());
806 if (getCookie("ttrss_vf_hreadf") == 1) {
810 if (direction
== "next") {
820 } else if (e
.parentNode
.parentNode
.nextSibling
) {
822 var this_cat
= e
.parentNode
.parentNode
;
826 if (this_cat
&& this_cat
.nextSibling
) {
827 while (!e
&& this_cat
.nextSibling
) {
828 this_cat
= this_cat
.nextSibling
;
829 if (this_cat
.id
== "feedCatHolder") {
830 e
= this_cat
.firstChild
.firstChild
;
840 if (!unread_only
|| (unread_only
&& e
.className
!= "feed" &&
841 e
.className
!= "error")) {
842 return e
.id
.replace("FEEDR-", "");
847 } else if (direction
== "prev") {
853 if (e
.previousSibling
) {
855 e
= e
.previousSibling
;
857 } else if (e
.parentNode
.parentNode
.previousSibling
) {
859 var this_cat
= e
.parentNode
.parentNode
;
863 if (this_cat
&& this_cat
.previousSibling
) {
864 while (!e
&& this_cat
.previousSibling
) {
865 this_cat
= this_cat
.previousSibling
;
866 if (this_cat
.id
== "feedCatHolder") {
867 e
= this_cat
.firstChild
.lastChild
;
877 if (!unread_only
|| (unread_only
&& e
.className
!= "feed" &&
878 e
.className
!= "error")) {
879 return e
.id
.replace("FEEDR-", "");
887 function showBlockElement(id
) {
888 var elem
= document
.getElementById(id
);
891 elem
.style
.display
= "block";
893 alert("[showBlockElement] can't find element with id " + id
);
897 function hideParentElement(e
) {
898 e
.parentNode
.style
.display
= "none";
901 function dropboxSelect(e
, v
) {
902 for (i
= 0; i
< e
.length
; i
++) {
903 if (e
[i
].value
== v
) {
910 // originally stolen from http://www.11tmr.com/11tmr.nsf/d6plinks/MWHE-695L9Z
911 // bugfixed just a little bit :-)
912 function getURLParam(strParamName
){
914 var strHref
= window
.location
.href
;
916 if (strHref
.indexOf("#") == strHref
.length
-1) {
917 strHref
= strHref
.substring(0, strHref
.length
-1);
920 if ( strHref
.indexOf("?") > -1 ){
921 var strQueryString
= strHref
.substr(strHref
.indexOf("?"));
922 var aQueryString
= strQueryString
.split("&");
923 for ( var iParam
= 0; iParam
< aQueryString
.length
; iParam
++ ){
924 if (aQueryString
[iParam
].indexOf(strParamName
+ "=") > -1 ){
925 var aParam
= aQueryString
[iParam
].split("=");
926 strReturn
= aParam
[1];
934 function leading_zero(p
) {
936 if (s
.length
== 1) s
= "0" + s
;
940 function center_element(e
) {
943 var c_width
= document
.body
.clientWidth
;
944 var c_height
= document
.body
.clientHeight
;
946 var c_scroll
= document
.body
.scrollTop
;
948 var e_width
= e
.clientWidth
;
949 var e_height
= e
.clientHeight
;
951 var set_y
= (c_height
/ 2) + c_scroll
- (e_height
/ 2);
952 var set_x
= (c_width
/ 2) - (e_width
/ 2);
954 e
.style
.top
= set_y
+ "px";
955 e
.style
.left
= set_x
+ "px";
957 exception_error("center_element", e
);
961 function closeInfoBox() {
962 var box
= document
.getElementById('infoBox');
963 var shadow
= document
.getElementById('infoBoxShadow');
966 shadow
.style
.display
= "none";
968 box
.style
.display
= "none";
975 function displayDlg(id
, param
) {
977 if (!xmlhttp_ready(xmlhttp
)) {
984 xmlhttp
.open("GET", "backend.php?op=dlg&id=" +
985 param_escape(id
) + "¶m=" + param_escape(param
), true);
986 xmlhttp
.onreadystatechange
=infobox_callback
;
993 function infobox_submit_callback() {
994 if (xmlhttp
.readyState
== 4) {
995 notify(xmlhttp
.responseText
);
998 // called from prefs, reload tab
1000 selectTab(active_tab
, false);
1005 function infobox_callback() {
1006 if (xmlhttp
.readyState
== 4) {
1007 var box
= document
.getElementById('infoBox');
1008 var shadow
= document
.getElementById('infoBoxShadow');
1010 box
.innerHTML
=xmlhttp
.responseText
;
1012 shadow
.style
.display
= "block";
1014 box
.style
.display
= "block";
1020 function qaddFilter() {
1022 if (!xmlhttp_ready(xmlhttp
)) {
1023 printLockingError();
1027 var regexp
= document
.getElementById("fadd_regexp");
1028 var match
= document
.getElementById("fadd_match");
1029 var feed
= document
.getElementById("fadd_feed");
1030 var action
= document
.getElementById("fadd_action");
1032 if (regexp
.value
.length
== 0) {
1033 alert("Missing filter expression.");
1035 notify("Adding filter...");
1037 var v_match
= match
[match
.selectedIndex
].text
;
1038 var feed_id
= feed
[feed
.selectedIndex
].id
;
1039 var action_id
= action
[action
.selectedIndex
].id
;
1041 xmlhttp
.open("GET", "backend.php?op=pref-filters&quiet=1&subop=add®exp=" +
1042 param_escape(regexp
.value
) + "&match=" + v_match
+
1043 "&fid=" + param_escape(feed_id
) + "&aid=" + param_escape(action_id
), true);
1045 xmlhttp
.onreadystatechange
=infobox_submit_callback
;
1053 function toggleSubmitNotEmpty(e
, submit_id
) {
1055 document
.getElementById(submit_id
).disabled
= (e
.value
== "")
1057 exception_error("toggleSubmitNotEmpty", e
);
1061 function isValidURL(s
) {
1062 return s
.match("http://") != null || s
.match("https://") != null;