1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | var platform = require("./platform");
|
7 |
|
8 | if (platform.isEjecta()) {
|
9 | var adBanner = new window.Ejecta.AdBanner();
|
10 |
|
11 | var isLandscape = window.innerWidth > window.innerHeight;
|
12 |
|
13 | var sizes = {
|
14 | "iPhone": {
|
15 | "portrait": {
|
16 | "width": 320,
|
17 | "height": 50
|
18 | },
|
19 | "landscape": {
|
20 | "width": 480,
|
21 | "height": 32
|
22 | }
|
23 | },
|
24 | "iPad": {
|
25 | "portrait": {
|
26 | "width": 768,
|
27 | "height": 66
|
28 | },
|
29 | "landscape": {
|
30 | "width": 1024,
|
31 | "height": 66
|
32 | }
|
33 | }
|
34 | };
|
35 |
|
36 | var device = window.navigator.userAgent.indexOf("iPad") >= 0 ? "iPad" : "iPhone";
|
37 | var size = sizes[device][isLandscape ? "landscape" : "portrait"];
|
38 |
|
39 | module.exports = {
|
40 | |
41 |
|
42 |
|
43 |
|
44 |
|
45 | "show": function(isAtBottom) {
|
46 | adBanner.isAtBottom = isAtBottom;
|
47 | adBanner.show();
|
48 | },
|
49 | |
50 |
|
51 |
|
52 |
|
53 | "hide": function() {
|
54 | adBanner.hide();
|
55 | },
|
56 | |
57 |
|
58 |
|
59 |
|
60 | "width": size.width,
|
61 | |
62 |
|
63 |
|
64 |
|
65 | "height": size.height
|
66 | };
|
67 | } else {
|
68 | module.exports = {
|
69 | "show": function() {},
|
70 | "hide": function() {},
|
71 | "width": 0,
|
72 | "height": 0
|
73 | };
|
74 | }
|