X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=js%2Ffunctions.js;h=720a5654a95d73e4f8d15af0ed09817088499f47;hb=d9c93ebfdb860878609c6a59ef4df99f8f93643f;hp=fdd79159859d8261dd67b72f8cb6b914b1805e2f;hpb=8b16eeb1a39b9dee8266d27b3b1db573e9be62e5;p=tt-rss.git diff --git a/js/functions.js b/js/functions.js index fdd79159..720a5654 100644 --- a/js/functions.js +++ b/js/functions.js @@ -44,11 +44,8 @@ function exception_error(location, e, ext_info) { try { - if (ext_info) { - if (ext_info.responseText) { - ext_info = ext_info.responseText; - } - } + if (ext_info) + ext_info = JSON.stringify(ext_info); try { new Ajax.Request("backend.php", { @@ -104,13 +101,15 @@ function exception_error(location, e, ext_info) { title: "Unhandled exception", style: "width: 600px", report: function() { - if (confirm(__("Are you sure to report this exception to tt-rss.org? The report will include your browser information. Your IP would be saved in the database."))) { + if (confirm(__("Are you sure to report this exception to tt-rss.org? The report will include information about your web browser and tt-rss configuration. Your IP will be saved in the database."))) { document.forms['exceptionForm'].params.value = $H({ browserName: navigator.appName, browserVersion: navigator.appVersion, browserPlatform: navigator.platform, browserCookies: navigator.cookieEnabled, + ttrssVersion: __ttrss_version, + initParams: JSON.stringify(init_params), }).toQueryString(); document.forms['exceptionForm'].submit(); @@ -183,11 +182,6 @@ function param_unescape(arg) { return unescape(arg); } - -function hide_notify() { - Element.hide('notify'); -} - function notify_real(msg, no_hide, n_type) { var n = $("notify"); @@ -199,12 +193,11 @@ function notify_real(msg, no_hide, n_type) { } if (msg == "") { - if (Element.visible(n)) { - notify_hide_timerid = window.setTimeout("hide_notify()", 0); + if (n.hasClassName("visible")) { + notify_hide_timerid = window.setTimeout(function() { + n.removeClassName("visible") }, 0); } return; - } else { - Element.show(n); } /* types: @@ -218,18 +211,18 @@ function notify_real(msg, no_hide, n_type) { msg = " " + __(msg) + ""; - if (n_type == 1) { - n.className = "notify"; - } else if (n_type == 2) { - n.className = "notify progress"; + if (n_type == 2) { + n.className = "notify notify_progress visible"; msg = "" + msg; no_hide = true; } else if (n_type == 3) { - n.className = "notify error"; + n.className = "notify notify_error visible"; msg = "" + msg; } else if (n_type == 4) { - n.className = "notify info"; + n.className = "notify notify_info visible"; msg = "" + msg; + } else { + n.className = "notify visible"; } msg += " " + v); - - if (k == "label_base_index") _label_base_index = parseInt(v); + console.log("IP: " + k + " => " + JSON.stringify(params[k])); + if (k == "label_base_index") _label_base_index = parseInt(params[k]); } init_params = params; @@ -1936,3 +1950,25 @@ function feed_to_label_id(feed) { return _label_base_index - 1 + Math.abs(feed); } +// http://stackoverflow.com/questions/6251937/how-to-get-selecteduser-highlighted-text-in-contenteditable-element-and-replac + +function getSelectionText() { + var text = ""; + + if (typeof window.getSelection != "undefined") { + var sel = window.getSelection(); + if (sel.rangeCount) { + var container = document.createElement("div"); + for (var i = 0, len = sel.rangeCount; i < len; ++i) { + container.appendChild(sel.getRangeAt(i).cloneContents()); + } + text = container.innerHTML; + } + } else if (typeof document.selection != "undefined") { + if (document.selection.type == "Text") { + text = document.selection.createRange().textText; + } + } + + return text.stripTags(); +}