diff options
author | Andrew Dolgov <[email protected]> | 2010-11-14 23:46:49 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2010-11-14 23:46:49 +0300 |
commit | 951906dcecb1d3c7bcf751976a03e0c196ca6db0 (patch) | |
tree | 7d5d077b03a47cf59755dc2ed3021e8ee2816428 /functions.js | |
parent | 75c510323be9682951412510d82f97d838dcb3bf (diff) |
use Modalbox library for popup dialogs
Diffstat (limited to 'functions.js')
-rw-r--r-- | functions.js | 96 |
1 files changed, 49 insertions, 47 deletions
diff --git a/functions.js b/functions.js index 56fafad9f..1c21adf0a 100644 --- a/functions.js +++ b/functions.js @@ -27,38 +27,34 @@ function exception_error(location, e, ext_info) { try { - var ebc = $("xebContent"); - - if (ebc) { - - Element.show("dialog_overlay"); - Element.show("errorBoxShadow"); - - if (ext_info) { - if (ext_info.responseText) { - ext_info = ext_info.responseText; - } + if (ext_info) { + if (ext_info.responseText) { + ext_info = ext_info.responseText; } - - ebc.innerHTML = - "<div><b>Error message:</b></div>" + - "<pre>" + msg + "</pre>"; + } - if (ext_info) { - ebc.innerHTML += "<div><b>Additional information:</b></div>" + - "<textarea readonly=\"1\">" + ext_info + "</textarea>"; - } + var content = "<div class=\"fatalError\">" + + "<pre>" + msg + "</pre>"; - ebc.innerHTML += "<div><b>Stack trace:</b></div>" + - "<textarea readonly=\"1\">" + e.stack + "</textarea>"; - - } else { - alert(msg); + if (ext_info) { + content += "<div><b>Additional information:</b></div>" + + "<textarea readonly=\"1\">" + ext_info + "</textarea>"; } + content += "<div><b>Stack trace:</b></div>" + + "<textarea readonly=\"1\">" + e.stack + "</textarea>"; + + content += "<div style='text-align : center'>" + + "<button onclick=\"closeInfoBox()\">" + + "Close this window" + "</button></div>"; + + // TODO: add code to automatically report errors to tt-rss.org + + Modalbox.show(content, {title: "Unhandled exception", width: 600, + resizeDuration: 0, transitions: false}); + } catch (e) { alert(msg); - } } @@ -322,7 +318,10 @@ function toggleSelectRow(sender, row) { function checkboxToggleElement(elem, id) { if (elem.checked) { - Effect.Appear(id, {duration : 0.5}); + Effect.Appear(id, {duration : 0.5, + afterSetup: function() { + Modalbox.resizeToContent(); + }}); } else { Effect.Fade(id, {duration : 0.5}); } @@ -391,26 +390,19 @@ function closeInfoBox(cleanup) { try { enableHotkeys(); + Modalbox.hide(); - if (Element.visible("infoBoxShadow")) { - Element.hide("dialog_overlay"); - Element.hide("infoBoxShadow"); - - if (cleanup) $("infoBox").innerHTML = " "; - } } catch (e) { - exception_error("closeInfoBox", e); + //exception_error("closeInfoBox", e); } - return false; } function displayDlg(id, param, callback) { - notify_progress("Loading, please wait...", true); - disableHotkeys(); + notify_progress("Loading, please wait...", true); var query = "?op=dlg&id=" + param_escape(id) + "¶m=" + param_escape(param); @@ -443,23 +435,30 @@ function infobox_submit_callback2(transport) { function infobox_callback2(transport) { try { - console.log("infobox_callback2"); + //console.log("infobox_callback2"); + notify(''); - var box = $('infoBox'); - - if (box) { + var content; + var dtitle = "Dialog"; - if (!getInitParam("infobox_disable_overlay")) { - Element.show("dialog_overlay"); - } + if (transport.responseXML) { + var dlg = transport.responseXML.getElementsByTagName("dlg")[0]; - box.innerHTML=transport.responseText; - Element.show("infoBoxShadow"); - //Effect.SlideDown("infoBoxShadow", {duration : 1.0}); + var title = transport.responseXML.getElementsByTagName("title")[0]; + if (title) + dtitle = title.firstChild.nodeValue; + var content = transport.responseXML.getElementsByTagName("content")[0]; + + content = content.firstChild.nodeValue; + } else { + content = transport.responseText; } + Modalbox.show(content, {title: dtitle, width: 600, + transitions: true, resizeDuration: 0 }); + disableHotkeys(); notify(""); @@ -604,7 +603,10 @@ function subscribeToFeed() { if (count > 5) count = 5; select.size = count; - Effect.Appear('fadd_feeds_container', {duration : 0.5}); + Effect.Appear('fadd_feeds_container', {duration : 0.5, + afterSetup: function() { + Modalbox.resizeToContent() + }}); } }); break; |