38 lines
1 KiB
JavaScript
38 lines
1 KiB
JavaScript
(function ($) {
|
|
Drupal.behaviors.splash = {
|
|
attach: function(context, settings) {
|
|
var source = settings.splash.source;
|
|
var destination = settings.splash.destination;
|
|
var timeout = 0 + settings.splash.timeout;
|
|
var body = settings.splash.body;
|
|
var jBody = $('<div />').html(body);
|
|
|
|
var sourceChildren = $(source).children();
|
|
|
|
sourceChildren.detach();
|
|
jBody.appendTo($(source));
|
|
|
|
if (timeout) {
|
|
setTimeout(function() {
|
|
Drupal.behaviors.splash.timeoutCallback(settings, sourceChildren);
|
|
}, timeout);
|
|
}
|
|
},
|
|
timeoutCallback: function(settings, sourceChildren) {
|
|
var source = settings.splash.source;
|
|
var destination = settings.splash.destination;
|
|
var timeout = 0 + settings.splash.timeout;
|
|
|
|
var jSource = $(source);
|
|
var jSplash = jSource.children();
|
|
|
|
jSplash.detach();
|
|
sourceChildren.appendTo(jSource);
|
|
|
|
if (timeout) {
|
|
jSplash.appendTo($(destination));
|
|
}
|
|
}
|
|
};
|
|
|
|
})(jQuery);
|