* added option(waittime) to limit the loading of iframe modal.

* fixed style for ie 11.
 * ajusted code format.
This commit is contained in:
Catouse
2014-06-10 11:43:44 +08:00
parent 5fe5b91ba4
commit d7b48b0733
4 changed files with 74 additions and 49 deletions
+4 -4
View File
@@ -64,10 +64,10 @@ $(function()
}});
}
if($('a.webapp').length) $("a.webapp").modalTrigger({width:700, type:'iframe'});
if($('a.apiapp').length) $("a.apiapp").modalTrigger({width:700, type:'iframe'});
$('.runapp.popup').modalTrigger({width:700, type:'iframe'});
$('.runapp:not(.popup)').modalTrigger({size:'fullscreen', type:'iframe', cssClass:'app-inside'});
$("a.webapp").modalTrigger({width:700, type:'iframe', icon: 'th-large'});
$("a.apiapp").modalTrigger({width:700, type:'iframe', icon: 'th-large'});
$('.runapp.popup').modalTrigger({type:'iframe', icon: 'th-large', waittime: 1000});
$('.runapp:not(.popup)').modalTrigger({size:'fullscreen', type:'iframe', cssClass:'app-inside', waittime: 1000});
setSize($('#target').val());
$('#target').change(function(){setSize($(this).val())});
+1 -1
View File
@@ -77,7 +77,7 @@
</div></div>
<?php endforeach;?>
</div>
<p class='clearfix'><?php if($pager) $pager->show();?></p>
<div class='clearfix'><?php if($pager) $pager->show();?></div>
<?php else:?>
<div class='box-title'><?php echo $lang->webapp->errorOccurs;?></div>
<div class='box-content'><?php echo $lang->webapp->errorGetExtensions;?></div>
+60 -36
View File
@@ -901,6 +901,7 @@ function setModal()
name: 'modalIframe',
cssClass: '',
headerless: false,
waittime: 0,
center: true
}
@@ -938,58 +939,81 @@ function setModal()
{
dialog.addClass(options.cssClass);
}
if(options.waittime > 0)
{
options.waitingFuc = setTimeout(function(){showModal(options, modal, modalBody);}, options.waittime );
}
var frame = document.getElementById(options.name);
frame.onload = frame.onreadystatechange = function()
{
if (this.readyState && this.readyState != 'complete') return;
if(this.readyState && this.readyState != 'complete') return;
if(!modal.hasClass('modal-loading')) return;
if(!modal.data('first')) modal.addClass('modal-loading');
modalBody.css('height', options.height - modal.find('.modal-header').outerHeight());
try
if(options.waittime > 0)
{
var $frame = $(window.frames[options.name].document);
if($frame.find('#titlebar').length)
clearTimeout(options.waitingFuc);
}
showModal(options, modal, modalBody);
}
modal.modal('show');
}
function showModal(options, modal, modalBody)
{
modalBody.css('height', options.height - modal.find('.modal-header').outerHeight());
try
{
var $frame = $(window.frames[options.name].document);
if($frame.find('#titlebar').length)
{
modal.addClass('with-titlebar');
if(options.size == 'fullscreen')
{
modal.addClass('with-titlebar');
if(options.size == 'fullscreen')
{
modalBody.css('height', options.height);
}
modalBody.css('height', options.height);
}
if(options.height == 'auto')
}
if(options.height == 'auto')
{
var $framebody = $frame.find('body');
setTimeout(function()
{
var $framebody = $frame.find('body');
setTimeout(function()
var fbH = $framebody.addClass('body-modal').outerHeight();
if(typeof fbH == 'object') fbH = $framebody.height();
modalBody.css('height', fbH);
if(options.center) dialog.css('margin-top', Math.max(0, (modal.height() - dialog.height())/3));
modal.removeClass('modal-loading');
if(modal.data('first')) modal.data('first', false);
}, 100);
if(navigator.userAgent.indexOf("MSIE 8.0") < 0)
{
$framebody.resize(function()
{
var fbH = $framebody.addClass('body-modal').outerHeight();
if(typeof fbH == 'object') fbH = $framebody.height();
modalBody.css('height', fbH);
if(options.center) dialog.css('margin-top', Math.max(0, (modal.height() - dialog.height())/3));
modal.removeClass('modal-loading');
if(modal.data('first')) modal.data('first', false);
}, 100);
if(navigator.userAgent.indexOf("MSIE 8.0") < 0)
{
$framebody.resize(function()
{
var fbH = $framebody.addClass('body-modal').outerHeight();
if(typeof fbH == 'object') fbH = $framebody.height();
modalBody.css('height', fbH);
});
}
}
var iframe$ = window.frames[options.name].$;
if(iframe$)
{
iframe$.extend({'closeModal': $.closeModal});
});
}
}
catch(e){modal.removeClass('modal-loading');}
else
{
modal.removeClass('modal-loading');
}
var iframe$ = window.frames[options.name].$;
if(iframe$)
{
iframe$.extend({'closeModal': $.closeModal});
}
}
catch(e)
{
modal.removeClass('modal-loading');
}
modal.modal('show');
}
function initModalFrame(setting)
+9 -8
View File
@@ -588,6 +588,7 @@ body {font-size: 13px; color:#141414;padding-bottom: 40px;}
.modal-dialog.fullscreen {width: 100% !important; height: 100% !important; margin: 0; border: none !important;}
.modal-dialog.fullscreen .modal-body iframe {height: 100%}
.modal-loading {overflow: hidden;}
.modal-loading .modal-dialog {margin-top: -100%!important;}
.loader {display: none}
.modal-loading .loader{position: absolute; display: block; text-align: center; font-size: 56px; color: #fff; top: 35%; width: 100%}
@@ -611,26 +612,26 @@ body {font-size: 13px; color:#141414;padding-bottom: 40px;}
#debugPanel {display: none}
/* === Responsive === */
@media (max-width: 1199px)
{ /* laptop */
@media (max-width: 1199px) /* laptop */
{
#mainmenu .nav > li > a {padding: 7px 14px}
}
@media (max-width: 991px)
{ /* taplet */
@media (max-width: 991px) /* taplet */
{
#mainmenu .nav > li > a {padding: 7px 12px}
#searchbox {width: 150px;}
#typeSelector .btn, #objectSwitcher .btn{padding-left: 5px;}
#modulemenu .nav > li > a {padding: 0 5px;}
}
@media (max-width: 767px)
{ /* phone */
@media (max-width: 767px) /* phone */
{
#mainmenu .nav > li > a {padding: 5px 9px; font-size: 14px}
#mainmenu .nav > li > a > span {display: none}
#searchbox {width: 120px;}
#featurebar .nav {float: none}
#featurebar .nav > li > a {padding: 0 2px; font-size: 13px}
}
@media (max-width: 600px)
{ /* small phone */
@media (max-width: 600px) /* small phone */
{
#searchbox {display: none}
}