Line | |
---|
1 | /**
|
---|
2 | * @class TTVOverlay
|
---|
3 | * @constructor
|
---|
4 | * @public
|
---|
5 | *
|
---|
6 | * This objects create a span which overlays the whole viewport. It fades
|
---|
7 | * in and displays a TTVPlayer at the center of the viewport.
|
---|
8 | *
|
---|
9 | * The given options are passed through to the created TTVDisplay object.
|
---|
10 | * The 'onclose' property is overwritten.
|
---|
11 | *
|
---|
12 | * @param {Object} options
|
---|
13 | * An object with options passed to the created TTVDisplay object.
|
---|
14 | */
|
---|
15 | function TTVOverlay(options)
|
---|
16 | {
|
---|
17 | var screen = document.createElement("span");
|
---|
18 | screen.setAttribute("style", "position:fixed;top:0px;left:0px;width:100%;height:100%;opacity:0;background-color:black;"); // right:500px;bottom:500px;
|
---|
19 |
|
---|
20 | var body = document.getElementsByTagName("body")[0];
|
---|
21 | body.appendChild(screen);
|
---|
22 |
|
---|
23 | var t = document.createElement("table");
|
---|
24 | t.setAttribute("style", "position:fixed;top:0px;left:0px;width:100%;height:100%");
|
---|
25 | var tr = document.createElement("tr");
|
---|
26 | var td = document.createElement("td");
|
---|
27 | td.align = "center";
|
---|
28 |
|
---|
29 | options['onclose'] = function() { body.removeChild(t); body.removeChild(screen); },
|
---|
30 |
|
---|
31 | body.appendChild(t);
|
---|
32 | t.appendChild(tr);
|
---|
33 | tr.appendChild(td);
|
---|
34 |
|
---|
35 | function fadeIn()
|
---|
36 | {
|
---|
37 | screen.style.opacity = parseFloat(screen.style.opacity) + 0.03;
|
---|
38 | if (screen.style.opacity>0.79)
|
---|
39 | {
|
---|
40 | var disp = new TTVDisplay(options);
|
---|
41 | td.appendChild(disp);
|
---|
42 | return;
|
---|
43 | }
|
---|
44 |
|
---|
45 | setTimeout(fadeIn, 1);
|
---|
46 | }
|
---|
47 |
|
---|
48 | fadeIn();
|
---|
49 | }
|
---|
50 |
|
---|
51 | // This is a hack to avoid that the closure compiler will rename
|
---|
52 | // these functions
|
---|
53 | window['TTVOverlay'] = TTVOverlay;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.