script.js 944 B

1234567891011121314151617181920212223242526272829
  1. (function($) {
  2. Drupal.behaviors.init_theme = function (context) {
  3. // Growl-style system messages
  4. $('#messages-and-help > div.messages:not(.processed)')
  5. .addClass('processed')
  6. .each(function() {
  7. // If a message meets these criteria, we don't autoclose
  8. // - contains a link
  9. // - is an error or warning
  10. // - contains a lenghthy amount of text
  11. if ($('a', this).size() || $(this).is('.error') || $(this).is('.warning') || $(this).text().length > 100) {
  12. $(this).prepend("<span class='close'>X</span>");
  13. $('span.close', this).click(function() {
  14. $(this).parent().slideUp('fast');
  15. });
  16. }
  17. else {
  18. // This essentially adds a 3 second pause before hiding the message.
  19. $(this).animate({opacity:1}, 5000, 'linear', function() {
  20. $(this).slideUp('fast');
  21. });
  22. }
  23. });
  24. };
  25. })(jQuery);