if (!window.va_use_frame && window.viimo_carousel_setup){ var tns = (function (){ // keys if (!Object.keys) { Object.keys = function (object) { var keys = []; for (var name in object) { if (Object.prototype.hasOwnProperty.call(object, name)) { keys.push(name); } } return keys; }; } // ChildNode.remove (function () { "use strict"; if(!("remove" in Element.prototype)){ Element.prototype.remove = function(){ if(this.parentNode) { this.parentNode.removeChild(this); } }; } })(); var win = window; var raf = win.requestAnimationFrame || win.webkitRequestAnimationFrame || win.mozRequestAnimationFrame || win.msRequestAnimationFrame || function(cb) { return setTimeout(cb, 16); }; var win$1 = window; var caf = win$1.cancelAnimationFrame || win$1.mozCancelAnimationFrame || function(id){ clearTimeout(id); }; function extend() { var obj, name, copy, target = arguments[0] || {}, i = 1, length = arguments.length; for (; i < length; i++) { if ((obj = arguments[i]) !== null) { for (name in obj) { copy = obj[name]; if (target === copy) { continue; } else if (copy !== undefined) { target[name] = copy; } } } } return target; } function checkStorageValue (value) { return ['true', 'false'].indexOf(value) >= 0 ? JSON.parse(value) : value; } function setLocalStorage(key, value, access) { if (access) { localStorage.setItem(key, value); } return value; } function getSlideId() { var id = window.tnsId; window.tnsId = !id ? 1 : id + 1; return 'tns' + window.tnsId; } function getBody () { var doc = document, body = doc.body; if (!body) { body = doc.createElement('body'); body.fake = true; } return body; } var docElement = document.documentElement; function setFakeBody (body) { var docOverflow = ''; if (body.fake) { docOverflow = docElement.style.overflow; //avoid crashing IE8, if background image is used body.style.background = ''; //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible body.style.overflow = docElement.style.overflow = 'hidden'; docElement.appendChild(body); } return docOverflow; } function resetFakeBody (body, docOverflow) { if (body.fake) { body.remove(); docElement.style.overflow = docOverflow; // Trigger layout so kinetic scrolling isn't disabled in iOS6+ // eslint-disable-next-line docElement.offsetHeight; } } // get css-calc function calc() { var doc = document, body = getBody(), docOverflow = setFakeBody(body), div = doc.createElement('div'), result = false; body.appendChild(div); try { var str = '(10px * 10)', vals = ['calc' + str, '-moz-calc' + str, '-webkit-calc' + str], val; for (var i = 0; i < 3; i++) { val = vals[i]; div.style.width = val; if (div.offsetWidth === 100) { result = val.replace(str, ''); break; } } } catch (e) {} body.fake ? resetFakeBody(body, docOverflow) : div.remove(); return result; } // get subpixel support value function percentageLayout() { // check subpixel layout supporting var doc = document, body = getBody(), docOverflow = setFakeBody(body), wrapper = doc.createElement('div'), outer = doc.createElement('div'), str = '', count = 70, perPage = 3, supported = false; wrapper.className = "tns-t-subp2"; outer.className = "tns-t-ct"; for (var i = 0; i < count; i++) { str += '
'; } outer.innerHTML = str; wrapper.appendChild(outer); body.appendChild(wrapper); supported = Math.abs(wrapper.getBoundingClientRect().left - outer.children[count - perPage].getBoundingClientRect().left) < 2; body.fake ? resetFakeBody(body, docOverflow) : wrapper.remove(); return supported; } function mediaquerySupport () { var doc = document, body = getBody(), docOverflow = setFakeBody(body), div = doc.createElement('div'), style = doc.createElement('style'), rule = '@media all and (min-width:1px){.tns-mq-test{position:absolute}}', position; style.type = 'text/css'; div.className = 'tns-mq-test'; body.appendChild(style); body.appendChild(div); if (style.styleSheet) { style.styleSheet.cssText = rule; } else { style.appendChild(doc.createTextNode(rule)); } position = window.getComputedStyle ? window.getComputedStyle(div).position : div.currentStyle['position']; body.fake ? resetFakeBody(body, docOverflow) : div.remove(); return position === "absolute"; } // create and append style sheet function createStyleSheet (media) { // Create the "; } unit_filer_code += unit_data.unit_filler.ad_code; } unit_code = unit_code.replace(/\$\$va_format\$\$/g, unit_format); unit_code = unit_code.replace(/\$\$unit_filler_ad\$\$/g, unit_filer_code); unit_code = unit_code.replace(/\$\$va_terms\$\$/g, vimo_14567611971.page.keywords().replace(/'/g, " ")); if (vimo_14567611971.preload && vimo_14567611971.preload.search_term_to_use != null){ unit_code = unit_code.replace(/\$\$va_search_terms\$\$/g, vimo_14567611971.preload.search_term_to_use); unit_code = unit_code.replace(/%24%24va_search_terms%24%24/g, vimo_14567611971.preload.search_term_to_use); } else{ unit_code = unit_code.replace(/\$\$va_search_terms\$\$/g, vimo_14567611971.page.keywords().replace(/'/g, " ")); unit_code = unit_code.replace(/%24%24va_search_terms%24%24/g, vimo_14567611971.page.keywords().replace(/'/g, " ")); } unit_code = unit_code.replace(/\$\$va_keywords\$\$/g, vimo_14567611971.page.keywords().replace(/'/g, " ")); unit_code = unit_code.replace(/\$\$va_sid\$\$/g, vimo_14567611971.layer.get_sid()); unit_code = unit_code.replace(/\$\$va_url\$\$/g, escape(document.location)); unit_code = unit_code.replace(/\$\$va_domain\$\$/g, escape(vimo_14567611971.page.domain())); unit_code = unit_code.replace(/\$\$va_title\$\$/g, document.title.replace(/'/g, " ")); unit_code = unit_code.replace(/\$\$va_cid\$\$/g, cid); unit_code = unit_code.replace(/\$\$va_image\$\$/g, "true"); var next_tier = "1"; if (vimo_14567611971.settings.curr_tier){ next_tier = (vimo_14567611971.settings.curr_tier+1).toString() } unit_code = unit_code.replace(/\$\va_next_tier\$\$/g, next_tier); unit_code = unit_code.replace(/\$\va_curr_test\$\$/g, curr_test); if (curr_unit_id && curr_unit_id != null){ unit_code = unit_code.replace(/\$\$va_curr_unit_id\$\$/g, curr_unit_id); } else{ unit_code = unit_code.replace(/\$\$va_curr_unit_id\$\$/g, ""); } if (wrap_code){ unit_code = ""+unit_code +"" } //vimo_14567611971.layer.layer_width = width+10; bug with location of tip //vimo_14567611971.layer.layer_height = height+39; if (frame == null){ frame = document.createElement('iframe'); if (frame.watch){ frame.watch('src',vimo_14567611971_prevent_change); } if(frame_container.className == "vimo_14567611971_footer"){ frame.className = 'footer_frame'; }else{ frame.className = 'flip_frame'; } frame_container.appendChild(frame); } vimo_14567611971.layer.set_iframe(frame, unit_code, width, height); } else { if (origin_unit_code != null && origin_unit_code.length > 0){ if (append_container){ var container_div = document.createElement('div'); container_div.className = "fyva_container"; container_div.innerHTML = origin_unit_code; frame_container.appendChild(container_div); } else{ frame_container.innerHTML = origin_unit_code; } } } } } else{ var curr_unit_id = null; if (window.va_curr_unit_id){ curr_unit_id = window.va_curr_unit_id; } if (curr_unit_id != 993 && curr_unit_id != 999 && curr_unit_id != 998 && curr_unit_id != 997 && curr_unit_id != 994){ var params = ''; var tr = "0"; if (origin_unit_code != null && origin_unit_code.length > 0){ // = document.getElementById("vimo_14567611971_layer_frame_c") if (origin_unit_code.startsWith(":eval:")){ origin_unit_code = origin_unit_code.replace(":eval:", "") eval(origin_unit_code); return; } } var sub_id = vimo_14567611971.layer.get_sub_id(); var sub_id_str = ""; if (sub_id != ''){ sub_id_str = "&subid=" + sub_id; } var unit_marker = vimo_14567611971.layer.unit_marker(); if (unit_marker != ''){ sub_id_str = sub_id_str + "&um=" + unit_marker; } var unit_code_url = vimo_14567611971.utils.protocol() +'//srv.imonomy.com/internal/serve?rf=framede&format=' + unit_format +'&img=true&tr=' + tr + '&sid=' + vimo_14567611971.layer.get_sid() + '&cid=' + cid + '&isps=' + vimo_14567611971.layer.shopping_site() + '&terms=' + escape(vimo_14567611971.page.keywords().replace(/'/g, " ")) + '&keywords='+escape(vimo_14567611971.page.keywords())+'&dm=' + escape(vimo_14567611971.page.domain()) + '&ttl=' + document.title.replace(/'/g, " ") + sub_id_str; if (curr_unit_id != null){ unit_code_url = unit_code_url + '&uid=' + curr_unit_id; } if (frame == null){ frame = document.createElement('iframe'); frame.className = 'flip_frame'; frame_container.appendChild(frame); } //ifrm = document.getElementById("vimo_14567611971_layer_frame") vimo_14567611971.layer.set_iframe(frame, null, width, height); frame.setAttribute("src", unit_code_url); if (frame.watch){ frame.watch('src',vimo_14567611971_prevent_change); } } } }, setCookie: function(c_name,value,exmilisec, path, cross_domain) { var exdate= null; if (exmilisec != null){ exdate=new Date(); exdate.setTime(exdate.getTime() + exmilisec); } var c_value=escape(value) + ((exmilisec==null) ? "" : "; expires="+exdate.toUTCString())+ ((path==null || typeof(path) == 'undefined') ? "" : "; path="+path); document.cookie=c_name + "=" + c_value; if (cross_domain){ var exmin = exmilisec/1000/60; var params = "exp="+exmin+"&ap=false&nm="+c_name+"&vl=" + escape(value); vimo_14567611971.preload.injectScript(vimo_14567611971.utils.protocol() +'//srv.imonomy.com/cookies/create.js?' + params); } }, getCookie : function(c_name) { if (document.cookie.length > 0) { var c_start = document.cookie.indexOf(c_name + "="); if (c_start != -1) { c_start = c_start + c_name.length + 1; c_end = document.cookie.indexOf(";", c_start); if (c_end == -1) c_end = document.cookie.length; return unescape(document.cookie.substring(c_start, c_end)); } } return ""; }, browser : { browser_type: "", version_id: "", type: function(){ if (this.browser_type == "") this.browser_type = this.searchString(this.dataBrowser) || "Unknown-Browser"; return this.browser_type; }, version: function(){ if (this.version_id == "") this.version_id = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion); return this.version_id; }, searchString: function(data) { for (var i = 0; i < data.length; i++) { var dataString = data[i].string; var dataProp = data[i].prop; this.versionSearchString = data[i].versionSearch || data[i].identity; if (dataString) { if (dataString.indexOf(data[i].subString) != -1) return data[i].identity; } else if (dataProp) return data[i].identity; } }, searchVersion: function(dataString) { var index = dataString.indexOf(this.versionSearchString); if (index == -1) { index = dataString.indexOf("rv"); // for IE 11 version search if (index == -1) return; return parseFloat(dataString.substring(index + 3)); // 3 represnt the length of the string "rv" + 1 } return parseFloat(dataString.substring(index + this.versionSearchString.length + 1)); }, dataBrowser: [ { string: navigator.vendor, subString: "Apple", identity: "Safari" }, { prop: window.opera, identity: "Opera" }, { string: navigator.userAgent, subString: "Firefox", identity: "Firefox" }, { string: navigator.userAgent, subString: "MSIE", identity: "Explorer", versionSearch: "MSIE" }, { string: navigator.userAgent, subString: "Trident", identity: "Explorer", versionSearch: "MSIE" }, { string: navigator.userAgent, subString: "Chrome", identity: "Chrome" } ] }, isRTL: function (){ styleProp = 'direction'; el = 'vimo_14567611971_layer'; var x = document.getElementById(el) || document.body; if (x.currentStyle) var y = x.currentStyle[styleProp]; else if (window.getComputedStyle) var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp); return y == 'rtl'; }, isIE: function(){ return vimo_14567611971.utils.browser.type() == "Explorer"; }, isAndroid: function() { return navigator.userAgent.match(/Android/i); }, isBlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i); }, isiOS: function() { return navigator.userAgent.match(/iPhone|iPad|iPod/i); }, isOperaMobile: function() { return navigator.userAgent.match(/Opera Mini/i); }, isWindowsMobile: function() { return navigator.userAgent.match(/IEMobile/i); }, isMobile: function() { return (vimo_14567611971.utils.isAndroid() || vimo_14567611971.utils.isBlackBerry() || vimo_14567611971.utils.isiOS() || vimo_14567611971.utils.isOperaMobile() || vimo_14567611971.utils.isWindowsMobile()); }, hasClass: function(el, cssClass, check_parent) { var has_class = el.className && new RegExp("(^|\\s)" + cssClass + "(\\s|$)").test(el.className); if (!has_class && check_parent && el.parentNode){ has_class = vimo_14567611971.utils.hasClass(el.parentNode, cssClass, check_parent); } return has_class; }, isDescendantFromId: function(el, id) { var has_id = el.id == id; if (!has_id && el.parentNode){ has_id = vimo_14567611971.utils.isDescendantFromId(el.parentNode, id); } return has_id; }, unbind: function (event, action, element) { if (element == null){ return; } if (element.removeEventListener) { element.removeEventListener(event, action, false); // Bad citizens. } else if (element.detachEvent) { element.detachEvent('on'+event, action); } else{ if (event == 'mousedown'){ element.onmousedown = null; } else if (event == 'mouseenter'){ element.onmouseenter = null; } else if (event == 'mouseleave'){ element.onmouseleave = null; } else if (event == 'mouseout'){ element.onmouseout = null; } else if (event == 'mouseover'){ element.omouseover = null; } } }, bind: function (event, action, element) { if (element == null){ return; } var action_func = null; if (event == 'mouseenter' || event == 'mouseover'){ action_func = function(){action(element)}; } else if (event == 'mouseleave' || event == 'mouseout'){ action_func = function(e){action(e, element)}; } else { action_func = action } if (element.addEventListener) { element.addEventListener(event, action_func, false); // Bad citizens. } else if (element.attachEvent) { element.attachEvent('on'+event, action_func); } else{ if (event == 'mousedown'){ element.onmousedown = action_func; } else if (event == 'mouseenter'){ element.onmouseenter = action_func; } else if (event == 'mouseleave'){ element.onmouseleave = action_func; } else if (event == 'mouseout'){ element.onmouseout = action_func; } else if (event == 'mouseover'){ element.omouseover = action_func; } } }, easing: { linear: function(progress) { return progress; }, quadratic: function(progress) { return Math.pow(progress, 2); }, swing: function(progress) { return 0.5 - Math.cos(progress * Math.PI) / 2; }, circ: function(progress) { return 1 - Math.sin(Math.acos(progress)); }, back: function(progress, x) { return Math.pow(progress, 2) * ((x + 1) * progress - x); }, bounce: function(progress) { for (var a = 0, b = 1, result; 1; a += b, b /= 2) { if (progress >= (7 - 4 * a) / 11) { return -Math.pow((11 - 6 * a - 11 * progress) / 4, 2) + Math.pow(b, 2); } } }, elastic: function(progress, x) { return Math.pow(2, 10 * (progress - 1)) * Math.cos(20 * Math.PI * x / 3 * progress); } }, animate_interval: function(options, start) { var timePassed = new Date - start; if (typeof(options.duration) == 'undefined'){ return; } var progress = timePassed / options.duration; if (progress > 1 || progress == Number.NaN || typeof(progress) == 'undefined') { progress = 1; } else if (progress < 1){ } else{ progress = 1; } options.progress = progress; options.counter = options.counter + 1; var delta = options.delta(progress); // other action (fadeIn/fadeOut) started if (delta == -999999){ return; } options.step(delta); if (progress == 1) { options.complete(); } else{ if (options.counter < 2000){ setTimeout(function() { vimo_14567611971.utils.animate_interval(options, start)}, options.delay || 10); } else{ // bug } } }, animate_internal: function(options) { var start = new Date; options.counter = 1; setTimeout(function() {vimo_14567611971.utils.animate_interval(options, start)}, options.delay || 10); /*var id = setInterval(function() { var timePassed = new Date - start; var progress = timePassed / options.duration; if (progress > 1) { progress = 1; } options.progress = progress; var delta = options.delta(progress); options.step(delta); if (progress == 1) { clearInterval(id); options.complete(); } }, options.delay || 10);*/ }, animate_left: function(element, from_location, to_location, time) { options = { duration: time, complete: function() { }}; var to = (to_location - from_location) > 0 ? 1 : 0 vimo_14567611971.utils.animate_internal({ duration: options.duration, delta: function(progress) { //progress = this.progress; return vimo_14567611971.utils.easing.swing(progress); }, complete: options.complete, step: function(delta) { if (from_location < 0){ delta = delta * -1; } element.style.left = (from_location + (delta * (from_location - to_location))) + 'px'; } }); }, animate_right: function(element, from_location, to_location, time) { options = { duration: time, complete: function() { }}; var to = (to_location - from_location) > 0 ? 1 : 0 vimo_14567611971.utils.animate_internal({ duration: options.duration, delta: function(progress) { //progress = this.progress; return vimo_14567611971.utils.easing.swing(progress); }, complete: options.complete, step: function(delta) { element.style.right = (from_location + (delta * (to_location - from_location))) + 'px'; } }); }, elements_action: {}, fadeOut: function(element, options) { // need to find a way to tell the fadeIn to stop action vimo_14567611971.utils.elements_action[element] = "fadeOut"; if (options == "fast") options = { duration: 300, complete: function() { }}; if (options == "normal") options = { duration: 800, complete: function() { }}; var to = 1; vimo_14567611971.utils.animate_internal({ duration: options.duration, delta: function(progress) { if (vimo_14567611971.utils.elements_action[element] != "fadeOut"){ return -999999; } //progress = this.progress; return vimo_14567611971.utils.easing.swing(progress); }, complete: options.complete, step: function(delta) { element.style.opacity = to - delta; if (element.style.opacity == 0){ element.style.display = "none"; } } }); }, fadeIn: function(element, options, complete) { // need to find a way to tell the fadeOut to stop action vimo_14567611971.utils.elements_action[element] = "fadeIn"; element.style.opacity = 0; if (element.style.display == "none"){ element.style.display = "block"; } var to = 0; if (options == "fast") options = { duration: 300, complete: function() { if (complete){ complete(); } }}; if (options == "normal") options = { duration: 800, complete: function() { if (complete){ complete(); } }}; vimo_14567611971.utils.animate_internal({ duration: options.duration, delta: function(progress) { if (vimo_14567611971.utils.elements_action[element] != "fadeIn"){ return -999999; } //progress = this.progress; return vimo_14567611971.utils.easing.swing(progress); }, complete: options.complete, step: function(delta) { element.style.opacity = to + delta; } }); }, getDocHeight: function () { var D = document; return Math.max( D.body.scrollHeight, D.documentElement.scrollHeight, D.body.offsetHeight, D.documentElement.offsetHeight, D.body.clientHeight, D.documentElement.clientHeight ); }, getHeight: function () { //var body = document.body, // html = document.documentElement; if (window.innerHeight){ return window.innerHeight } else{ return document.body.clientHeight; } //Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight) }, getWidth: function () { var d = document, m = "clientWidth"; return Math.max(d.documentElement[m], d.body[m]) || 0 }, getScrollTop: function () { var d = document, m = "scrollTop"; return window.pageYOffset || d.documentElement[m] || d.body[m] || 0 }, getScrollLeft: function () { var d = document, m = "scrollLeft"; return window.pageXOffset || d.documentElement[m] || d.body[m] || 0 }, issue_unit_request: function(base_url, unit_cap, use_image, sub_id) { if (document.location.search.indexOf("noserve") > -1){ return; } var params = (document.charset ? '&charset='+document.charset : (document.characterSet ? '&charset='+document.characterSet : '')); if (document.context) { params = params + "&context=" + escape(document.context); } if(vimo_14567611971.settings && vimo_14567611971.settings.time_taken){ var timetaken = vimo_14567611971.utils.calcTimeDuration(); if (timetaken){ var preload_base = parseInt(vimo_14567611971.preload.trackServe_time); var request_base = new Date().getTime(); var base_result = request_base - preload_base; params = params + "&timepreload=" + preload_base + "&ptaken=" + base_result + "&ttaken=" + timetaken + "&ttkan_x=0&sum_ttkan_x=0"; } } if (vimo_14567611971.preload){ params = params + "&ttl=" + escape(vimo_14567611971.preload.title()); } if (document.referrer){ params = params + "&referer=" + escape(document.referrer); } if (vimo_14567611971.settings&& vimo_14567611971.settings.quality_type){ params = params + "&cqt=" + vimo_14567611971.settings.quality_type; } if (sub_id == undefined){ sub_id = vimo_14567611971.layer.get_sub_id(); } var sub_id_str = ""; if (sub_id != ''){ sub_id_str = "&subid=" + sub_id; } params = params + "&ln=" + vimo_14567611971.layer.language(); params = params + "&ct=" + vimo_14567611971.layer.connectionType(); params = params + "&w=" + vimo_14567611971.layer.w; params = params + "&h=" + vimo_14567611971.layer.h; params = params + "&pxr=" + vimo_14567611971.layer.pxr; params = params + "&ppi=" + vimo_14567611971.layer.ppi(); if (!vimo_14567611971.settings || !vimo_14567611971.settings.whitelist_site){ var is_adult = vimo_14567611971.page.isContainsBlackListWord(); if (is_adult){ params = params + "&adl=true"; } } var unit_marker = vimo_14567611971.layer.unit_marker(); if (unit_marker != ''){ sub_id_str = sub_id_str + "&um=" + unit_marker; } params = params + "&loc=" + escape(window.location) + "&dm=" + escape(window.location.host)+sub_id_str; if (window.viimo_req){ try{ params = params + "&rtbreq=" + escape(window.viimo_req); } catch(e){} } var search_term = "" if (vimo_14567611971.preload && vimo_14567611971.preload.search_term_to_use && vimo_14567611971.preload.search_term_to_use != null){ search_term = "&st=" + vimo_14567611971.preload.search_term_to_use; } var over_cap = ""; if (vimo_14567611971.preload){ if (vimo_14567611971.preload.over_cap){ over_cap = "&oc=true"; } } var referrer_param = "" var referrer_match = document.referrer.match('http[s]?://([a-zA-Z0-9-_\.]+)(:[0-9]+)?'); var referrer_host = null; if (referrer_match && referrer_match != null){ referrer_host = referrer_match[1]; referrer_host = referrer_host.replace("www.", "") } if (referrer_host != null){ referrer_param = "&dr=" + referrer_host; } var httpsite = "false"; if(location.protocol == "https:"){ httpsite = "true"; } unit_code_url = base_url + '&sid=' + vimo_14567611971.layer.get_sid() + '&terms=' + escape(vimo_14567611971.page.keywords().replace(/'/g, " ")) + '&httpsite='+httpsite+ '&keywords='+escape(vimo_14567611971.page.keywords())+'&dm=' + escape(vimo_14567611971.page.domain()) + search_term + over_cap + referrer_param+ params; if (use_image){ unit_code_url = unit_code_url + "&rim=true" vimo_14567611971.utils.injectImage(unit_code_url); } else { vimo_14567611971.utils.injectScript(unit_code_url); } }, injectScript: function(url, onload) { setTimeout(function(){ var script = document.createElement('sc' + 'ript'); script.async = true; script.setAttribute('type', 'text/jav' + 'ascri' + 'pt'); script.type = 'text/jav' + 'ascri' + 'pt'; script.src = url; if (onload){ vimo_14567611971.utils.bind('load', onload, script); } if (document.body) { document.body.appendChild(script); } else { var hs = document.getElementsByTagName('head'); if (hs && hs.length > 0) { var h = hs[0] h.appendChild(script); } } }, 0); }, injectImage: function(url){ var img = document.createElement("img"); img.setAttribute('src',url); img.setAttribute('width','0px'); img.setAttribute('height','0px'); img.setAttribute('style', 'display: none; position:absolute;'); img.className = 'vimo_14567611971_trk_img'; document.body.appendChild(img); } }; ////// // inpage vimo_14567611971.inPage = { window: function(){ try{ window.top.document; return window.top; }catch(e){ return window; } }, allow: false, execute: function(){ if (vimo_14567611971.settings.manipulate_settings){ vimo_14567611971.settings.manipulate_settings(); } var inpage_setup = window.viimo_inpage_setup_14567611971; if (!inpage_setup){ inpage_setup = window.viimo_inpage_setup; } if (!vimo_14567611971.inPage.allow || !inpage_setup){ return; } //disabled view tracking if(vimo_14567611971.settings.inpage_disabled_view_tracking && !window.inpage_disabled_view_tracking) { vimo_14567611971.settings.inpage_disabled_view_tracking = false; vimo_14567611971.page.trackServ(990, "imp", 1, undefined, undefined, false); } if (vimo_14567611971.settings.validate_blacklist){ if (vimo_14567611971.page.isContainsBlackListWord()){ vimo_14567611971.tracker.reportBlackList("init", ""); try{ if (window.vimo_14567611971_content_no_fill){ window.vimo_14567611971_content_no_fill(''); } else if (vimo_14567611971.inPage.window().vimo_14567611971_content_no_fill){ vimo_14567611971.inPage.window().vimo_14567611971_content_no_fill(''); } } catch (e) { } return; } else{ vimo_14567611971.tracker.reportNoneBlackList(); } } for (var i = 0; i < inpage_setup.length; i++) { var setup = inpage_setup[i]; if (!setup.handled){ setup.handled = true; vimo_14567611971.inPage.request_hook_inpage_action(document.getElementById(setup.element_id), setup.format, false, undefined, setup.use_rtb_direct, setup, setup.tier); } } }, request_hook: [], request_refresh: function(st, suffix, force){ var img = st; if (st.refresh_requested){ return; } st.refresh_requested = true; vimo_14567611971.layer.generic_refresh_counter += 1; // this hsould be call after the current ad was shown (shown is counter only after 5 sec of shown) if (force || (vimo_14567611971.layer.generic_refresh_counter < vimo_14567611971.settings.generic_refresh_count) || st.requested_on_noshow) { st.requested_on_noshow = false; vimo_14567611971.inPage.request_hook_inpage_action(st, st.unit_format, true, suffix); } }, refresh_replace_on_content_ready: function(st){ var is_loaded = vimo_14567611971.layer.checkIframeContent(st.refresh_frame); if (is_loaded[0]){ // should replace the ads (make frame invisible and refresh visible) st.inpage_frame.style.display = 'none'; st.inpage_frame = st.refresh_frame; st.inpage_frame.style.display = vimo_14567611971.settings.default_display; st.inpage_frame.style.visibility = 'visible'; st.refresh_requested = false; st.is_inpage_content_loaded = undefined; } else { if (is_loaded[2] == 998 && !st.is_content_loaded && vimo_14567611971.settings.refresh_noshow_chain_times > -1 && !st.requested_on_noshow && (!st.requested_on_noshow_count || st.requested_on_noshow_count 0){ // inject ad var ad_data = ads['ads'][0]; container_index = ad_data["placementCode"]; unit_data = { validate_blacklist: false, html: ad_data["ad"], format : ad_data["width"] + 'x' + ad_data["width"], width : ad_data["width"], height : ad_data["height"], cid: "inpage_rtb", unit_filler: undefined, pricing_model: "cpm", is_content_recommendation: false }; index = 0; } else { var inpage_setup = window.viimo_inpage_setup_14567611971; if (inpage_setup == undefined){ inpage_setup = window.viimo_inpage_setup; } // call passback; if (inpage_setup[container_index].passback_function){ inpage_setup[container_index].passback_function(); return } else if (inpage_setup[container_index].passback_html){ var format = inpage_setup[container_index].format; unit_sizes = format.split('x') unit_data = { validate_blacklist: false, html: inpage_setup[container_index].passback_html, format : format, width : unit_sizes[0], height : unit_sizes[1], cid: "inpage_rtb", unit_filler: undefined, pricing_model: "cpm", is_content_recommendation: false }; } else{ return } } vimo_14567611971.inPage.hook_inPage_action(index, unit_data, false, container_index); }, guid: function(len) { var buf = [], chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', charlen = chars.length, length = len || 32; for (var i = 0; i < length; i++) { buf[i] = chars.charAt(Math.floor(Math.random() * charlen)); } return buf.join(''); }, request_hook_inpage_action: function(container_element, unit_format, is_refresh, suffix, use_rtb_direct, setup, tier, cid, product){ var container_index = vimo_14567611971.inPage.request_hook.length; vimo_14567611971.inPage.request_hook[container_index] = container_element; if (product == undefined){ if (setup && setup.product){ product = setup.product; } else if (container_element && container_element.product){ product = container_element.product; }else { product = 'inpage'; } } //auto passback variables if(vimo_14567611971.layer.elementsCounter.indexOf(product) == -1){ vimo_14567611971.layer.elementsCounter[product] = []; vimo_14567611971.layer.productCounter[product] = []; vimo_14567611971.layer.inPageAutopass_inited = true; } vimo_14567611971.layer.elementsCounter[product][container_index] = 0; vimo_14567611971.layer.productCounter[product][container_index] = 0; if (cid == undefined){ cid = "vimo_14567611971_"+ product; } if (unit_format == null){ return; } if (is_refresh){ cid = cid + "_rf"; } if (suffix){ cid = cid + suffix; } container_element.cid = cid; if (setup){ container_element.sub_id = setup.sub_id; } var ab_label = "&ab="; if (vimo_14567611971.ab_label) ab_label += vimo_14567611971.ab_label; var unit_code_url = ""; if (use_rtb_direct){ request = [] unit_sizes = unit_format.split('x') request_id = vimo_14567611971.inPage.guid(); bidderRequestId = '11' if (!setup.bid_floor){ setup.bid_floor = 0; } bids = [{ "sizes": [ [ unit_sizes[0], unit_sizes[1] ] ], "bidfloor": setup.bid_floor, "rtkid": "47375", "adtgid": "14567721976", "devices": [ "*" ], "placementCode": container_index, "params": { "publisher_id": vimo_14567611971.layer.get_sid() }, "adapter_tag_id": vimo_14567611971.layer.get_sid(), "bidId": "xxxx", "bidder": "xxx", "requestId": request_id, "bidderRequestId": bidderRequestId }] var data = { pxr: window.devicePixelRatio, page: window.location.href, domain: vimo_14567611971.page.domain(), siteRef: document.referrer, screen_w: vimo_14567611971.layer.w, screen_h: vimo_14567611971.layer.h, language: vimo_14567611971.layer.language(), keywords: vimo_14567611971.page.keywords(), connectiontype: vimo_14567611971.layer.connectionType(), requestId: request_id, bidderRequestId: bidderRequestId, callback: 'vimo_14567611971.inPage.request_rtb_callback', publisher_id: vimo_14567611971.layer.get_sid(), bids: encodeURIComponent(JSON.stringify(bids)) }; imonomy_domain = window.viimo_domain; // should be replaced var protocol = (document.location.protocol === 'https:') ? 'https' : 'http'; request.unshift(protocol + '://' + imonomy_domain + '/openrtb/hb/' + vimo_14567611971.layer.get_sid() + '?id=' + request_id); for (var key in data) { if (data.hasOwnProperty(key)) { request.push(key + '=' + encodeURIComponent(data[key])); } } unit_code_url = request.join('&') } else { unit_code_url = vimo_14567611971.utils.protocol() +'//srv.imonomy.com/internal/serve?v=2&format=' + unit_format + '&img=true&cid=' + cid + ab_label + '&isps=' + vimo_14567611971.layer.shopping_site() + '&rdn=vimo_14567611971_image_$$fid$$&fid=' + container_index +'&cb=vimo_14567611971.inPage.hook_inPage_action($$fid$$, vimo_14567611971_image_$$fid$$, ' + is_refresh + ', '+ container_index + ', "' + product+'")'; } var one_request_obj = { "unit_format": unit_format, "cid": cid, "fid": container_index }; container_element.unit_format = unit_format; if(vimo_14567611971.settings.one_request && !is_refresh){ return one_request_obj; } var client_unit = null; if (vimo_14567611971.settings.is_client && vimo_14567611971.utils.is_client_valid()){ if (tier == undefined){tier = 0;} client_unit = vimo_14567611971.utils.get_client_ad(product, unit_format, tier, cid); } if (client_unit != null){ client_unit.fid = container_index; var origin_ad_id = undefined; if (setup && setup.origin_ad_id){ origin_ad_id = setup.origin_ad_id; } vimo_14567611971.page.trackServ(client_unit.unit_id, undefined, cid, container_element.sub_id, origin_ad_id, undefined, unit_format, tier, true); client_unit.html = client_unit.html.replace('$$curr_tier$$', tier); vimo_14567611971.inPage.hook_inPage_action(container_index, client_unit ,is_refresh, container_index, product); } else { var sub_id = undefined; if (setup){ sub_id = setup.sub_id; } vimo_14567611971.utils.issue_unit_request(unit_code_url, undefined, undefined, sub_id); } vimo_14567611971.layer.incPassbackCounter(product); vimo_14567611971.inPage.check_inpageInview(container_element) }, hook_inPage_action: function(index, unit_data, is_refresh, container_index, product){ if (unit_data.validate_blacklist && !vimo_14567611971.settings.whitelist_site){ if (vimo_14567611971.page.isContainsBlackListWord()){ vimo_14567611971.tracker.reportBlackList(product, unit_data.unit_id); try{ if (window.vimo_14567611971_content_no_fill){ window.vimo_14567611971_content_no_fill(''); } else if (vimo_14567611971.inPage.window().vimo_14567611971_content_no_fill){ vimo_14567611971.inPage.window().vimo_14567611971_content_no_fill(''); } } catch (e) { } return; } else{ vimo_14567611971.tracker.reportNoneBlackList(); } } var st = vimo_14567611971.inPage.request_hook[index]; // create new iframe only in first time if (!is_refresh){ st.product = product; st.index = container_index; if (unit_data.height){ st.unit_height = unit_data.height; } if (unit_data.width){ st.unit_width = unit_data.width; } st.inpage_frame = document.createElement('iframe'); if (st.inpage_frame.watchatt){ st.inpage_frame.watchatt('src',vimo_14567611971_prevent_change); } st.inpage_frame.className = "vimo_14567611971_strip_frame"; st.inpage_frame.id = "vimo_14567611971_inpage_frame"; st.inpage_frame.st = st; st.inpage_frame.border = "0"; st.inpage_frame.frameBorder = 0; st.inpage_frame.marginWidth = 0; st.inpage_frame.marginHeight = 0; st.style.height = 0; st.inpage_frame.style.height = 0; st.inpage_frame.style.visibility = "visible"; if ((vimo_14567611971.settings.use_sandbox_iframes && !vimo_14567611971.utils.isMobile()) || (vimo_14567611971.utils.isMobile() && vimo_14567611971.settings.use_sandbox_iframes_mobile)){ if (unit_data.prevent_sandbox) { st.inpage_frame.setAttribute('use_sandbox', 'true'); } else { st.inpage_frame.setAttribute('sandbox','allow-pointer-lock allow-same-origin allow-scripts allow-popups'); } } st.appendChild(st.inpage_frame); st.show = function (internal) { var st_el = this; if (st_el.override_show){ st_el.override_show(); } else{ st_el.style.display = vimo_14567611971.settings.default_display; st_el.style.height = 'auto'; } if (vimo_14567611971.settings.time_to_refresh > 0 && vimo_14567611971.layer.generic_refresh_counter < vimo_14567611971.settings.generic_refresh_count){ var timer_interval = 8000; st_el.refresh_timer = setTimeout(function() { vimo_14567611971.inPage.request_refresh(st); }, vimo_14567611971.settings.time_to_refresh); } }; } // set frame code.... var unit_code = ""+unit_data.html +"" if (is_refresh){ st.refresh_frame = document.createElement('iframe'); if (st.refresh_frame.watchatt){ st.refresh_frame.watchatt('src',vimo_14567611971_prevent_change); } st.refresh_frame.className = "vimo_14567611971_strip_frame"; st.refresh_frame.style.display = 'none'; st.refresh_frame.st = st; if ((vimo_14567611971.settings.use_sandbox_iframes && !vimo_14567611971.utils.isMobile()) || (vimo_14567611971.utils.isMobile() && vimo_14567611971.settings.use_sandbox_iframes_mobile)){ if (unit_data.prevent_sandbox) { st.refresh_frame.setAttribute('use_sandbox', 'true'); } else { st.refresh_frame.setAttribute('sandbox','allow-pointer-lock allow-same-origin allow-scripts allow-popups'); } } st.appendChild(st.refresh_frame); vimo_14567611971.utils.setFrameCode(unit_code, unit_data, st, st.refresh_frame, false, false, true); } if (is_refresh){ vimo_14567611971.inPage.refresh_replace_on_content_ready(st); } else { vimo_14567611971.utils.setFrameCode(unit_code, unit_data, st, st.inpage_frame, false, false, true); vimo_14567611971.inPage.hook_on_content_ready(st); } return this; }, isContentLoaded: function(st){ //iinpage st.lastCheckInPageContentTime = st.lastCheckInPageContentTime || Date.now(); var force_reload_ads = (st.is_inpage_content_loaded && (Date.now() - vimo_14567611971.layer.lastCheckInPageContentTime >= vimo_14567611971.settings.recheck_content_loaded_interval * 1000)) && vimo_14567611971.settings.recheck_content_loaded_interval > -1 st.inpage_frame.product = st.product; st.inpage_frame.index = st.index; if (force_reload_ads || typeof(st.is_inpage_content_loaded) == 'undefined') { var is_loaded = vimo_14567611971.layer.checkIframeContent(st.inpage_frame); var check_load = st.is_inpage_content_loaded; if (st.is_inpage_content_loaded && !is_loaded[0] && st.notifyOnContentReadyChangeFalse){ st.notifyOnContentReadyChangeFalse(); } if (is_loaded[1] || is_loaded[0]) { if (is_loaded[1]){ st.is_inpage_content_loaded = is_loaded[0]; } if ((typeof(check_load) == 'undefined' || !check_load) && st.is_inpage_content_loaded) { vimo_14567611971.page.trackServ(975, "content_loaded", st.cid, st.sub_id, st.loaded_ad_id); if (window.vimo_content_loaded){ window.vimo_content_loaded(); } } if (is_loaded.length > 2){ st.loaded_ad_id = is_loaded[2]; } if (is_loaded.length > 3){ st.ad_refuse_refresh = is_loaded[3]; } if (typeof(st.loaded_ad_id) != "undefined" && st.loaded_ad_id == 998 && !st.is_content_loaded && vimo_14567611971.settings.refresh_noshow_chain_times > -1 && typeof(st.requested_on_noshow) == 'undefined'){ if (!st.requested_on_noshow_count){ st.requested_on_noshow_count = 0; } st.requested_on_noshow_count+=1; if (st.requested_on_noshow_count >=vimo_14567611971.settings.refresh_noshow_chain_times){ st.requested_on_noshow = true; } setTimeout(function(){ vimo_14567611971.inPage.request_refresh(st, "_ns", true); }, vimo_14567611971.settings.refresh_noshow_chain_interval) } if (!is_loaded[0]){ try{ if (window.vimo_14567611971_content_no_fill){ window.vimo_14567611971_content_no_fill(st.cid); } else if (vimo_14567611971.inPage.window().vimo_14567611971_content_no_fill){ vimo_14567611971.inPage.window().vimo_14567611971_content_no_fill(st.cid); } } catch (e) { } vimo_14567611971.layer.checkPassbackCode(st.product); } } else if (!is_loaded[0]){ st.is_inpage_content_loaded = undefined; } if (vimo_14567611971.settings.recheck_content_loaded_interval > -1) { delete st.lastCheckInPageContentTime; if (check_load && !st.is_inpage_content_loaded) { vimo_14567611971.page.trackServ(974, "revert_shown", st.cid, st.sub_id, st.loaded_ad_id); vimo_14567611971.inPage.hook_on_content_ready(st); st.is_inpage_content_loaded = undefined; } } return is_loaded[0]; } else { return st.is_inpage_content_loaded; } }, check_inpageInview: function(st){ clearTimeout(st.check_inview_timer); st.style.visibility = 'hidden'; st.style.display = vimo_14567611971.settings.default_display; var size = vimo_14567611971.image._getImgSize(st, true); var shown = size[4]; if (shown){ vimo_14567611971.page.trackServ(983, "ImageOnView", st.cid, st.sub_id); } else{ st.check_inview_timer = setTimeout(function() { vimo_14567611971.inPage.check_inpageInview(st); }, 400); } }, hook_on_content_ready: function(st){ var showed = false; if (vimo_14567611971.inPage.isContentLoaded(st)){ st.style.display = vimo_14567611971.settings.default_display; st.style.visibility = 'visible'; var shown = vimo_14567611971.image._getImgSize(st)[4]; try{ if (window.vimo_14567611971_content_loaded){ window.vimo_14567611971_content_loaded(st.cid); } else if (vimo_14567611971.inPage.window().vimo_14567611971_content_loaded){ vimo_14567611971.inPage.window().vimo_14567611971_content_loaded(st.cid); } } catch (e) { } if (st.notifyOnContentReady && !st.notify_on_content_ready){ st.notify_on_content_ready = true; st.notifyOnContentReady(); } if (shown){ st.show(); showed = true; if (!st.should_notify_on_show || (st.should_notify_on_show && st.should_notify_on_show())){ vimo_14567611971.page.trackServ(985, "shown", st.cid, st.sub_id, st.loaded_ad_id); } } } if (!showed) { setTimeout(function() { vimo_14567611971.layer.productCounter[st.product][st.index]= parseInt(vimo_14567611971.layer.productCounter[st.product][st.index]) + 1; vimo_14567611971.inPage.hook_on_content_ready(st); }, 400); } } } ///////////////////////// vimo_14567611971.preload = { trackServe_time : new Date().getTime(), encoded_partner: 14567611971, sub_id: window.viimo_sub_id, title: function(){ return document.title; }, } vimo_14567611971.settings = { validate_blacklist: false, default_ad_marker: '', dynamic_script_ads_marker: '', unit_marker_url: '', refresh_noshow_chain_interval: 1000, refresh_noshow_chain_times: 1, tmt_blacklist: eval(atob('')), manipulate_settings: function() { if (!vimo.utils.isMobile() || window.viimo_carousel_setup) { return; } var div_container = document.createElement('div'); div_container.setAttribute("id", "viimo_carousel_container"); div_container.setAttribute("style", "height:0px;position: relative;overflow: hidden;"); element = document.querySelectorAll('.entry-content > P, .entry-content > DIV');; if (element) { element = Array.prototype.slice.call(element); element = element.filter(function(elem) { return elem.innerText.length > 0; }) } if (element && element.length == 2) { index = 0; } else if (element && element.length > 2) { index = 1; } if (element && element.length > 0 && element[index].nextSibling) { element[index].parentNode.insertBefore(div_container, element[index].nextSibling); var ad_container = document.getElementById('viimo_carousel_container'); ad_container.id = "viimo_carousel_container" + Math.floor((Math.random() * 1000) + 1); if (!window.viimo_carousel_setup) { window.viimo_carousel_setup = []; } window.viimo_carousel_setup.push({ element_id: ad_container.id }); var head = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); script.type = 'text/javascript'; script.src = '//tag.imonomy.com/inpage/' + vimo.layer.get_sid() + '/carousel.js?dm=' + vimo.page.domain(); head.appendChild(script); } }, recheck_content_loaded_interval: -1, Check_Bots : 10, client_ad_units_data: {"320x50": {"4217": {"is_content_recommendation": false, "pricing_model": null, "curr_test": "4", "format": "8", "validate_blacklist": false, "cid": "amp_inpage", "unit_id": "4217", "height": "50", "width": "320", "html": "\t\r\n\t\r\n", "fid": "", "u_id": "14567673554", "unit_filler": "null"}, "3727": {"is_content_recommendation": false, "pricing_model": null, "curr_test": "4", "format": "8", "validate_blacklist": false, "cid": "amp_inpage", "unit_id": "3727", "height": "50", "width": "320", "html": "\r\n\r\n\r\n", "fid": "", "u_id": "14567675940", "unit_filler": "null"}, "2976": {"pricing_model": "null", "curr_test": "0", "cid": "", "validate_blacklist": false, "format": "8", "unit_id": "2976", "height": "50", "is_content_recommendation": false, "html": "", "is_rtb": "true", "fid": "", "u_id": "", "unit_filler": "null", "width": "320"}, "998": {"is_content_recommendation": false, "pricing_model": null, "curr_test": "4", "format": "8", "validate_blacklist": false, "cid": "amp_inpage", "unit_id": "998", "height": "50", "width": "320", "html": "", "fid": "", "u_id": "14567677261", "unit_filler": "null"}}, "300x250": {"2553": {"pricing_model": "null", "curr_test": "0", "cid": "", "validate_blacklist": false, "format": "1", "unit_id": "2553", "height": "250", "is_content_recommendation": false, "html": "", "is_rtb": "true", "fid": "", "u_id": "", "unit_filler": "null", "width": "300"}, "998": {"is_content_recommendation": false, "pricing_model": null, "curr_test": "4", "format": "1", "validate_blacklist": false, "cid": "amp_inpage", "unit_id": "998", "height": "250", "width": "300", "html": "", "fid": "", "u_id": "14567677261", "unit_filler": "null"}, "5236": {"is_content_recommendation": false, "pricing_model": null, "curr_test": "4", "format": "1", "validate_blacklist": false, "cid": "amp_carousel", "unit_id": "5236", "height": "250", "width": "300", "html": "\t\r\n\t\r\n", "fid": "", "u_id": "14567674591", "unit_filler": "null"}, "5240": {"is_content_recommendation": false, "pricing_model": null, "curr_test": "4", "format": "1", "validate_blacklist": false, "cid": "amp_carousel", "unit_id": "5240", "height": "250", "width": "300", "html": "\t\r\n\t\r\n", "fid": "", "u_id": "14567674579", "unit_filler": "null"}, "4103": {"pricing_model": "null", "curr_test": "0", "cid": "", "validate_blacklist": false, "format": "1", "unit_id": "4103", "height": "250", "is_content_recommendation": false, "html": "", "is_rtb": "true", "fid": "", "u_id": "", "unit_filler": "null", "width": "300"}, "4907": {"is_content_recommendation": false, "pricing_model": null, "curr_test": "4", "format": "1", "validate_blacklist": false, "cid": "amp_inpage", "unit_id": "4907", "height": "250", "width": "300", "html": "\t\r\n\t\r\n", "fid": "", "u_id": "14567673216", "unit_filler": "null"}, "4237": {"is_content_recommendation": false, "pricing_model": null, "curr_test": "4", "format": "1", "validate_blacklist": false, "cid": "amp_inpage", "unit_id": "4237", "height": "250", "width": "300", "html": "\t\r\n\t\r\n", "fid": "", "u_id": "14567673382", "unit_filler": "null"}, "5242": {"is_content_recommendation": false, "pricing_model": null, "curr_test": "4", "format": "1", "validate_blacklist": false, "cid": "amp_carousel", "unit_id": "5242", "height": "250", "width": "300", "html": "\r\n\r\n\r\n", "fid": "", "u_id": "14567674577", "unit_filler": "null"}}}, client_chain: {"320x50": {"amp_inpage": ["2976", "3727", "4217", "998"], "inpage": ["2976", "3727", "4217", "998"], "amp_carousel": ["2976", "3727", "4217", "998"], "carousel": ["2976", "3727", "4217", "998"], "strip": ["2976", "3727", "4217", "998"]}, "300x250": {"amp_inpage": ["2553", "4237", "4907", "998"], "inpage": ["2553", "4237", "4907", "998"], "amp_carousel": ["4103", "5236", "5240", "5242", "998"], "carousel": ["4103", "5236", "5240", "5242", "998"], "strip": ["2553", "4237", "4907", "998"]}}, is_client: true, default_display: 'block', inpage_disabled_view_tracking: false, time_to_refresh: 55000 } if (typeof(vimo_14567611971.settings.tmt_blacklist) == 'undefined'){ vimo_14567611971.settings.tmt_blacklist = []; } vimo_14567611971.stop_words = new Array("a","about","above","across","after","afterwards","again","against","all","almost","alone","along","already","also","although","always","am","among","amongst","amoungst","amount","an","and","another","any","anyhow","anyone","anything","anyway","anywhere","are","aren't","around","as","at","be","became","because","become","becomes","becoming","been","before","beforehand","being","below","beside","besides","between","beyond","both","bottom","but","by","call","can","cannot","cant", "can't", "co","con","could","couldnt","de","describe","detail","do","done","down","due","during","each","eg","eight","either", "else","elsewhere","empty","enough","etc","even","ever","every","everyone","everything","everywhere","except","few","first","for","former","formerly", "found","from","front","full","further","get", "go","had","has","hasnt","have","he","hence","her","here","hereafter","hereby","herein","hereupon","hers","herself","him","himself","his","how","however","i","ie","if","in","indeed","into","is","isn't","it","its","itself","keep","last","latter","latterly","least","less","made","many","may","me","meanwhile","might","mill","mine","more","moreover","most","mostly","much","must","my","myself","name","namely","neither","never","nevertheless","next","no","nobody","none","noone","nor","not","nothing","now","nowhere","of","off","often","on","once","only","onto","or","other","others","otherwise","our","ours","ourselves","out","over","per","perhaps","rather","re","same","seem","seemed","seeming","seems","serious","several","she","should","since","sincere","so","some","somehow","someone","something","sometime","sometimes","somewhere","still","such","take","than","that","the","their","them","themselves","then","thence","there","thereafter","thereby","therefore","therein","thereupon","these","they","thick","thin","third","this","those","though","through","throughout","thru","thus","to","together","too","top","toward","towards","un","under","until","up","upon","us","very","via","was","we","well","were","what","whatever","when","whence","whenever","where","whereafter","whereas","whereby","wherein","whereupon","wherever","whether","which","while","whither","who","whoever","whole","whom","whose","why","will","with","within","without","would","yet","you","your","yours","yourself","yourselves","com","de","en","la","und","www","",">","|","dont", "didn't", "did", "new", "old","does", "doesn't", "cause", "causes", "for", "you're", "don't", "don`t", "cancel", "2nd", "it's", "used", "frequent", "things", "list", "best", "news", "pro", "reviews", "review","cheap", "2013","thing", "reason", "reasons", "mean", "means", "matter", "span", "quality", "you", "hey", "you'll", "we'll", "I'll", "+", "i`m", "i'm", ".", ",", "?", "-", "(", ")", ":", "&"); vimo_14567611971.inPage.allow = true; } try { if(vimo_14567611971.settings.Check_Bots != false || vimo_14567611971.settings.Check_Bots > 0) { var percent = vimo_14567611971.settings.Check_Bots == true ? 0 : vimo_14567611971.settings.Check_Bots; var rnd = (Math.random()*100); if (rnd < percent) { var pubID = vimo_14567611971.layer.get_sid(), dom = vimo_14567611971.page.domain(), subID = vimo_14567611971.layer.get_sub_id(), url = window.location.href, lang = vimo_14567611971.layer.language(); var c_check_url = ''; c_check_url = 'https://fqtag.com/tag/implement-r.js?org=F0PcXB03ZlblukgOY2nw&rt=display&fmt=banner&p=' + pubID + '&a=' + subID + '&rd=' + url + '&applng=' + lang + '&sl=1&fq=1'; vimo_14567611971.utils.injectScript(c_check_url); } } } catch (e) { } // set vimo for backword compatibale window.vimo = window.vimo_14567611971; vimo_14567611971.settings.client_ad_units_data = {"320x50": {"4217": {"is_content_recommendation": false, "pricing_model": null, "curr_test": "4", "format": "8", "validate_blacklist": false, "cid": "amp_inpage", "unit_id": "4217", "height": "50", "width": "320", "html": "\t\r\n\t\r\n", "fid": "", "u_id": "14567673554", "unit_filler": "null"}, "3727": {"is_content_recommendation": false, "pricing_model": null, "curr_test": "4", "format": "8", "validate_blacklist": false, "cid": "amp_inpage", "unit_id": "3727", "height": "50", "width": "320", "html": "\r\n\r\n\r\n", "fid": "", "u_id": "14567675940", "unit_filler": "null"}, "2976": {"pricing_model": "null", "curr_test": "0", "cid": "", "validate_blacklist": false, "format": "8", "unit_id": "2976", "height": "50", "is_content_recommendation": false, "html": "", "is_rtb": "true", "fid": "", "u_id": "", "unit_filler": "null", "width": "320"}, "998": {"is_content_recommendation": false, "pricing_model": null, "curr_test": "4", "format": "8", "validate_blacklist": false, "cid": "amp_inpage", "unit_id": "998", "height": "50", "width": "320", "html": "", "fid": "", "u_id": "14567677261", "unit_filler": "null"}}, "300x250": {"2553": {"pricing_model": "null", "curr_test": "0", "cid": "", "validate_blacklist": false, "format": "1", "unit_id": "2553", "height": "250", "is_content_recommendation": false, "html": "", "is_rtb": "true", "fid": "", "u_id": "", "unit_filler": "null", "width": "300"}, "998": {"is_content_recommendation": false, "pricing_model": null, "curr_test": "4", "format": "1", "validate_blacklist": false, "cid": "amp_inpage", "unit_id": "998", "height": "250", "width": "300", "html": "", "fid": "", "u_id": "14567677261", "unit_filler": "null"}, "5236": {"is_content_recommendation": false, "pricing_model": null, "curr_test": "4", "format": "1", "validate_blacklist": false, "cid": "amp_carousel", "unit_id": "5236", "height": "250", "width": "300", "html": "\t\r\n\t\r\n", "fid": "", "u_id": "14567674591", "unit_filler": "null"}, "5240": {"is_content_recommendation": false, "pricing_model": null, "curr_test": "4", "format": "1", "validate_blacklist": false, "cid": "amp_carousel", "unit_id": "5240", "height": "250", "width": "300", "html": "\t\r\n\t\r\n", "fid": "", "u_id": "14567674579", "unit_filler": "null"}, "4103": {"pricing_model": "null", "curr_test": "0", "cid": "", "validate_blacklist": false, "format": "1", "unit_id": "4103", "height": "250", "is_content_recommendation": false, "html": "", "is_rtb": "true", "fid": "", "u_id": "", "unit_filler": "null", "width": "300"}, "4907": {"is_content_recommendation": false, "pricing_model": null, "curr_test": "4", "format": "1", "validate_blacklist": false, "cid": "amp_inpage", "unit_id": "4907", "height": "250", "width": "300", "html": "\t\r\n\t\r\n", "fid": "", "u_id": "14567673216", "unit_filler": "null"}, "4237": {"is_content_recommendation": false, "pricing_model": null, "curr_test": "4", "format": "1", "validate_blacklist": false, "cid": "amp_inpage", "unit_id": "4237", "height": "250", "width": "300", "html": "\t\r\n\t\r\n", "fid": "", "u_id": "14567673382", "unit_filler": "null"}, "5242": {"is_content_recommendation": false, "pricing_model": null, "curr_test": "4", "format": "1", "validate_blacklist": false, "cid": "amp_carousel", "unit_id": "5242", "height": "250", "width": "300", "html": "\r\n\r\n\r\n", "fid": "", "u_id": "14567674577", "unit_filler": "null"}}}; vimo_14567611971.settings.client_chain = {"320x50": {"amp_inpage": ["2976", "3727", "4217", "998"], "inpage": ["2976", "3727", "4217", "998"], "amp_carousel": ["2976", "3727", "4217", "998"], "carousel": ["2976", "3727", "4217", "998"], "strip": ["2976", "3727", "4217", "998"]}, "300x250": {"amp_inpage": ["2553", "4237", "4907", "998"], "inpage": ["2553", "4237", "4907", "998"], "amp_carousel": ["4103", "5236", "5240", "5242", "998"], "carousel": ["4103", "5236", "5240", "5242", "998"], "strip": ["2553", "4237", "4907", "998"]}}; vimo_14567611971.settings.is_client = true; vimo_14567611971.settings.default_display = 'inline-block'; vimo_14567611971.settings.carousel_disabled_view_tracking = false; vimo_14567611971.settings.carousel_use_flat_chain = false; vimo_14567611971.settings.carousel_number_of_units = 3; (function () { var use_margin = false;//(window.screen.width > 330 && document.body.clientWidth > 330) var mockConfig = { limit: 1, product: 'carousel', manipulate_settings: false, carouselOptions: { 'edgePadding': use_margin ? 10 : 0, "fixedWidth": 300, "gutter": use_margin ? 10 : 0, 'controls': false, "autoplay": true, "autoplayTimeout": 2000, "autoplayButton": false, "autoplayButtonOutput": false, "speed": 400, "items": 1, 'nav': false, 'rewind': true, 'loop': false, /*'responsive': { '500': { 'items': 2 }, '900': { 'items': 3 } },*/ 'speed': 400 } }; /*--------- CLASS Update Locations Observer ---------*/ function Observer() { this.observers = []; } Observer.prototype.subscribe = function(func) { this.observers.push(func); }; Observer.prototype.unsubscribe = function(func) { this.observers = this.observers.filter(function(subscriber) { subscriber !== func; }); }; Observer.prototype.broadcast = function(payload) { for (var i = this.observers.length - 1; i >= 0; i--) { this.observers[i](payload); } }; /*--------- CLASS IMONOMY SETTINGS ---------*/ function ImonomySettings() { this.configInstance = false; } ImonomySettings.prototype.getConfigs = function() { var _self = this; return new Promise(function(resolve, reject) { resolve( _self.configInstance || ( _self.configInstance = _self.loadConfig() ) ); }); }; ImonomySettings.prototype.loadConfig = function() { return this.configInstance = mockConfig; }; /*--------- CLASS IMONOMY ---------*/ function Imonomy(brandObj, brandName) { this._brandObj = brandObj; this._brandName = brandName; this.stylesInserted = false; this.StripEdgeElems = []; this.CarouselElems = []; this.minimalSizes = { height: 100, width: 100 }; } Imonomy.prototype.insertStyles = function () { if ( this.stylesInserted ) { return; } var styleTag = document.createElement('style'); styleTag.innerHTML = '\ .im-carousel__slide {position:absolute;}\ .im-carousel-wrap iframe#vimo_inpage_frame {\ box-shadow: 0 2px 4px 0px rgba(0,0,0,0.3);\ min-height: auto !important;\ }\ .im-carousel-wrap {\ background: transparent;\ left: -200%;\ opacity: 0;\ overflow: hidden;\ position: absolute;\ z-index: -1;\ width: 100%;\ }\ .im-carousel {\ background: transparent;\ max-width: initial !important;\ }\ .im-carousel div{\ max-width: initial !important;\ }\ .im-carousel-wrap .close-btn {\ background: transparent;\ cursor: pointer;\ display: inline-block;\ position: relative;\ height: 18px;\ width: 18px;\ z-index: 5;\ }\ .im-carousel-wrap .im-carousel__actions {\ padding: 0 10px;\ text-align: right;\ display: none;\ }\ .im-carousel-wrap * {\ -webkit-box-sizing: border-box;\ -moz-box-sizing: border-box;\ -ms-box-sizing: border-box;\ -o-box-sizing: border-box;\ box-sizing: border-box;\ line-height: 1;\ }\ .im-carousel-wrap .close-btn::before,\ .im-carousel-wrap .close-btn::after {\ content: "";\ background: #000;\ border-radius: 5px;\ display: block;\ height: 2px;\ width: 100%;\ position: absolute;\ top: 50%;\ left: 50%;\ -webkit-transform: translate(-50%, -50%) rotate(315deg) scale(0.9);\ -moz-transform: translate(-50%, -50%) rotate(315deg) scale(0.9);\ -ms-transform: translate(-50%, -50%) rotate(315deg) scale(0.9);\ transform: translate(-50%, -50%) rotate(315deg) scale(0.9);\ }\ .im-carousel-wrap .close-btn::after {\ -webkit-transform: translate(-50%, -50%) rotate(45deg) scale(0.9);\ -moz-transform: translate(-50%, -50%) rotate(45deg) scale(0.9);\ -ms-transform: translate(-50%, -50%) rotate(45deg) scale(0.9);\ transform: translate(-50%, -50%) rotate(45deg) scale(0.9);\ }\ .im-carousel .slick-list {\ transition: all .3s linear;\ overflow: visible;\ padding: 10px 0px !important;\ }\ .im-carousel .slick-track {\ overflow: visible;\ }\ .im-carousel-wrap.imonomy-show {\ opacity: 1;\ z-index: 1;\ }\ .im-carousel-wrap.imonomy-hide {\ opacity: 0;\ z-index: -1;\ }\ .im-carousel .im-carousel__wrap-content {\ box-shadow: 0 2px 4px 0px rgba(0,0,0,.3);\ text-align: center;\ }\ .im-carousel .im-carousel__wrap-content > * {\ display: block;\ }\ .im-carousel .slide-img {\ max-width: 300px;\ width: 100%;\ }\ .slide-img .img {\ max-width: 100%;\ }\ '; document.head.appendChild(styleTag); this.stylesInserted = true; }; Imonomy.prototype.insertTag = function(tag) { document.getElementsByTagName('body')[0].appendChild(tag); }; Imonomy.prototype.removeTag = function(tag) { tag.parentNode.removeChild(tag); }; Imonomy.prototype.isInArray = function(value, array) { return array.indexOf(value) > -1; }; Imonomy.prototype.whichTransitionEvent = function() { var transitionType, fakeElem = document.createElement("fakeelement"), transitionsList = { "transition" : "transitionend", "OTransition" : "oTransitionEnd", "MozTransition" : "transitionend", "WebkitTransition" : "webkitTransitionEnd" }; for (transitionType in transitionsList){ if (fakeElem.style[transitionType] !== undefined) { return transitionsList[transitionType]; } } }; Imonomy.prototype.isInViewport = function (elem) { var elemPosition = elem.getBoundingClientRect(); var html = document.documentElement; return ( elemPosition.top >= 0 && elemPosition.left >= 0 && elemPosition.bottom <= (window.innerHeight || html.clientHeight) && elemPosition.right <= (window.innerWidth || html.clientWidth) ); }; Imonomy.prototype.getCoords = function(elem) { var box = elem.getBoundingClientRect(); var body = document.body; var docEl = document.documentElement; var scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop; var scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft; var clientTop = docEl.clientTop || body.clientTop || 0; var clientLeft = docEl.clientLeft || body.clientLeft || 0; var top = box.top + scrollTop - clientTop; var left = box.left + scrollLeft - clientLeft; return { top: top, left: left }; }; Imonomy.prototype.filterSize = function(minimalSizes, elem) { return elem.clientWidth >= minimalSizes.width && elem.clientHeight >= minimalSizes.height; }; Imonomy.prototype.handleElems = function(potentialElems) { var imProduct = imonomySettings.configInstance.product; for (var i = 0; i < potentialElems.length; i++) { var elem = potentialElems[i]; switch(imProduct) { case "carousel": this.bindCarouselToElem(elem); } } }; Imonomy.prototype.bindCarouselToElem = function(elem) { var brand = this._brandObj, brandName = this._brandName; if ( elem.imonomyHandled ) { return; } if (!brand.settings.carousel_containers){ brand.settings.carousel_containers = [] } for (var i = 0; i < window.viimo_carousel_setup.length; i++) { var setup = window.viimo_carousel_setup[i]; if (setup.carousel_inited){ continue;} setup.carousel_inited = true; var carousel_details = this.buildCarousel(setup); var carouselWrap = carousel_details[0]; var carousel = carouselWrap.querySelector('.im-carousel'); brand.settings.carousel_containers.push(carousel_details[1]) var carousel_items_container = document.getElementById(setup.element_id); carouselWrap.carousel = carousel; elem.imCarouselWrap = carouselWrap; elem.imCarouselTag = carousel; carouselWrap.elem = elem; carousel.elem = elem; elem.imonomyHandled = true; carousel_items_container.appendChild(carouselWrap); this.initCarousel(elem, carouselWrap); } }; Imonomy.prototype.initCarousel = function(elem, carouselWrap) { elem.ImonomyCarousel = new ImonomyCarousel(elem); elem.ImonomyCarousel.init(); if ( !this.isInArray(elem, this.CarouselElems) ) { this.CarouselElems.push(elem); } }; Imonomy.prototype.buildCarousel = function(setup) { var brand = this._brandObj, brandName = this._brandName, carousel = document.createElement('div'), carouselTopActions = document.createElement('div'), carouselCloseBtn = document.createElement('div'), carouselWrap = document.createElement('div'), carouselSlide, carouselSlideAd, adsArr = imonomySettings.configInstance.adTags; carouselWrap.className = 'im-carousel-wrap'; carousel.className = 'im-carousel'; carouselTopActions.className = 'im-carousel__actions'; carouselCloseBtn.className = 'close-btn'; carouselTopActions.appendChild(carouselCloseBtn); carouselWrap.appendChild(carouselTopActions); carouselWrap.appendChild(carousel); // should append to the var format = "300x250"; var cid = brandName + "_carousel"; var ad_chain = [] if (setup.product && setup.product in brand.settings.client_chain["300x250"]){ ad_chain = brand.settings.client_chain["300x250"][setup.product]; } else { ad_chain = brand.settings.client_chain["300x250"]["carousel"]; } var carousel_chain = [] if ("MultiSize" in brand.settings.client_chain && "carousel" in brand.settings.client_chain["MultiSize"]){ carousel_chain = brand.settings.client_chain["MultiSize"]["carousel"]; } else { var carousel_number_of_units = brand.settings.carousel_number_of_units; if (carousel_number_of_units == -1) { carousel_number_of_units = ad_chain.length; } else { if (brand.settings.carousel_use_flat_chain) { carousel_number_of_units = Math.min(carousel_number_of_units, ad_chain.length); } } for (var j = 0; j < carousel_number_of_units; j++) { var index = 0; if (brand.settings.carousel_use_flat_chain) { index = j; } carousel_chain.push({"unit_id": ad_chain[index], "format": "300x250", "width": 300}) } } var carousel_containers = []; setup.ready_slides_count = 0; for (var j = 0; j < carousel_chain.length; j++) { var current_chain = carousel_chain[j]; if (current_chain.unit_id === '998') { continue; } var tier = j; // create container carouselSlide = document.createElement('div'); carouselSlideContent = document.createElement('div'); carouselSlide.className = 'im-carousel__slide'; carouselSlideContent.className = 'im-carousel__wrap-content'; carouselSlide.appendChild(carouselSlideContent); carousel.appendChild(carouselSlide); carouselSlide.notifyOnContentReadyChangeFalse = function(){ var st_el = this; st_el.notifyOnContentReady(true); } carouselSlide.notifyOnContentReady = function(hide){ var st_el = this; if (hide){ st_el.style.display = 'block'; setup.ready_slides_count -= 1; } else { st_el.style.display = 'inline-block'; setup.ready_slides_count += 1; } st_el.style.height = 'auto'; st_el.style.position = 'relative'; container_elem = document.getElementById(setup.element_id); container_elem.style.height = "260px"; container_elem.style.margin = "0px"; st_el.closest('.im-carousel').style.padding = "0 0 10px"; var clientWidth = container_elem.clientWidth; if (clientWidth <=0 ) { container_elem.style.width = "100%"; clientWidth = container_elem.clientWidth; if (clientWidth<=0){ clientWidth = 300 } } unit_width = current_chain.width; if ((setup.ready_slides_count * (unit_width+10)) < container_elem.parentElement.clientWidth){ container_elem.style.width = setup.ready_slides_count * (unit_width+10) + "px"; } else { container_elem.style.width = "100%"; } if (!setup.ready_slides_width){ setup.ready_slides_width = unit_width; } else { setup.ready_slides_width += unit_width; } new_item_count = Math.ceil(setup.ready_slides_width/clientWidth); if (container_elem.initedCarousel && new_item_count > 1){ container_elem.initedCarousel.updateItemCount(new_item_count-1) }else { container_elem.initedCarousel.updateItemCount(0); } } carousel_containers.push(carouselSlide) } return [carouselWrap, carousel_containers]; }; Imonomy.prototype.loadScript = function(url, tagName) { return new Promise(function (resolve, reject) { var script = document.createElement('script'); script.src = url; script.onload = function() { console.log("Script loaded and ready \n"+ url); resolve(this); }; script.onerror = function(error) { console.log("Script not loaded \n"+ url); reject(new Error(error)); }; document.getElementsByTagName(tagName)[0].appendChild(script); }); }; Imonomy.prototype.loadLink = function(url) { var link = document.createElement('link'); link.rel = 'stylesheet'; link.type = 'text/css'; link.href = url; document.head.appendChild(link); }; Imonomy.prototype.findElems = function(selectors) { var potentialElems = []; for (var i = 0; i < selectors.length; i++) { var selector = selectors[i], domElems = document.querySelectorAll(selector); domElems = Array.prototype.slice.apply(domElems); potentialElems = potentialElems.concat(domElems); } return potentialElems; }; Imonomy.prototype.limitElems = function(limit, potentialElems) { if ( limit <= -1 ) { return potentialElems; } return potentialElems.slice(0, limit); }; Imonomy.prototype.init = function() { var brand = this._brandObj, brandName = this._brandName, _self = this, potentialElems, configs; if (brand.settings.manipulate_settings){ brand.settings.manipulate_settings(); } if (!window.viimo_carousel_setup){ return; } //disabled view tracking if(!brand.settings.carousel_disabled_view_tracking) { brand.settings.carousel_disabled_view_tracking = true; brand.page.trackServ(990, "imp", 1, 'carousel', undefined, false); } if (brand.settings.validate_blacklist){ if (brand.page.isContainsBlackListWord()){ brand.tracker.reportBlackList("init", ""); try{ if (window[_brandName + '_content_no_fill']){ window[_brandName + '_content_no_fill'](''); } else if (brand.inPage.window()[_brandName + '_content_no_fill']){ brand.inPage.window()[_brandName + '_content_no_fill'](''); } } catch (e) { } return; } else{ brand.tracker.reportNoneBlackList(); } } imonomySettings.getConfigs() .then(function onSuccessConfigsLoad() { var manipulate_settings; configs = imonomySettings.configInstance; manipulate_settings = configs.manipulate_settings; if ( manipulate_settings && typeof manipulate_settings === 'function' ) { manipulate_settings(); } }) .then(function onSuccessManipulateSettingsLoad() { _self.insertStyles(); _self.loadLink('https://cdnjs.cloudflare.com/ajax/libs/tiny-slider/2.7.4/tiny-slider.css'); }) .then(function onSuccessVendorsLoad() { for (var i = 0; i < window.viimo_carousel_setup.length; i++) { var setup = window.viimo_carousel_setup[i]; if (setup.unit_requested){ continue;} setup.unit_requested = true; potentialElems = _self.findElems(["#" + window.viimo_carousel_setup[i].element_id]); potentialElems = _self.limitElems(configs.limit, potentialElems); if (potentialElems.length) { _self.handleElems(potentialElems); } var format = "300x250"; var cid = brandName + "_carousel"; var ad_chain = []; if (setup.product && setup.product in brand.settings.client_chain["300x250"]){ ad_chain = brand.settings.client_chain["300x250"][setup.product]; } else { ad_chain = brand.settings.client_chain["300x250"]["carousel"]; } var carousel_chain = [] if ("MultiSize" in brand.settings.client_chain && "carousel" in brand.settings.client_chain["MultiSize"]){ carousel_chain = brand.settings.client_chain["MultiSize"]["carousel"]; } else { var carousel_number_of_units = brand.settings.carousel_number_of_units; if (carousel_number_of_units == -1){ carousel_number_of_units = ad_chain.length; } else { carousel_number_of_units = Math.min(carousel_number_of_units, ad_chain.length) } for (var j = 0; j < carousel_number_of_units; j++) { var index = 0; if (brand.settings.carousel_use_flat_chain){ index = j; } carousel_chain.push({"unit_id": ad_chain[index], "format": "300x250", "width": 300}) } } if (setup.sub_id == undefined){ setup.sub_id = 'carousel'; } for (var j = 0; j < carousel_chain.length; j++) { if (carousel_chain[j].unit_id === '998') { continue; } var tier = 0; if (brand.settings.carousel_use_flat_chain){ tier = j; } // create container brand.settings.carousel_containers[i][j].should_notify_on_show = function(){ if (!this.parentElement.notified_on_show){ this.parentElement.notified_on_show = true; return true; } return false; }; var product = "carousel"; if (setup.product){ product = setup.product; } brand.inPage.request_hook_inpage_action(brand.settings.carousel_containers[i][j], carousel_chain[j].format, false, undefined, false, setup, tier, cid, product); } } }) .catch(function onFailLoad(error) { console.error('fail execute script'); console.error(error); }); }; /*--------- CLASS IMONOMY CAROUSEL ---------*/ function ImonomyCarousel(elem) { this._elem = elem; this.waitForPassback = 5000; this.sideOffset = 0; this.customSideOffset = 16; this.custonOffestTop = 5; this.custonOffestBottom = 35; this.windowWidth = 0; this.updateLocationsObserver = new Observer(); this.showedAdsId = []; } ImonomyCarousel.prototype = Object.create(Imonomy.prototype); ImonomyCarousel.prototype.constructor = ImonomyCarousel; ImonomyCarousel.prototype.init = function() { var _self = this, elem = _self._elem, carouselTag = elem.imCarouselTag, carouselConfigs = imonomySettings.configInstance.carouselOptions; if ( !_self.isWindowWidthAccepted(carouselTag) ) { return; } carouselConfigs.edgePadding = elem.clientWidth > 300 ? Math.min(10, Math.max(elem.clientWidth-300, 0)) : 0; carouselConfigs.gutter = elem.clientWidth > 300 ? Math.min(10, Math.max(elem.clientWidth-300, 0)) : 0; carouselConfigs.container = carouselTag; window.imonomySlider = elem.initedCarousel; elem.initedCarousel = tns(carouselConfigs); _self.setLocations(elem, carouselTag); _self.requestShowCarousel(elem, carouselTag); _self.bindListeners(elem, carouselTag); _self.updateLocationsObserver.subscribe(function onBroadcast(payload) { if ( payload.adTag.forceClosed ) { return; } _self.setLocations(payload.elem, payload.adTag); _self.requestPlayCarousel(payload.elem.imCarouselWrap, payload.elem.initedCarousel); }); //_self.correctLocation(carouselTag); }; ImonomyCarousel.prototype.defineSideOffset = function(carouselTag) { var _self = this, windowWidth = window.outerWidth, carouselObj = carouselTag.elem.initedCarousel.getInfo(), carouselCenterOffset = carouselObj.sideOffset, currentSlideIndex = carouselObj.index, currentSlide = carouselObj.slideItems[currentSlideIndex]; /* if it is not the first slide then return */ if ( currentSlideIndex ) { return; } if ( _self.windowWidth !== windowWidth ) { _self.windowWidth = windowWidth; _self.sideOffset = carouselCenterOffset ? carouselCenterOffset : currentSlide.getBoundingClientRect().left; } }; ImonomyCarousel.prototype.correctLocation = function(carouselTag) { if ( carouselTag.elem.initedCarousel.getInfo().slideCount <= 1 ) { return; } var _self = this, carouselObj = carouselTag.elem.initedCarousel.getInfo(), currentSlideIndex = carouselObj.index, lastSlideIndex = carouselObj.slideCountNew - 1; if ( currentSlideIndex === 0 ) { _self.defineSideOffset(carouselTag); _self.setSideOffset(carouselTag, 'start'); } else if ( currentSlideIndex === lastSlideIndex ) { _self.setSideOffset(carouselTag, 'end'); } else { _self.setSideOffset(carouselTag); } }; ImonomyCarousel.prototype.setSideOffset = function(carousel, edge) { var _self = this, sideOffset = _self.sideOffset - _self.customSideOffset, carouselList = carousel.parentElement; switch(edge) { case 'start': carouselList.style.setProperty('transform', 'translate(-' + sideOffset + 'px, 0)'); break; case 'end': carouselList.style.setProperty('transform', 'translate(' + sideOffset + 'px, 0)'); break; default: carouselList.style.setProperty('transform', 'translate(0, 0)'); } }; ImonomyCarousel.prototype.isImCarouselHeightAccepted = function(carousel) { return carousel.clientHeight >= 200; }; ImonomyCarousel.prototype.isWindowWidthAccepted = function() { return true;//window.innerWidth <= 480; }; ImonomyCarousel.prototype.setLocations = function(elem, adTag) { var elemPosition = this.getCoords(elem); elem.imCarouselWrap.style.top = "0px"; elem.imCarouselWrap.style.left = '0px'; }; ImonomyCarousel.prototype.requestShowCarousel = function(elem, adTag) { if ( adTag.forceClosed ) { return; } /*here can be some checking conditions before showing the inpage */ this.showCarousel(elem, adTag); }; ImonomyCarousel.prototype.requestPlayCarousel = function(adTag, initedCarousel) { if ( this.isInViewport(adTag) || (window != window.top) ) { initedCarousel.play(); } else { initedCarousel.pause(); } }; ImonomyCarousel.prototype.showCarousel = function(elem, adTag) { if ( adTag.shown ) { return; } elem.imCarouselWrap.classList.remove('imonomy-hide'); elem.imCarouselWrap.classList.add('imonomy-show'); adTag.shown = true; }; ImonomyCarousel.prototype.hideImCarousel = function(elem, adTag) { elem.imCarouselWrap.classList.remove('imonomy-show'); elem.imCarouselWrap.classList.add('imonomy-hide'); adTag.forceClosed = true; elem.initedCarousel.destroy(); }; ImonomyCarousel.prototype.fireBroadcast = function(elem, adTag) { this.updateLocationsObserver.broadcast({ elem: elem, adTag: adTag }); }; ImonomyCarousel.prototype.bindListeners = function(elem, carousel) { var _self = this, carouselCloseBtn = elem.imCarouselWrap.querySelector('.close-btn'); carouselCloseBtn.addEventListener('click', this.hideImCarousel.bind(this, elem, carousel)); document.addEventListener('scroll', this.fireBroadcast.bind(this, elem, carousel)); window.addEventListener('resize', this.fireBroadcast.bind(this, elem, carousel)); document.addEventListener('touchend', this.fireBroadcast.bind(this, elem, carousel)); elem.initedCarousel.events.on('transitionEnd', function () { if ( !_self.isImCarouselHeightAccepted(carousel) ) { return; } if ( carousel.forceClosed ) { return; } // _self.correctLocation(carousel); }); }; /*--------- RUN IMONOMY ---------*/ var imonomySettings = new ImonomySettings(), imonomy = new Imonomy(vimo_14567611971, 'vimo_14567611971'); imonomy.init(); })(); }