splash.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. (function ($) {
  2. Drupal.behaviors.splash = {
  3. attach: function(context, settings) {
  4. var source = settings.splash.source;
  5. var destination = settings.splash.destination;
  6. var timeout = 0 + settings.splash.timeout;
  7. var body = settings.splash.body;
  8. var jBody = $('<div />').html(body);
  9. var sourceChildren = $(source).children();
  10. sourceChildren.detach();
  11. jBody.appendTo($(source));
  12. if (timeout) {
  13. setTimeout(function() {
  14. Drupal.behaviors.splash.timeoutCallback(settings, sourceChildren);
  15. }, timeout);
  16. }
  17. },
  18. timeoutCallback: function(settings, sourceChildren) {
  19. var source = settings.splash.source;
  20. var destination = settings.splash.destination;
  21. var timeout = 0 + settings.splash.timeout;
  22. var jSource = $(source);
  23. var jSplash = jSource.children();
  24. jSplash.detach();
  25. sourceChildren.appendTo(jSource);
  26. if (timeout) {
  27. jSplash.appendTo($(destination));
  28. }
  29. }
  30. };
  31. })(jQuery);