From 0ee1d1a003e58f0c7180796a5873989b86dc1136 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 28 Feb 2006 17:25:38 +0100 Subject: updates to debug mode --- functions.js | 26 ++++++++++++++++++++++++++ tt-rss.css | 22 ++++++++++++++++++++++ tt-rss.js | 24 ++++++++++++++++++++++++ tt-rss.php | 2 ++ 4 files changed, 74 insertions(+) diff --git a/functions.js b/functions.js index d7dcd08f4..a0d6ecc1e 100644 --- a/functions.js +++ b/functions.js @@ -824,3 +824,29 @@ function dropboxSelect(e, v) { } } } + +// originally stolen from http://www.11tmr.com/11tmr.nsf/d6plinks/MWHE-695L9Z +// bugfixed just a little bit :-) +function getURLParam(strParamName){ + var strReturn = ""; + var strHref = window.location.href; + + if (strHref.indexOf("#") == strHref.length-1) { + strHref = strHref.substring(0, strHref.length-1); + } + + if ( strHref.indexOf("?") > -1 ){ + var strQueryString = strHref.substr(strHref.indexOf("?")); + var aQueryString = strQueryString.split("&"); + for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){ + if (aQueryString[iParam].indexOf(strParamName + "=") > -1 ){ + var aParam = aQueryString[iParam].split("="); + strReturn = aParam[1]; + break; + } + } + } + return strReturn; +} + + diff --git a/tt-rss.css b/tt-rss.css index 54117e23e..d9cc3b9b9 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -993,3 +993,25 @@ div.cdmContent a:hover { .noborder { border-width : 0px; } + +#debug_output { + width : 300; + height : 80; + right : 20; + bottom : 20; + background-color : white; + display : none; + z-index : 3; + position : absolute; + border : 1px solid #c0c0c0; + overflow : auto; + margin : 0px; + padding : 5px; + list-style-type : none; +} + +#debug_output li { + margin : 0px; + padding : 0px; + font-size : x-small; +} diff --git a/tt-rss.js b/tt-rss.js index 8e4343b0e..ff707320f 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -125,6 +125,8 @@ function refetch_callback() { parse_counters(reply, f_document, window); + debug("refetch_callback: done"); + if (!daemon_enabled) { notify("All feeds updated."); updateTitle(""); @@ -162,6 +164,8 @@ function backend_sanity_check_callback() { return fatalError(error_code); } + debug("sanity check ok"); + init_second_stage(); } catch (e) { @@ -201,6 +205,7 @@ function scheduleFeedUpdate(force) { query_str = query_str + "&omode=" + omode; query_str = query_str + "&uctr=" + global_unread; + debug("in scheduleFeedUpdate"); if (xmlhttp_ready(xmlhttp)) { xmlhttp.open("GET", query_str, true); @@ -393,6 +398,11 @@ function init() { if (!genericSanityCheck()) return; + if (getURLParam('debug')) { + document.getElementById('debug_output').style.display = 'block'; + debug('debug mode activated'); + } + xmlhttp.open("GET", "backend.php?op=rpc&subop=sanityCheck", true); xmlhttp.onreadystatechange=backend_sanity_check_callback; xmlhttp.send(null); @@ -442,6 +452,8 @@ function init_second_stage() { c.style.height = c.scrollHeight - nh + "px"; */ } + + debug("second stage ok"); } catch (e) { exception_error("init_second_stage", e); @@ -676,3 +688,15 @@ function toggleDispRead() { } } +function debug(msg) { + var c = document.getElementById('debug_output'); + if (c && c.style.display == "block") { + while (c.firstChild != 'undefined' && c.childNodes.length > 15) { + c.removeChild(c.firstChild); + } + + var d = new Date(); + var ts = d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds(); + c.innerHTML = c.innerHTML + "
  • [" + ts + "] " + msg + "
  • "; + } +} diff --git a/tt-rss.php b/tt-rss.php index 7802649c3..cc9f4fc59 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -71,6 +71,8 @@ window.onload = init; + + -- cgit v1.2.3