diff --git a/e107_web/js/core/admin.jquery.js b/e107_web/js/core/admin.jquery.js index 1feb8dda7..d3a617a83 100644 --- a/e107_web/js/core/admin.jquery.js +++ b/e107_web/js/core/admin.jquery.js @@ -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('
'); + $('.modal-caption').html(caption + ' '); + $('.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('
'); - $('.modal-caption').html(caption + ' '); - $('.modal').modal('show'); - - $("#e-modal-iframe").on("load", function () { - $('#e-modal-loading').hide(); - }); - }); - var progresspump = null; diff --git a/e107_web/js/core/front.jquery.js b/e107_web/js/core/front.jquery.js index bf810a416..d3c7c0fd7 100644 --- a/e107_web/js/core/front.jquery.js +++ b/e107_web/js/core/front.jquery.js @@ -40,6 +40,73 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}}; } }; + /** + * Initializes click event on '.e-modal' elements. + * + * @type {{attach: e107.behaviors.eModalFront.attach}} + */ + e107.behaviors.eModalFront = { + attach: function (context, settings) + { + $(context).find('.e-modal').once('e-modal-front').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 backdrop = $this.attr('data-modal-backdrop'); + var keyboard = $this.attr('data-modal-keyboard'); + var height = ($(window).height() * 0.7) - 120; + + var modalOptions = {show: true}; + + if(backdrop !== undefined) + { + modalOptions['backdrop'] = backdrop; + } + + if(keyboard !== undefined) + { + modalOptions['keyboard'] = keyboard; + } + + if(caption === undefined) + { + caption = ''; + } + + if($this.attr('data-modal-height') !== undefined) + { + height = $(this).attr('data-modal-height'); + } + + $('.modal-body').html('
'); + $('.modal-caption').html(caption + ' '); + $('.modal').modal(modalOptions); + + $("#e-modal-iframe").on("load", function () + { + $('#e-modal-loading').hide(); + }); + + return false; + }); + }); + } + }; + })(jQuery); @@ -397,60 +464,5 @@ $(document).ready(function() return true; }); - - - - /* Bootstrap Modal window within an iFrame for frontend */ - $('.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 backdrop = $(this).attr('data-modal-backdrop'); - var keyboard = $(this).attr('data-modal-keyboard'); - var height = ($(window).height() * 0.7) - 120; - - var modalOptions = {show: true}; - - if(backdrop !== undefined) - { - modalOptions['backdrop'] = backdrop; - } - - if(keyboard !== undefined) - { - modalOptions['keyboard'] = keyboard; - } - - if(caption === undefined) - { - caption = ''; - } - - if($(this).attr('data-modal-height') !== undefined) - { - height = $(this).attr('data-modal-height'); - } - - $('.modal-body').html('
'); - $('.modal-caption').html(caption + ' '); - $('.modal').modal(modalOptions); - - $("#e-modal-iframe").on("load", function () { - $('#e-modal-loading').hide(); - }); - }); - - - - });