Update smartbanner js file
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 16 Nov 2017 16:07:13 +0000 (11:07 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 16 Nov 2017 16:07:13 +0000 (11:07 -0500)
Use current version

assets/smartbanner/smartbanner.js

index d495cc1..5733d44 100644 (file)
@@ -1,5 +1,5 @@
 /*!
- * smartbanner.js v1.5.0 <https://github.com/ain/smartbanner.js>
+ * smartbanner.js v1.8.0 <https://github.com/ain/smartbanner.js>
  * Copyright © 2017 Ain Tohvri, contributors. Licensed under GPL-3.0.
  */
 (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
@@ -19,9 +19,16 @@ var Bakery = function () {
   }
 
   _createClass(Bakery, null, [{
+    key: 'getCookieExpiresString',
+    value: function getCookieExpiresString(hideTtl) {
+      var now = new Date();
+      var expireTime = new Date(now.getTime() + hideTtl);
+      return 'expires=' + expireTime.toGMTString() + ';';
+    }
+  }, {
     key: 'bake',
-    value: function bake() {
-      document.cookie = 'smartbanner_exited=1';
+    value: function bake(hideTtl) {
+      document.cookie = 'smartbanner_exited=1; ' + (hideTtl ? Bakery.getCookieExpiresString(hideTtl) : '');
     }
   }, {
     key: 'unbake',
@@ -437,7 +444,7 @@ var SmartBanner = function () {
       }
       var banner = document.querySelector('.js_smartbanner');
       document.querySelector('body').removeChild(banner);
-      _bakery2.default.bake();
+      _bakery2.default.bake(this.hideTtl);
     }
   }, {
     key: 'originalTop',
@@ -486,7 +493,8 @@ var SmartBanner = function () {
   }, {
     key: 'html',
     get: function get() {
-      return '<div class="smartbanner smartbanner--' + this.platform + ' js_smartbanner">\n      <a href="javascript:void();" class="smartbanner__exit js_smartbanner__exit"></a>\n      <div class="smartbanner__icon" style="background-image: url(' + this.icon + ');"></div>\n      <div class="smartbanner__info">\n        <div>\n          <div class="smartbanner__info__title">' + this.options.title + '</div>\n          <div class="smartbanner__info__author">' + this.options.author + '</div>\n          <div class="smartbanner__info__price">' + this.options.price + this.priceSuffix + '</div>\n        </div>\n      </div>\n      <a href="' + this.buttonUrl + '" target="_blank" class="smartbanner__button"><span class="smartbanner__button__label">' + this.options.button + '</span></a>\n    </div>';
+      var modifier = !this.options.customDesignModifier ? this.platform : this.options.customDesignModifier;
+      return '<div class="smartbanner smartbanner--' + modifier + ' js_smartbanner">\n      <a href="javascript:void();" class="smartbanner__exit js_smartbanner__exit"></a>\n      <div class="smartbanner__icon" style="background-image: url(' + this.icon + ');"></div>\n      <div class="smartbanner__info">\n        <div>\n          <div class="smartbanner__info__title">' + this.options.title + '</div>\n          <div class="smartbanner__info__author">' + this.options.author + '</div>\n          <div class="smartbanner__info__price">' + this.options.price + this.priceSuffix + '</div>\n        </div>\n      </div>\n      <a href="' + this.buttonUrl + '" target="_blank" class="smartbanner__button"><span class="smartbanner__button__label">' + this.options.button + '</span></a>\n    </div>';
     }
   }, {
     key: 'height',
@@ -521,6 +529,11 @@ var SmartBanner = function () {
       }
       return _detector2.default.userAgentMatchesRegex(this.options.includeUserAgentRegex);
     }
+  }, {
+    key: 'hideTtl',
+    get: function get() {
+      return this.options.hideTtl ? parseInt(this.options.hideTtl) : false;
+    }
   }]);
 
   return SmartBanner;