PageSourceSearch

https://asset2.cdn.bulkreefsupply.com/static/version369d8c3588d5b6…/js/smartbanner.1.25.0.min.js

js bulkreefsupply.com collected 2026-09-25 02:35:30 UTC 16,250 bytes, 58 lines download raw bytes

1/*!
2 * smartbanner.js v1.25.0 <https://github.com/ain/smartbanner.js#readme>
3 * Copyright © 2024 Ain Tohvri, contributors. Licensed under GPL-3.0.
4 */
5(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;i<t.length;i++)o(t[i]);return o}return r})()({1:[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);}
6function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}
7function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}
8function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}
9function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}
10function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}
11var Bakery=exports["default"]=function(){function Bakery(){_classCallCheck(this,Bakery);}
12return _createClass(Bakery,null,[{key:"getCookieExpiresString",value:function getCookieExpiresString(hideTtl){var now=new Date();var expireTime=new Date(now.getTime()+hideTtl);return"expires=".concat(expireTime.toGMTString(),";");}},{key:"bake",value:function bake(hideTtl,hidePath){document.cookie="smartbanner_exited=1; ".concat(hideTtl?Bakery.getCookieExpiresString(hideTtl):''," path=").concat(hidePath);}},{key:"unbake",value:function unbake(){document.cookie='smartbanner_exited=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';}},{key:"baked",get:function get(){var value=document.cookie.replace(/(?:(?:^|.*;\s*)smartbanner_exited\s*=\s*([^;]*).*$)|^.*$/,'$1');return value==='1';}}]);}();},{}],2:[function(require,module,exports){(function(global){(function(){"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);}
13function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}
14function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}
15function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}
16function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}
17function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}
18var Detector=exports["default"]=function(){function Detector(){_classCallCheck(this,Detector);}
19return _createClass(Detector,null,[{key:"platform",value:function platform(){var maxTouchPoints=window.navigator.maxTouchPoints;var userAgent=window.navigator.userAgent;if(/Android/i.test(userAgent)){return'android';}else if(!window.MSStream&&!/X11|Linux|Windows/i.test(userAgent)&&maxTouchPoints&&maxTouchPoints>0||/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);}}]);}();}).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"));
19function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e};}
20var 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);}
21function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}
22function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}
23function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}
24function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}
25function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}
26function valid(name){return name.indexOf('smartbanner:')!==-1&&name.split(':')[1].length>0;}
27function 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('');}
28var OptionParser=exports["default"]=function(){function OptionParser(){_classCallCheck(this,OptionParser);}
29return _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);}
30options[optionName]=content;}});return options;}}]);}();},{}],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(e){return e&&e.__esModule?e:{"default":e};}
31function _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);}
32function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}
33function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}
34function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}
35function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}
36function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}
37var DEFAULT_PLATFORMS='android,ios';var DEFAULT_CLOSE_LABEL='Close';var DEFAULT_BUTTON_LABEL='View';var datas={originalTop:'data-smartbanner-original-top',originalMarginTop:'data-smartbanner-original-margin-top'};function handleExitClick(event,self){self.exit();event.preventDefault();}
38function handleClickout(event,self){self.clickout();}
39function handleJQueryMobilePageLoad(event){if(!this.positioningDisabled){setContentPosition(event.data.height);}}
40function addEventListeners(self){var closeIcon=document.querySelector('.js_smartbanner__exit');closeIcon.addEventListener('click',function(event){return handleExitClick(event,self);});var button=document.querySelector('.js_smartbanner__button');button.addEventListener('click',function(event){return handleClickout(event,self);});if(_detector["default"].jQueryMobilePage()){$(document).on('pagebeforeshow',self,handleJQueryMobilePageLoad);}}
41function removeEventListeners(){if(_detector["default"].jQueryMobilePage()){$(document).off('pagebeforeshow',handleJQueryMobilePageLoad);}}
42function setContentPosition(value){var wrappers=_detector["default"].wrapperElement();for(var i=0,l=wrappers.length,wrapper;i<l;i++){wrapper=wrappers[i];if(_detector["default"].jQueryMobilePage()){if(wrapper.getAttribute(datas.originalTop)){continue;}
43var top=parseFloat(getComputedStyle(wrapper).top);wrapper.setAttribute(datas.originalTop,isNaN(top)?0:top);wrapper.style.top=value+'px';}else{if(wrapper.getAttribute(datas.originalMarginTop)){continue;}
44var margin=parseFloat(getComputedStyle(wrapper).marginTop);wrapper.setAttribute(datas.originalMarginTop,isNaN(margin)?0:margin);wrapper.style.marginTop=value+'px';}}}
45function restoreContentPosition(){var wrappers=_detector["default"].wrapperElement();for(var i=0,l=wrappers.length,wrapper;i<l;i++){wrapper=wrappers[i];if(_detector["default"].jQueryMobilePage()&&wrapper.getAttribute(datas.originalTop)){wrapper.style.top=wrapper.getAttribute(datas.originalTop)+'px';}else if(wrapper.getAttribute(datas.originalMarginTop)){wrapper.style.marginTop=wrapper.getAttribute(datas.originalMarginTop)+'px';}}}
46var SmartBanner=exports["default"]=function(){function SmartBanner(){_classCallCheck(this,SmartBanner);var parser=new _optionparser["default"]();this.options=parser.parse();this.platform=_detector["default"].platform();var event=new Event('smartbanner.init');document.dispatchEvent(event);}
47return _createClass(SmartBanner,[{key:"originalTop",get:function get(){var wrapper=_detector["default"].wrapperElement()[0];return parseFloat(wrapper.getAttribute(datas.originalTop));}},{key:"originalTopMargin",get:function get(){var wrapper=_detector["default"].wrapperElement()[0];return parseFloat(wrapper.getAttribute(datas.originalMarginTop));}}
47,{key:"priceSuffix",get:function get(){if(this.platform==='ios'&&this.options.priceSuffixApple){return this.options.priceSuffixApple;}else if(this.platform==='android'&&this.options.priceSuffixGoogle){return this.options.priceSuffixGoogle;}
48return'';}},{key:"price",get:function get(){if(this.options.price&&this.options.price!==''){return this.options.price;}else{return'';}}},{key:"icon",get:function get(){if(this.platform==='android'){return this.options.iconGoogle;}else{return this.options.iconApple;}}},{key:"buttonUrl",get:function get(){if(this.platform==='android'){return this.options.buttonUrlGoogle;}else if(this.platform==='ios'){return this.options.buttonUrlApple;}
49return'#';}},{key:"closeLabel",get:function get(){return this.options.closeLabel!==undefined?this.options.closeLabel:DEFAULT_CLOSE_LABEL;}},{key:"buttonLabel",get:function get(){var buttonLabel=this.options.button;if(this.platform==='android'&&this.options.buttonGoogle){buttonLabel=this.options.buttonGoogle;}else if(this.platform==='ios'&&this.options.buttonApple){buttonLabel=this.options.buttonApple;}
50return buttonLabel||DEFAULT_BUTTON_LABEL;}},{key:"html",get:function get(){var modifier=!this.options.customDesignModifier?this.platform:this.options.customDesignModifier;return"<div class=\"smartbanner smartbanner--".concat(modifier," js_smartbanner\">\n      <a href=\"#\" class=\"smartbanner__exit js_smartbanner__exit\" title=\"").concat(this.closeLabel,"\" rel=\"nofollow\"></a>\n      <div class=\"smartbanner__icon\" style=\"background-image: url(").concat(this.icon,");\"></div>\n      <div class=\"smartbanner__info\">\n        <div>\n          <div class=\"smartbanner__info__title\">").concat(this.options.title,"</div>\n          <div class=\"smartbanner__info__author\">").concat(this.options.author,"</div>\n          <div class=\"smartbanner__info__price\">").concat(this.price).concat(this.priceSuffix,"</div>\n        </div>\n      </div>\n      <a href=\"").concat(this.buttonUrl,"\" target=\"_blank\" class=\"smartbanner__button js_smartbanner__button\" rel=\"noopener\" aria-label=\"").concat(this.buttonLabel,"\"><span class=\"smartbanner__button__label\">").concat(this.buttonLabel,"</span></a>\n    </div>");}},{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;}
51return _detector["default"].userAgentMatchesRegex(this.options.excludeUserAgentRegex);}},{key:"userAgentIncluded",get:function get(){if(!this.options.includeUserAgentRegex){return false;}
52return _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.');}
53if(_bakery["default"].baked){return false;}
54if(this.userAgentExcluded){return false;}
55if(!(this.platformEnabled||this.userAgentIncluded)){return false;}
56var 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);}
57addEventListeners(this);}},{key:"exit",value:function exit(){removeEventListeners();if(!this.positioningDisabled){restoreContentPosition();}
58var 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);}}]);}();},{"./bakery.js":1,"./detector.js":2,"./optionparser.js":4}]},{},[3]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.