From ad735932f1bb7321bea8d34cd07178d3a7357038 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Sat, 18 Jan 2014 16:55:16 +0000 Subject: [PATCH] Add loader animation to iframe src change --- etemplate/js/et2_widget_iframe.js | 19 ++++++++++++++++++- etemplate/templates/default/etemplate2.css | 10 ++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/etemplate/js/et2_widget_iframe.js b/etemplate/js/et2_widget_iframe.js index bf5efcc355..c477b8ef1f 100644 --- a/etemplate/js/et2_widget_iframe.js +++ b/etemplate/js/et2_widget_iframe.js @@ -111,7 +111,24 @@ var et2_iframe = et2_valueWidget.extend( set_src: function(_value) { if(_value.trim() != "") { - this.htmlNode.attr("src", _value); + if(_value.trim() == 'about:blank') + { + this.htmlNode.attr("src", _value); + } + else + { + // Load the new page, but display a loader + var loader = $j('
'); + this.htmlNode + .before(loader); + window.setTimeout(jQuery.proxy(function() { + this.htmlNode.attr("src", _value) + .one('load',function() { + loader.remove(); + }); + },this),0); + + } } }, diff --git a/etemplate/templates/default/etemplate2.css b/etemplate/templates/default/etemplate2.css index d536f22245..c41bd55567 100644 --- a/etemplate/templates/default/etemplate2.css +++ b/etemplate/templates/default/etemplate2.css @@ -724,6 +724,16 @@ table.et2_grid { table.et2_grid tbody.ui-sortable > tr:not(.th) { cursor: ns-resize; } + +/** + * irame & loader + */ +.et2_iframe.loading { + position: absolute; + width: 100%; + height: 100%; +} + /** * Create some spacing for widgets inside labels */