app/themes/default/assets/javascripts/default/common/flash.js in archangel-0.3.0 vs app/themes/default/assets/javascripts/default/common/flash.js in archangel-0.4.0

- old
+ new

@@ -1,48 +1,9 @@ (function () { 'use strict'; - document.addEventListener('DOMContentLoaded', function() { - var messagesContainer = document.querySelector('#alert-messages'), - alertItems = messagesContainer.querySelectorAll('.alert'), - alertItemCount = alertItems.length; + // Fade out flash messages + setTimeout(function(){ + $('.alert').alert('close'); + }, 5000); - function setOpacity(element, opacity, filterOpacity) { - element.style.opacity = opacity; - element.style.filter = 'alpha(opacity = ' + filterOpacity + ')'; - } - - function fadeOutFlash(element, startLevel, endLevel, duration, callback) { - var fadeInternal, - level = startLevel; - - fadeInternal = setInterval(function() { - if (level <= endLevel) { - setOpacity(element, endLevel, endLevel); - - clearInterval(fadeInternal); - - if (typeof callback === 'function') { callback(true); } - } - - else { - level -= 0.1; - - setOpacity(element, level, (level * 100)); - } - }, duration); - } - - //// - // Fade flash messages out - // - for (var i = 0; i < alertItemCount; i += 1) { - var item = alertItems[i]; - - setTimeout(function() { - fadeOutFlash(item, 1, 0, 50, function() { - item.parentNode.removeChild(item); - }); - }, 3000); - } - }); }());