]> git.wh0rd.org - tt-rss.git/blobdiff - functions.js
move some cookies to init-params
[tt-rss.git] / functions.js
index 683d80077641807871850558f4fd0b9c949f64d3..5940174d30b646f4239d6adca13b30b164985768 100644 (file)
@@ -80,6 +80,8 @@ function delay(gap) {
 var notify_hide_timerid = false;
 var notify_last_doc = false;
 
+var notify_effect = false;
+
 function hide_notify() {
        if (notify_last_doc) {
                var n = notify_last_doc.getElementById("notify");               
@@ -362,6 +364,11 @@ function disableContainerChildren(id, disable, doc) {
 
        var container = doc.getElementById(id);
 
+       if (!container) {
+               //alert("disableContainerChildren: element " + id + " not found");
+               return;
+       }
+
        for (var i = 0; i < container.childNodes.length; i++) {
                var child = container.childNodes[i];
 
@@ -404,26 +411,7 @@ function setActiveFeedId(id) {
        return setCookie("ttrss_vf_actfeed", id);
 }
 
-var xmlhttp_rpc = false;
-
-/*@cc_on @*/
-/*@if (@_jscript_version >= 5)
-// JScript gives us Conditional compilation, we can cope with old IE versions.
-// and security blocked creation of the objects.
-try {
-       xmlhttp_rpc = new ActiveXObject("Msxml2.XMLHTTP");
-} catch (e) {
-       try {
-               xmlhttp_rpc = new ActiveXObject("Microsoft.XMLHTTP");
-       } catch (E) {
-               xmlhttp_rpc = false;
-       }
-}
-@end @*/
-
-if (!xmlhttp_rpc && typeof XMLHttpRequest!='undefined') {
-       xmlhttp_rpc = new XMLHttpRequest();
-}
+var xmlhttp_rpc = Ajax.getTransport();
 
 function parse_counters(reply, f_document, title_obj, scheduled_call) {
        try {
@@ -937,28 +925,7 @@ function leading_zero(p) {
        return s;
 }
 
-function center_element(e) {
-
-       try {
-               var c_width = document.body.clientWidth;
-               var c_height = document.body.clientHeight;
-       
-               var c_scroll = document.body.scrollTop;
-       
-               var e_width = e.clientWidth;
-               var e_height = e.clientHeight;
-       
-               var set_y = (c_height / 2) + c_scroll - (e_height / 2);
-               var set_x = (c_width / 2) - (e_width / 2);
-       
-               e.style.top = set_y + "px";
-               e.style.left = set_x + "px";
-       } catch (e) {
-               exception_error("center_element", e);
-       }
-}
-
-function closeInfoBox() {
+function closeInfoBox(cleanup) {
        var box = document.getElementById('infoBox');
        var shadow = document.getElementById('infoBoxShadow');
 
@@ -968,6 +935,8 @@ function closeInfoBox() {
                box.style.display = "none";
        }
 
+       if (cleanup) box.innerHTML = "&nbsp;";
+
        enableHotkeys();
 
 }
@@ -1047,3 +1016,42 @@ function toggleSubmitNotEmpty(e, submit_id) {
 function isValidURL(s) {
        return s.match("http://") != null || s.match("https://") != null;
 }
+
+function qafAdd() {
+
+       if (!xmlhttp_ready(xmlhttp)) {
+               printLockingError();
+               return
+       }
+
+       notify("Adding feed...");
+
+       closeInfoBox();
+
+       var feeds_doc = window.frames["feeds-frame"].document;
+
+       feeds_doc.location.href = "backend.php?op=error&msg=Loading,%20please wait...";
+       
+       var query = Form.serialize("feed_add_form");
+       
+       xmlhttp.open("GET", "backend.php?" + query, true);
+       xmlhttp.onreadystatechange=dlg_frefresh_callback;
+       xmlhttp.send(null);
+}
+
+function filterCR(e)
+{
+     var key;
+
+     if(window.event)
+          key = window.event.keyCode;     //IE
+     else
+          key = e.which;     //firefox
+
+     if(key == 13)
+          return false;
+     else
+          return true;
+}
+
+