Copy
1;(function(win, doc, style, timeout) {
2 var STYLE_ID = 'at-body-style';
3
4 function getParent() {
5 return doc.getElementsByTagName('head')[0];
6 }
7
8 function addStyle(parent, id, def) {
9 if (!parent) {
10 return;
11 }
12
13 var style = doc.createElement('style');
14 style.id = id;
15 style.innerHTML = def;
16 parent.appendChild(style);
17 }
18
19 function removeStyle(parent, id) {
20 if (!parent) {
21 return;
22 }
23
24 var style = doc.getElementById(id);
25
26 if (!style) {
27 return;
28 }
29
30 parent.removeChild(style);
31 }
32
33 addStyle(getParent(), STYLE_ID, style);
34 setTimeout(function() {
35 removeStyle(getParent(), STYLE_ID);
36 }, timeout);
37}(window, document, "body {opacity: 0 !important}", 3000));