Browse code

Delete rule-41 campaign

hiromipaw authored on07/09/2017 17:54:09
Showing1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,381 +0,0 @@
1
-/*
2
-
3
-     ______   ______   ______ 
4
-    |  ____| |  ____| |  ____|
5
-    | |__    | |__    | |__   
6
-    |  __|   |  __|   |  __|  
7
-    | |____  | |      | |     
8
-    |______| |_|      |_|     
9
-                              
10
-  =============================================================================
11
-
12
-  Support the NoGlobalWarrants.org campaign by installing this banner on your site.
13
-
14
-  <sina@eff.org> for support
15
-
16
-  =============================================================================
17
-
18
-  @source: https://github.com/EFForg/ngw-banner
19
-
20
-  @licstart  The following is the entire license notice for the
21
-             JavaScript code in this page.
22
-
23
-  Copyright (C) 2016 Electronic Frontier Foundation <https://eff.org>
24
-
25
-  The JavaScript code in this page is free software: you can
26
-  redistribute it and/or modify it under the terms of the GNU
27
-  General Public License (GNU GPL) as published by the Free Software
28
-  Foundation, either version 3 of the License, or (at your option) any
29
-  later version.  The code is distributed WITHOUT ANY WARRANTY;
30
-  without even the implied warranty of MERCHANTABILITY or FITNESS FOR
31
-  A PARTICULAR PURPOSE.  See the GNU GPL for more details.
32
-
33
-  As additional permission under GNU GPL version 3 section 7, you may
34
-  distribute non-source (e.g., minimized or compacted) forms of that
35
-  code without the copy of the GNU GPL normally required by section
36
-  4, provided you include this license notice and a URL through which
37
-  recipients can access the Corresponding Source.
38
-
39
- @licend  The above is the entire license notice for the JavaScript
40
-          code in this page.
41
-
42
-*/
43
-
44
-// Wrap widget in function to protect scope
45
-var _banner_config = (typeof banner_config  !== 'undefined') ? banner_config  : {};
46
-
47
-(function (window, widgetConfig) {
48
-
49
-  // Do configuration
50
-  widgetConfig.show_style = widgetConfig.show_style || 'banner';
51
-  widgetConfig.debug = widgetConfig.debug || false;
52
-  widgetConfig.localAssets = widgetConfig.localAssets || false;
53
-  widgetConfig.callOnly = widgetConfig.callOnly || false;
54
-  widgetConfig.startAsMinimized = widgetConfig.startAsMinimized || false;
55
-  widgetConfig.disableDate = widgetConfig.disableDate || false;
56
-  widgetConfig.campaign = widgetConfig.campaign || 'noglobalwarrants';
57
-  widgetConfig.cookieTimeout = widgetConfig.cookieTimeout || null;
58
-
59
-  function debug() {
60
-    if (widgetConfig.debug) {
61
-      if (this.console) {
62
-        console.log.apply(console, arguments);
63
-      }
64
-    }
65
-  }
66
-
67
-  // Setup
68
-  var activeCampaign;
69
-  var ASSET_URL;
70
-
71
-  if (widgetConfig.localAssets) {
72
-    ASSET_URL = '../banner_content/';
73
-  } else {
74
-    ASSET_URL = 'https://www.eff.org/ngw/banner_content/';
75
-  }
76
-
77
-  // Cookie helpers, taken from w3schools
78
-  function setCookie(c_name, value, seconds) {
79
-    var exdate = new Date(new Date().getTime() + seconds * 1000);
80
-    var c_value = escape(value) + ((seconds === null) ? '' : '; expires=' +
81
-      exdate.toUTCString());
82
-    document.cookie = c_name + '=' + c_value;
83
-  }
84
-
85
-  function getCookie(c_name) {
86
-    var c_value = document.cookie;
87
-    var c_start = c_value.indexOf(' ' + c_name + '=');
88
-
89
-    if (c_start === -1) {
90
-      c_start = c_value.indexOf(c_name + '=');
91
-    }
92
-
93
-    if (c_start === -1) {
94
-      c_value = null;
95
-    } else {
96
-      c_start = c_value.indexOf('=', c_start) + 1;
97
-      var c_end = c_value.indexOf(';', c_start);
98
-      if (c_end === -1) { c_end = c_value.length; }
99
-      c_value = unescape(c_value.substring(c_start, c_end));
100
-    }
101
-
102
-    return c_value;
103
-  }
104
-
105
-  // Define checks
106
-  var checks = {
107
-    correctDate: function (callback) {
108
-      debug('correctDate()');
109
-
110
-      // This used to check the date by getting it from a server, but now just uses the device's local date.
111
-
112
-      window.dateCallBackFailSafe = setTimeout(function () {
113
-        var today = new Date();
114
-        if (today.getDate() === activeCampaign.runDate.day && today.getMonth() === activeCampaign.runDate.month - 1 && today.getFullYear() === activeCampaign.runDate.year) {
115
-          callback({activeToday: true});
116
-        } else {
117
-          callback({activeToday: false});
118
-        }
119
-      }, 1);
120
-    }
121
-  };
122
-
123
-  // Define campaigns
124
-  var campaign = {
125
-    noglobalwarrants: {
126
-      cookieName: 'noglobalwarrants_hasseen',
127
-      runDate: {
128
-        day: 21,
129
-        month: 6, // Use natural month, e.g. January = 1
130
-        year: 2016
131
-      },
132
-      size: {
133
-        desktop: {
134
-          heightOpened: '300px',
135
-          heightMinimized: '50px'
136
-        },
137
-        mobile: {
138
-          heightOpened: '100px',
139
-          heightMinimized: '0px'
140
-        }
141
-      },
142
-      styles: {
143
-        banner: {
144
-          campaignSpacer: 'height: 50px;',
145
-          campaignContainer: 'background: #000; position: fixed; ' +
146
-            'width: 100%; bottom: 0; left: 0; z-index: 100000; padding: 0; ' +
147
-            '-webkit-box-sizing: border-box; -moz-box-sizing: border-box;',
148
-          iframeContainer: 'position: relative; height: 350px; width: 100%; ' +
149
-            'margin: 0; background: #08A013; z-index: 1;',
150
-          iframe: 'width: 100%; height: 100%; border: 0; margin: 0; ' +
151
-            'padding: 0; background: #08A013;',
152
-          footerOverlay: 'cursor: pointer; position: absolute; bottom: 0; ' +
153
-            'height: 50px; width: 100%; margin: 0; background: none; ' +
154
-            'z-index: 2;',
155
-          closeButton: 'border: 0; height: 26px; width: 26px; ' +
156
-            'cursor: pointer; position: absolute; top: 20px; right: 20px; ' +
157
-            'background: url("' + ASSET_URL + 'imgs/close-button.png") no-repeat right top;',
158
-          mobileCloseButton: 'border: 0; height: 20px; width: 20px; ' +
159
-            'cursor: pointer; position: absolute;top: 10px; right: 10px; ' +
160
-            'background: url("' + ASSET_URL +
161
-            'imgs/close-button-mobile.png") no-repeat right top;',
162
-          openButton: 'border: 0; height: 26px; width: 26px; ' +
163
-            'cursor: pointer; position: absolute; bottom: 10px; ' +
164
-            'right: 20px; background: url("' + ASSET_URL +
165
-            'imgs/open-button.png") no-repeat right top;'
166
-        }
167
-      },
168
-      minimized: false,
169
-      show: function (options) {
170
-        debug('show()', options);
171
-
172
-        var cookie = getCookie(activeCampaign.cookieName);
173
-
174
-        if (widgetConfig.startAsMinimized && cookie === null) {
175
-          this.minimized = true;
176
-        }
177
-
178
-        var style = activeCampaign.styles[activeCampaign.config.show_style];
179
-
180
-        if (style.overlay) {
181
-          var overlay = document.createElement('div');
182
-          overlay.style.cssText = style.overlay;
183
-          document.body.appendChild(overlay);
184
-        }
185
-
186
-        // Create a spacer to prevent the container from covering up
187
-        // parts of the containing page when minimized
188
-
189
-        if(document.getElementById("campaign-spacer")){
190
-          document.body.removeChild(document.getElementById("campaign-spacer"));
191
-        }
192
-
193
-        if(document.getElementById("campaign-container")){
194
-          document.body.removeChild(document.getElementById("campaign-container"));
195
-        }
196
-
197
-        var campaignSpacer = document.createElement('div');
198
-        window.campaignSpacer = campaignSpacer;
199
-        campaignSpacer.style.cssText = style.campaignSpacer;
200
-        campaignSpacer.setAttribute("id", "campaign-spacer");
201
-        campaignSpacer.setAttribute("class", "campaign-spacer");
202
-        // Create a container
203
-        var campaignContainer = document.createElement('div');
204
-        window.campaignContainer = campaignContainer;
205
-        campaignContainer.style.cssText = style.campaignContainer;
206
-        campaignContainer.setAttribute("id", "campaign-container");
207
-        campaignContainer.setAttribute("class", "campaign-container");
208
-
209
-        // Create a container for the iframe so we can do padding and
210
-        // border-radius properly
211
-        var iframeContainer = document.createElement('div');
212
-
213
-        iframeContainer.style.cssText = style.iframeContainer;
214
-
215
-        var e = document.documentElement,
216
-            g = document.getElementsByTagName('body')[0],
217
-            x = window.innerWidth || e.clientWidth || g.clientWidth;
218
-
219
-        if (x < 767) {
220
-          if (!this.minimized) {
221
-            iframeContainer.style.height = '100px';
222
-          } else {
223
-            iframeContainer.style.height = '0px';
224
-          }
225
-        } else {
226
-          // Find out if user has minimized via cookie
227
-          if (this.minimized) {
228
-            iframeContainer.style.height = '50px';
229
-          } else {
230
-            iframeContainer.style.height = activeCampaign.size.desktop.heightOpened;
231
-          }
232
-          var footerOverlay = document.createElement('div');
233
-          footerOverlay.style.cssText = style.footerOverlay;
234
-          campaignContainer.appendChild(footerOverlay);
235
-        }
236
-
237
-        // Append Iframe and campaign container to document
238
-        campaignContainer.appendChild(iframeContainer);
239
-
240
-        document.body.appendChild(campaignSpacer);
241
-        document.body.appendChild(campaignContainer);
242
-
243
-        var firstTime = true;
244
-
245
-        if (cookie !== null) {
246
-          firstTime = false;
247
-        }
248
-
249
-        // a Hack, if mobile set firsttime to false so splash page never shows
250
-        if (x < 767) {
251
-          firstTime = false;
252
-        }
253
-
254
-        var iframe = document.createElement('iframe');
255
-
256
-        iframe.style.cssText = style.iframe;
257
-
258
-        var us = iframe.src = ASSET_URL + activeCampaign.config.show_style +
259
-          '.html?firstTime=' + firstTime;
260
-
261
-        iframeContainer.appendChild(iframe);
262
-
263
-        var that = this;
264
-
265
-        if (x > 767) {
266
-          that.fullSize = true;
267
-          // Setup a close button
268
-          var closeButton = document.createElement('button');
269
-          closeButton.style.cssText = style.closeButton;
270
-          iframeContainer.appendChild(closeButton);
271
-
272
-          // Setup a open button
273
-          var openButton = document.createElement('button');
274
-          openButton.style.cssText = style.openButton;
275
-          iframeContainer.appendChild(openButton);
276
-
277
-          if (this.minimized) {
278
-            openButton.style.display = 'block';
279
-            closeButton.style.display = 'none';
280
-            footerOverlay.style.display = 'block';
281
-          } else {
282
-            openButton.style.display = 'none';
283
-            closeButton.style.display = 'block';
284
-            footerOverlay.style.display = 'none';
285
-          }
286
-
287
-          var toggleDisplay = function () {
288
-            if (!that.minimized) {
289
-              iframeContainer.style.height = '50px';
290
-              that.minimized = true;
291
-              footerOverlay.style.display = 'block';
292
-              closeButton.style.display = 'none';
293
-              openButton.style.display = 'block';
294
-              setCookie(activeCampaign.cookieName, '{"minimized": true}',
295
-                widgetConfig.cookieTimeout);
296
-            } else {
297
-              iframeContainer.style.height = '300px';
298
-              that.minimized = false;
299
-              footerOverlay.style.display = 'none';
300
-              openButton.style.display = 'none';
301
-              closeButton.style.display = 'block';
302
-              setCookie(activeCampaign.cookieName, '{"minimized": false}',
303
-                widgetConfig.cookieTimeout);
304
-            }
305
-          };
306
-
307
-          footerOverlay.onclick = toggleDisplay;
308
-          closeButton.onclick = toggleDisplay;
309
-        } else {
310
-          that.fullSize = false;
311
-          var mobileCloseButton = document.createElement('button');
312
-          mobileCloseButton.style.cssText = style.mobileCloseButton;
313
-          iframeContainer.appendChild(mobileCloseButton);
314
-          debug(that.minimized);
315
-          if (that.minimized) {
316
-
317
-            mobileCloseButton.style.display = 'none';
318
-          } else {
319
-            mobileCloseButton.style.display = 'block';
320
-          }
321
-          mobileCloseButton.onclick = function () {
322
-            setCookie(activeCampaign.cookieName, '{"minimized": true}',
323
-              widgetConfig.cookieTimeout);
324
-            document.body.removeChild(campaignContainer);
325
-          };
326
-        }
327
-      },
328
-      init: function (config) {
329
-        activeCampaign.config = config;
330
-
331
-        var cookie = getCookie(activeCampaign.cookieName);
332
-        var that = this;
333
-
334
-        if (cookie) {
335
-          this.minimized = JSON.parse(cookie).minimized;
336
-        }
337
-
338
-        checks.correctDate(function (response) {
339
-          debug('correctDate() callback', response);
340
-
341
-          clearTimeout(window.dateCallBackFailSafe);
342
-
343
-          if (response && (response.activeToday ||
344
-              widgetConfig.disableDate || widgetConfig.debug)) {
345
-
346
-              activeCampaign.show({
347
-                location: null,
348
-                widgetConfig: widgetConfig
349
-              });
350
-
351
-            if (window.addEventListener) window.addEventListener('resize', function() {
352
-                var w = window,
353
-                  d = document,
354
-                  e = d.documentElement,
355
-                  g = d.getElementsByTagName('body')[0],
356
-                  x = w.innerWidth || e.clientWidth || g.clientWidth,
357
-                  y = w.innerHeight|| e.clientHeight|| g.clientHeight;
358
-               if((that.fullSize && x < 767) || (!that.fullSize && x > 767)) {
359
-                  if(window.tdwfbResizeCallback) {
360
-                    clearTimeout(window.tdwfbResizeCallback);
361
-                  }
362
-                  window.tdwfbResizeCallback = setTimeout(function () {
363
-                      that.show({location: window.tdwfbLocation, widgetConfig: widgetConfig});
364
-                      windowWidth = x;
365
-                  }, 50);
366
-                }
367
-            }, false);
368
-          }
369
-        });
370
-      }
371
-    }
372
-  };
373
-
374
-  // Load campaign if it exists
375
-  if (typeof campaign[widgetConfig.campaign] !== 'undefined') {
376
-    activeCampaign = campaign[widgetConfig.campaign];
377
-    activeCampaign.init(widgetConfig);
378
-  } else {
379
-    return false;
380
-  }
381
-})(window, _banner_config);
382 0
\ No newline at end of file
Browse code

Add original widget.js and widget.min.js sources

Sebastian Hahn authored on21/06/2016 01:53:30
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,381 @@
1
+/*
2
+
3
+     ______   ______   ______ 
4
+    |  ____| |  ____| |  ____|
5
+    | |__    | |__    | |__   
6
+    |  __|   |  __|   |  __|  
7
+    | |____  | |      | |     
8
+    |______| |_|      |_|     
9
+                              
10
+  =============================================================================
11
+
12
+  Support the NoGlobalWarrants.org campaign by installing this banner on your site.
13
+
14
+  <sina@eff.org> for support
15
+
16
+  =============================================================================
17
+
18
+  @source: https://github.com/EFForg/ngw-banner
19
+
20
+  @licstart  The following is the entire license notice for the
21
+             JavaScript code in this page.
22
+
23
+  Copyright (C) 2016 Electronic Frontier Foundation <https://eff.org>
24
+
25
+  The JavaScript code in this page is free software: you can
26
+  redistribute it and/or modify it under the terms of the GNU
27
+  General Public License (GNU GPL) as published by the Free Software
28
+  Foundation, either version 3 of the License, or (at your option) any
29
+  later version.  The code is distributed WITHOUT ANY WARRANTY;
30
+  without even the implied warranty of MERCHANTABILITY or FITNESS FOR
31
+  A PARTICULAR PURPOSE.  See the GNU GPL for more details.
32
+
33
+  As additional permission under GNU GPL version 3 section 7, you may
34
+  distribute non-source (e.g., minimized or compacted) forms of that
35
+  code without the copy of the GNU GPL normally required by section
36
+  4, provided you include this license notice and a URL through which
37
+  recipients can access the Corresponding Source.
38
+
39
+ @licend  The above is the entire license notice for the JavaScript
40
+          code in this page.
41
+
42
+*/
43
+
44
+// Wrap widget in function to protect scope
45
+var _banner_config = (typeof banner_config  !== 'undefined') ? banner_config  : {};
46
+
47
+(function (window, widgetConfig) {
48
+
49
+  // Do configuration
50
+  widgetConfig.show_style = widgetConfig.show_style || 'banner';
51
+  widgetConfig.debug = widgetConfig.debug || false;
52
+  widgetConfig.localAssets = widgetConfig.localAssets || false;
53
+  widgetConfig.callOnly = widgetConfig.callOnly || false;
54
+  widgetConfig.startAsMinimized = widgetConfig.startAsMinimized || false;
55
+  widgetConfig.disableDate = widgetConfig.disableDate || false;
56
+  widgetConfig.campaign = widgetConfig.campaign || 'noglobalwarrants';
57
+  widgetConfig.cookieTimeout = widgetConfig.cookieTimeout || null;
58
+
59
+  function debug() {
60
+    if (widgetConfig.debug) {
61
+      if (this.console) {
62
+        console.log.apply(console, arguments);
63
+      }
64
+    }
65
+  }
66
+
67
+  // Setup
68
+  var activeCampaign;
69
+  var ASSET_URL;
70
+
71
+  if (widgetConfig.localAssets) {
72
+    ASSET_URL = '../banner_content/';
73
+  } else {
74
+    ASSET_URL = 'https://www.eff.org/ngw/banner_content/';
75
+  }
76
+
77
+  // Cookie helpers, taken from w3schools
78
+  function setCookie(c_name, value, seconds) {
79
+    var exdate = new Date(new Date().getTime() + seconds * 1000);
80
+    var c_value = escape(value) + ((seconds === null) ? '' : '; expires=' +
81
+      exdate.toUTCString());
82
+    document.cookie = c_name + '=' + c_value;
83
+  }
84
+
85
+  function getCookie(c_name) {
86
+    var c_value = document.cookie;
87
+    var c_start = c_value.indexOf(' ' + c_name + '=');
88
+
89
+    if (c_start === -1) {
90
+      c_start = c_value.indexOf(c_name + '=');
91
+    }
92
+
93
+    if (c_start === -1) {
94
+      c_value = null;
95
+    } else {
96
+      c_start = c_value.indexOf('=', c_start) + 1;
97
+      var c_end = c_value.indexOf(';', c_start);
98
+      if (c_end === -1) { c_end = c_value.length; }
99
+      c_value = unescape(c_value.substring(c_start, c_end));
100
+    }
101
+
102
+    return c_value;
103
+  }
104
+
105
+  // Define checks
106
+  var checks = {
107
+    correctDate: function (callback) {
108
+      debug('correctDate()');
109
+
110
+      // This used to check the date by getting it from a server, but now just uses the device's local date.
111
+
112
+      window.dateCallBackFailSafe = setTimeout(function () {
113
+        var today = new Date();
114
+        if (today.getDate() === activeCampaign.runDate.day && today.getMonth() === activeCampaign.runDate.month - 1 && today.getFullYear() === activeCampaign.runDate.year) {
115
+          callback({activeToday: true});
116
+        } else {
117
+          callback({activeToday: false});
118
+        }
119
+      }, 1);
120
+    }
121
+  };
122
+
123
+  // Define campaigns
124
+  var campaign = {
125
+    noglobalwarrants: {
126
+      cookieName: 'noglobalwarrants_hasseen',
127
+      runDate: {
128
+        day: 21,
129
+        month: 6, // Use natural month, e.g. January = 1
130
+        year: 2016
131
+      },
132
+      size: {
133
+        desktop: {
134
+          heightOpened: '300px',
135
+          heightMinimized: '50px'
136
+        },
137
+        mobile: {
138
+          heightOpened: '100px',
139
+          heightMinimized: '0px'
140
+        }
141
+      },
142
+      styles: {
143
+        banner: {
144
+          campaignSpacer: 'height: 50px;',
145
+          campaignContainer: 'background: #000; position: fixed; ' +
146
+            'width: 100%; bottom: 0; left: 0; z-index: 100000; padding: 0; ' +
147
+            '-webkit-box-sizing: border-box; -moz-box-sizing: border-box;',
148
+          iframeContainer: 'position: relative; height: 350px; width: 100%; ' +
149
+            'margin: 0; background: #08A013; z-index: 1;',
150
+          iframe: 'width: 100%; height: 100%; border: 0; margin: 0; ' +
151
+            'padding: 0; background: #08A013;',
152
+          footerOverlay: 'cursor: pointer; position: absolute; bottom: 0; ' +
153
+            'height: 50px; width: 100%; margin: 0; background: none; ' +
154
+            'z-index: 2;',
155
+          closeButton: 'border: 0; height: 26px; width: 26px; ' +
156
+            'cursor: pointer; position: absolute; top: 20px; right: 20px; ' +
157
+            'background: url("' + ASSET_URL + 'imgs/close-button.png") no-repeat right top;',
158
+          mobileCloseButton: 'border: 0; height: 20px; width: 20px; ' +
159
+            'cursor: pointer; position: absolute;top: 10px; right: 10px; ' +
160
+            'background: url("' + ASSET_URL +
161
+            'imgs/close-button-mobile.png") no-repeat right top;',
162
+          openButton: 'border: 0; height: 26px; width: 26px; ' +
163
+            'cursor: pointer; position: absolute; bottom: 10px; ' +
164
+            'right: 20px; background: url("' + ASSET_URL +
165
+            'imgs/open-button.png") no-repeat right top;'
166
+        }
167
+      },
168
+      minimized: false,
169
+      show: function (options) {
170
+        debug('show()', options);
171
+
172
+        var cookie = getCookie(activeCampaign.cookieName);
173
+
174
+        if (widgetConfig.startAsMinimized && cookie === null) {
175
+          this.minimized = true;
176
+        }
177
+
178
+        var style = activeCampaign.styles[activeCampaign.config.show_style];
179
+
180
+        if (style.overlay) {
181
+          var overlay = document.createElement('div');
182
+          overlay.style.cssText = style.overlay;
183
+          document.body.appendChild(overlay);
184
+        }
185
+
186
+        // Create a spacer to prevent the container from covering up
187
+        // parts of the containing page when minimized
188
+
189
+        if(document.getElementById("campaign-spacer")){
190
+          document.body.removeChild(document.getElementById("campaign-spacer"));
191
+        }
192
+
193
+        if(document.getElementById("campaign-container")){
194
+          document.body.removeChild(document.getElementById("campaign-container"));
195
+        }
196
+
197
+        var campaignSpacer = document.createElement('div');
198
+        window.campaignSpacer = campaignSpacer;
199
+        campaignSpacer.style.cssText = style.campaignSpacer;
200
+        campaignSpacer.setAttribute("id", "campaign-spacer");
201
+        campaignSpacer.setAttribute("class", "campaign-spacer");
202
+        // Create a container
203
+        var campaignContainer = document.createElement('div');
204
+        window.campaignContainer = campaignContainer;
205
+        campaignContainer.style.cssText = style.campaignContainer;
206
+        campaignContainer.setAttribute("id", "campaign-container");
207
+        campaignContainer.setAttribute("class", "campaign-container");
208
+
209
+        // Create a container for the iframe so we can do padding and
210
+        // border-radius properly
211
+        var iframeContainer = document.createElement('div');
212
+
213
+        iframeContainer.style.cssText = style.iframeContainer;
214
+
215
+        var e = document.documentElement,
216
+            g = document.getElementsByTagName('body')[0],
217
+            x = window.innerWidth || e.clientWidth || g.clientWidth;
218
+
219
+        if (x < 767) {
220
+          if (!this.minimized) {
221
+            iframeContainer.style.height = '100px';
222
+          } else {
223
+            iframeContainer.style.height = '0px';
224
+          }
225
+        } else {
226
+          // Find out if user has minimized via cookie
227
+          if (this.minimized) {
228
+            iframeContainer.style.height = '50px';
229
+          } else {
230
+            iframeContainer.style.height = activeCampaign.size.desktop.heightOpened;
231
+          }
232
+          var footerOverlay = document.createElement('div');
233
+          footerOverlay.style.cssText = style.footerOverlay;
234
+          campaignContainer.appendChild(footerOverlay);
235
+        }
236
+
237
+        // Append Iframe and campaign container to document
238
+        campaignContainer.appendChild(iframeContainer);
239
+
240
+        document.body.appendChild(campaignSpacer);
241
+        document.body.appendChild(campaignContainer);
242
+
243
+        var firstTime = true;
244
+
245
+        if (cookie !== null) {
246
+          firstTime = false;
247
+        }
248
+
249
+        // a Hack, if mobile set firsttime to false so splash page never shows
250
+        if (x < 767) {
251
+          firstTime = false;
252
+        }
253
+
254
+        var iframe = document.createElement('iframe');
255
+
256
+        iframe.style.cssText = style.iframe;
257
+
258
+        var us = iframe.src = ASSET_URL + activeCampaign.config.show_style +
259
+          '.html?firstTime=' + firstTime;
260
+
261
+        iframeContainer.appendChild(iframe);
262
+
263
+        var that = this;
264
+
265
+        if (x > 767) {
266
+          that.fullSize = true;
267
+          // Setup a close button
268
+          var closeButton = document.createElement('button');
269
+          closeButton.style.cssText = style.closeButton;
270
+          iframeContainer.appendChild(closeButton);
271
+
272
+          // Setup a open button
273
+          var openButton = document.createElement('button');
274
+          openButton.style.cssText = style.openButton;
275
+          iframeContainer.appendChild(openButton);
276
+
277
+          if (this.minimized) {
278
+            openButton.style.display = 'block';
279
+            closeButton.style.display = 'none';
280
+            footerOverlay.style.display = 'block';
281
+          } else {
282
+            openButton.style.display = 'none';
283
+            closeButton.style.display = 'block';
284
+            footerOverlay.style.display = 'none';
285
+          }
286
+
287
+          var toggleDisplay = function () {
288
+            if (!that.minimized) {
289
+              iframeContainer.style.height = '50px';
290
+              that.minimized = true;
291
+              footerOverlay.style.display = 'block';
292
+              closeButton.style.display = 'none';
293
+              openButton.style.display = 'block';
294
+              setCookie(activeCampaign.cookieName, '{"minimized": true}',
295
+                widgetConfig.cookieTimeout);
296
+            } else {
297
+              iframeContainer.style.height = '300px';
298
+              that.minimized = false;
299
+              footerOverlay.style.display = 'none';
300
+              openButton.style.display = 'none';
301
+              closeButton.style.display = 'block';
302
+              setCookie(activeCampaign.cookieName, '{"minimized": false}',
303
+                widgetConfig.cookieTimeout);
304
+            }
305
+          };
306
+
307
+          footerOverlay.onclick = toggleDisplay;
308
+          closeButton.onclick = toggleDisplay;
309
+        } else {
310
+          that.fullSize = false;
311
+          var mobileCloseButton = document.createElement('button');
312
+          mobileCloseButton.style.cssText = style.mobileCloseButton;
313
+          iframeContainer.appendChild(mobileCloseButton);
314
+          debug(that.minimized);
315
+          if (that.minimized) {
316
+
317
+            mobileCloseButton.style.display = 'none';
318
+          } else {
319
+            mobileCloseButton.style.display = 'block';
320
+          }
321
+          mobileCloseButton.onclick = function () {
322
+            setCookie(activeCampaign.cookieName, '{"minimized": true}',
323
+              widgetConfig.cookieTimeout);
324
+            document.body.removeChild(campaignContainer);
325
+          };
326
+        }
327
+      },
328
+      init: function (config) {
329
+        activeCampaign.config = config;
330
+
331
+        var cookie = getCookie(activeCampaign.cookieName);
332
+        var that = this;
333
+
334
+        if (cookie) {
335
+          this.minimized = JSON.parse(cookie).minimized;
336
+        }
337
+
338
+        checks.correctDate(function (response) {
339
+          debug('correctDate() callback', response);
340
+
341
+          clearTimeout(window.dateCallBackFailSafe);
342
+
343
+          if (response && (response.activeToday ||
344
+              widgetConfig.disableDate || widgetConfig.debug)) {
345
+
346
+              activeCampaign.show({
347
+                location: null,
348
+                widgetConfig: widgetConfig
349
+              });
350
+
351
+            if (window.addEventListener) window.addEventListener('resize', function() {
352
+                var w = window,
353
+                  d = document,
354
+                  e = d.documentElement,
355
+                  g = d.getElementsByTagName('body')[0],
356
+                  x = w.innerWidth || e.clientWidth || g.clientWidth,
357
+                  y = w.innerHeight|| e.clientHeight|| g.clientHeight;
358
+               if((that.fullSize && x < 767) || (!that.fullSize && x > 767)) {
359
+                  if(window.tdwfbResizeCallback) {
360
+                    clearTimeout(window.tdwfbResizeCallback);
361
+                  }
362
+                  window.tdwfbResizeCallback = setTimeout(function () {
363
+                      that.show({location: window.tdwfbLocation, widgetConfig: widgetConfig});
364
+                      windowWidth = x;
365
+                  }, 50);
366
+                }
367
+            }, false);
368
+          }
369
+        });
370
+      }
371
+    }
372
+  };
373
+
374
+  // Load campaign if it exists
375
+  if (typeof campaign[widgetConfig.campaign] !== 'undefined') {
376
+    activeCampaign = campaign[widgetConfig.campaign];
377
+    activeCampaign.init(widgetConfig);
378
+  } else {
379
+    return false;
380
+  }
381
+})(window, _banner_config);
0 382
\ No newline at end of file