From: Jan Schneider Date: Mon, 15 Mar 2010 22:26:04 +0000 (+0100) Subject: There's no point in keeping several iframes in the body, if we always reload X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=2497364a0e548f5ae0436b8f158d6dc654198732;p=horde.git There's no point in keeping several iframes in the body, if we always reload the source anyway when we open them. --- diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index bf401a251..06fe6db56 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -450,7 +450,7 @@ KronolithCore = { case 'options': this.closeView('iframe'); - this.iframeContent(loc, Kronolith.conf.prefs_url); + this.iframeContent(Kronolith.conf.prefs_url); this.setTitle(Kronolith.text.prefs); this.updateMinical(this.date); this.addHistory(loc); @@ -461,9 +461,9 @@ KronolithCore = { this.closeView('iframe'); var app = locParts.shift(); if (data) { - this.iframeContent(loc, data); + this.iframeContent(data); } else if (Kronolith.conf.app_urls[app]) { - this.iframeContent(loc, Kronolith.conf.app_urls[app]); + this.iframeContent(Kronolith.conf.app_urls[app]); } this.updateMinical(this.date); this.addHistory(fullloc); @@ -2990,23 +2990,24 @@ KronolithCore = { } }, - iframeContent: function(name, loc) + /** + * Loads an external page into the iframe view. + * + * @param string loc The URL of the page to load. + */ + iframeContent: function(loc) { - this.closeView(); - - if (name === null) { - name = loc; - } - - if ($('kronolithIframe' + name)) { - $('kronolithIframe' + name).src = loc; - } else { - var iframe = new Element('iframe', { id: 'kronolithIframe' + name, className: 'kronolithIframe', frameBorder: 0, src: loc }); - //this.resizeIE6Iframe(iframe); - $('kronolithViewIframe').insert(iframe); - } - - $('kronolithViewIframe').appear({ queue: 'end' }); + var view = $('kronolithViewIframe'), iframe = $('kronolithIframe'); + view.hide(); + if (!iframe) { + view.insert(new Element('iframe', { id: 'kronolithIframe', className: 'kronolithIframe', frameBorder: 0 })); + iframe = $('kronolithIframe'); + } + iframe.observe('load', function() { + view.appear({ queue: 'end' }); + iframe.stopObserving('load'); + }); + iframe.src = loc; this.view = 'iframe'; }, @@ -3996,7 +3997,7 @@ KronolithCore = { var ev = r.response.event; if (!Object.isUndefined(ev.ln)) { - this.iframeContent('event', ev.ln); + this.iframeContent(ev.ln); this.closeRedBox(); return; }