mirror of
https://github.com/e107inc/e107.git
synced 2025-07-28 10:20:45 +02:00
Use e107.behaviors handler to initialize click event on ".e-modal" elements.
This commit is contained in:
@@ -1,3 +1,59 @@
|
||||
var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
|
||||
(function ($)
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes click event on '.e-modal' elements.
|
||||
*
|
||||
* @type {{attach: e107.behaviors.eModalAdmin.attach}}
|
||||
*/
|
||||
e107.behaviors.eModalAdmin = {
|
||||
attach: function (context, settings)
|
||||
{
|
||||
$(context).find('.e-modal').once('e-modal-admin').each(function ()
|
||||
{
|
||||
var $that = $(this);
|
||||
|
||||
$that.on('click', function ()
|
||||
{
|
||||
var $this = $(this);
|
||||
|
||||
if($this.attr('data-cache') == 'false')
|
||||
{
|
||||
$('#uiModal').on('shown.bs.modal', function ()
|
||||
{
|
||||
$(this).removeData('bs.modal');
|
||||
});
|
||||
}
|
||||
|
||||
var url = $this.attr('href');
|
||||
var caption = $this.attr('data-modal-caption');
|
||||
var height = ($(window).height() * 0.7) - 120;
|
||||
|
||||
if(caption === undefined)
|
||||
{
|
||||
caption = '';
|
||||
}
|
||||
|
||||
$('.modal-body').html('<div class="well"><iframe id="e-modal-iframe" width="100%" height="' + height + 'px" frameborder="0" scrolling="auto" style="display:block;background-color:transparent" allowtransparency="true" src="' + url + '"></iframe></div>');
|
||||
$('.modal-caption').html(caption + ' <i id="e-modal-loading" class="fa fa-spin fa-spinner"></i>');
|
||||
$('.modal').modal('show');
|
||||
|
||||
$("#e-modal-iframe").on("load", function ()
|
||||
{
|
||||
$('#e-modal-loading').hide();
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
$('form').h5Validate(
|
||||
@@ -208,44 +264,6 @@ $(document).ready(function()
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Bootstrap Modal window within an iFrame */
|
||||
$('.e-modal').on('click', function(e)
|
||||
{
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
if($(this).attr('data-cache') == 'false')
|
||||
{
|
||||
$('#uiModal').on('shown.bs.modal', function () {
|
||||
$(this).removeData('bs.modal');
|
||||
});
|
||||
}
|
||||
|
||||
var url = $(this).attr('href');
|
||||
var caption = $(this).attr('data-modal-caption');
|
||||
var height = ($(window).height() * 0.7) - 120;
|
||||
|
||||
if(caption === undefined)
|
||||
{
|
||||
caption = '';
|
||||
}
|
||||
|
||||
$('.modal-body').html('<div class="well"><iframe id="e-modal-iframe" width="100%" height="'+height+'px" frameborder="0" scrolling="auto" style="display:block;background-color:transparent" allowtransparency="true" src="' + url + '"></iframe></div>');
|
||||
$('.modal-caption').html(caption + ' <i id="e-modal-loading" class="fa fa-spin fa-spinner"></i>');
|
||||
$('.modal').modal('show');
|
||||
|
||||
$("#e-modal-iframe").on("load", function () {
|
||||
$('#e-modal-loading').hide();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
var progresspump = null;
|
||||
|
Reference in New Issue
Block a user