/* ======================================================================== * OctoberCMS: front-end JavaScript extras * http://octobercms.com * ======================================================================== * Copyright 2016 Alexey Bobkov, Samuel Georges * ======================================================================== */ /* October CMS JSON Parser */ "use strict";!function(){function a(e,r,n){for(var t="",o=r;o').addClass('stripe-loading-indicator loaded') .append($('
').addClass('stripe')) .append($('
').addClass('stripe-loaded')) this.stripe = this.indicator.find('.stripe') $(document).ready(function() { $(document.body).append(self.indicator) }) } StripeLoadIndicator.prototype.show = function() { this.counter++ // Restart the animation this.stripe.after(this.stripe = this.stripe.clone()).remove() if (this.counter > 1) { return } this.indicator.removeClass('loaded') $(document.body).addClass('oc-loading') } StripeLoadIndicator.prototype.hide = function(force) { this.counter-- if (force !== undefined && force) { this.counter = 0 } if (this.counter <= 0) { this.indicator.addClass('loaded') $(document.body).removeClass('oc-loading') } } $.oc.stripeLoadIndicator = new StripeLoadIndicator() // STRIPE LOAD INDICATOR DATA-API // ============================ $(document) .on('ajaxPromise', '[data-request]', function(event) { // Prevent this event from bubbling up to a non-related data-request // element, for example a
tag wrapping a ') $(document.body).append($element) setTimeout(function() { $element.addClass('in') }, 100) var timer = window.setTimeout(remove, options.interval * 1000) function removeElement() { $element.remove() } function remove() { window.clearInterval(timer) $element.removeClass('in') $.support.transition && $element.hasClass('fade') ? $element .one($.support.transition.end, removeElement) .emulateTransitionEnd(500) : removeElement() } } FlashMessage.DEFAULTS = { class: 'success', text: 'Default text', interval: 5 } if ($.oc === undefined) $.oc = {} $.oc.flashMsg = FlashMessage // FLASH MESSAGE DATA-API // =============== $(document).render(function(){ $('[data-control=flash-message]').each(function(){ $.oc.flashMsg($(this).data(), this) }) }) }(window.jQuery);