From 951906dcecb1d3c7bcf751976a03e0c196ca6db0 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 14 Nov 2010 23:46:49 +0300 Subject: use Modalbox library for popup dialogs --- functions.js | 96 +++++++++++++++++++++++++++++++----------------------------- 1 file changed, 49 insertions(+), 47 deletions(-) (limited to 'functions.js') 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 = - "
Error message:
" + - "
" + msg + "
"; + } - if (ext_info) { - ebc.innerHTML += "
Additional information:
" + - ""; - } + var content = "
" + + "
" + msg + "
"; - ebc.innerHTML += "
Stack trace:
" + - ""; - - } else { - alert(msg); + if (ext_info) { + content += "
Additional information:
" + + ""; } + content += "
Stack trace:
" + + ""; + + content += "
" + + "
"; + + // 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; -- cgit v1.2.3-54-g00ecf