/*! * smartbanner.js v1.24.1 * Copyright © 2024 Ain Tohvri, contributors. Licensed under GPL-3.0. */ (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i0||/iPhone|iPad|iPod/i.test(userAgent)){return"ios"}}},{key:"userAgentMatchesRegex",value:function userAgentMatchesRegex(regexString){return new RegExp(regexString).test(window.navigator.userAgent)}},{key:"jQueryMobilePage",value:function jQueryMobilePage(){return typeof global.$!=="undefined"&&global.$.mobile!=="undefined"&&document.querySelector(".ui-page")!==null}},{key:"wrapperElement",value:function wrapperElement(){var selector=Detector.jQueryMobilePage()?".ui-page":"html";return document.querySelectorAll(selector)}}]);return Detector}()}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],3:[function(require,module,exports){"use strict";var _smartbanner=_interopRequireDefault(require("./smartbanner.js"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var smartbanner;window.addEventListener("load",function(){smartbanner=new _smartbanner["default"];if(smartbanner.apiEnabled){window.smartbanner=smartbanner}else{smartbanner.publish()}})},{"./smartbanner.js":5}],4:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i0}function convertToCamelCase(name){var parts=name.split("-");parts.map(function(part,index){if(index>0){parts[index]=part.charAt(0).toUpperCase()+part.substring(1)}});return parts.join("")}var OptionParser=exports["default"]=function(){function OptionParser(){_classCallCheck(this,OptionParser)}_createClass(OptionParser,[{key:"parse",value:function parse(){var metas=document.getElementsByTagName("meta");var options={};Array.apply(null,metas).forEach(function(meta){var optionName=null;var name=meta.getAttribute("name");var content=meta.getAttribute("content");if(name&&content&&valid(name)&&content.length>0){optionName=name.split(":")[1];if(optionName.indexOf("-")!==-1){optionName=convertToCamelCase(optionName)}options[optionName]=content}});return options}}]);return OptionParser}()},{}],5:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _optionparser=_interopRequireDefault(require("./optionparser.js"));var _detector=_interopRequireDefault(require("./detector.js"));var _bakery=_interopRequireDefault(require("./bakery.js"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i\n \n
\n
\n
\n
').concat(this.options.title,'
\n
').concat(this.options.author,'
\n
').concat(this.price).concat(this.priceSuffix,'
\n
\n
\n ').concat(this.buttonLabel,"\n ")}},{key:"height",get:function get(){try{return document.querySelector(".js_smartbanner").offsetHeight}catch(error){return 0}}},{key:"platformEnabled",get:function get(){var enabledPlatforms=this.options.enabledPlatforms||DEFAULT_PLATFORMS;return enabledPlatforms&&enabledPlatforms.replace(/\s+/g,"").split(",").indexOf(this.platform)!==-1}},{key:"positioningDisabled",get:function get(){return this.options.disablePositioning==="true"}},{key:"apiEnabled",get:function get(){return this.options.api==="true"||this.options.api==="yes"}},{key:"userAgentExcluded",get:function get(){if(!this.options.excludeUserAgentRegex){return false}return _detector["default"].userAgentMatchesRegex(this.options.excludeUserAgentRegex)}},{key:"userAgentIncluded",get:function get(){if(!this.options.includeUserAgentRegex){return false}return _detector["default"].userAgentMatchesRegex(this.options.includeUserAgentRegex)}},{key:"hideTtl",get:function get(){return this.options.hideTtl?parseInt(this.options.hideTtl):false}},{key:"hidePath",get:function get(){return this.options.hidePath?this.options.hidePath:"/"}},{key:"publish",value:function publish(){if(Object.keys(this.options).length===0){throw new Error("No options detected. Please consult documentation.")}if(_bakery["default"].baked){return false}if(this.userAgentExcluded){return false}if(!(this.platformEnabled||this.userAgentIncluded)){return false}var bannerDiv=document.createElement("div");document.querySelector("body").prepend(bannerDiv);bannerDiv.outerHTML=this.html;var event=new Event("smartbanner.view");document.dispatchEvent(event);if(!this.positioningDisabled){setContentPosition(this.height)}addEventListeners(this)}},{key:"exit",value:function exit(){removeEventListeners();if(!this.positioningDisabled){restoreContentPosition()}var banner=document.querySelector(".js_smartbanner");document.querySelector("body").removeChild(banner);var event=new Event("smartbanner.exit");document.dispatchEvent(event);_bakery["default"].bake(this.hideTtl,this.hidePath)}},{key:"clickout",value:function clickout(){var event=new Event("smartbanner.clickout");document.dispatchEvent(event)}}]);return SmartBanner}()},{"./bakery.js":1,"./detector.js":2,"./optionparser.js":4}]},{},[3]);