gui7.js 851 B

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