widgets.rewardstyle.com Open in urlscan Pro
2600:9000:20eb:8000:8:8430:1780:93a1  Public Scan

URL: https://widgets.rewardstyle.com/js/shopthepost.js
Submission: On September 11 via manual from RO — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

if(window.__rewardstyle === undefined) {
	!function(doc, win){
		window.__rewardstyle = {
			ev:(doc.addEventListener !== undefined ? {
				add: 'addEventListener',
				rem: 'removeEventListener',
				pre: ''
			}:{
				add: 'attachEvent',
				rem: 'detachEvent',
				pre: 'on'
			}),
			ajax:{
				isIE8:(win.XDomainRequest !== undefined ? true : false),
				IEVersion:(function(){
					var a = navigator.userAgent.toLowerCase();
					return a.indexOf('msie') !== -1 ? parseInt(a.split('msie')[1],10) : false;
				})(),
				get:function(url, data, callback){
					var xhr = (__rewardstyle.ajax.isIE8 === true ? new win.XDomainRequest() : new XMLHttpRequest()),
						handler = function(e){
							if(xhr.readyState === 4 && xhr.status === 200) {
								response();
							}
						},
						response = function(){
							if(typeof(callback) === 'function') {
								callback(data, xhr.responseText);
							}
						};

					try {
						if(__rewardstyle.ajax.isIE8 === true) {
							xhr.onload = response;
							xhr.open('GET', url, true);
							xhr.onprogress = function(){};
							xhr.ontimeout = function(){};
							xhr.onerror = function(){};
							setTimeout(function(){xhr.send();}, 0);
						}
						else {
							xhr.open('GET', url, true);
							xhr.onreadystatechange = handler;
							xhr.send();
						}
					}
					catch(e){
						console.log(e);
					}
				}
			},
			getElementsByClassName:function(c, s){
				if(s === undefined) {
					s = doc;
				}
				return doc.getElementsByClassName !== undefined ? s.getElementsByClassName(c) : s.querySelectorAll('.'+c);
			},
			classFactor:function(e, c){
				var s = e.className.split(' '),
					r = [];
				c = c.toLowerCase();
				for(var i = 0; i < s.length; i++) {
					if(s[i] !== '' && s[i].toLowerCase() !== c) {
						r.push(s[i]);
					}
				}
				return r;
			},
			addClass:function(e, c){
				var r = __rewardstyle.classFactor(e, c);
				r.push(c);
				e.className = r.join(' ');
				return e.className;
			},
			removeClass:function(e, c) {
				var r = __rewardstyle.classFactor(e, c);
				e.className = r.join(' ');
				return e.className;
			},
			hasClass:function(e, c) {
				return RegExp('^(\\s*.+\\s+)*'+c+'(\\s+.+\\s*)*$', 'i').test(e.className);
			},
			camelize:function(s){
				return s.replace(/[\-\s_](\w)/g, function(d, l){
					return l.toUpperCase();
				});
			},
			getStyle:function(e, s){
				var c = __rewardstyle.camelize(s);
				if(e.style[c] !== '') {
					return e.style[c];
				}
				if(e.currentStyle === undefined) {
					return doc.defaultView.getComputedStyle(e, null).getPropertyValue(s);
				}
				return e.currentStyle(c);
			},
			isMobile:(function() {
				var a = navigator.userAgent || navigator.vendor || win.opera;
				return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4));
			})()
		};
	}(document, window);
}

if(window.__stp === undefined) {
	!function(doc, win){
		window.__stp = {
			inited: false,
			widgets: [],
			controls: [],
			widths: [],
			outers: [],
			inners: [],
			slides: [],
			products: [],
			visible: [],
			chunk: [],
			max: [],
			clones: [],
			intervals: [],
			injectResponse:function(id, mk){
				__stp.widgets[id].innerHTML = mk;
				__stp.widgets[id].setAttribute('data-widget-uid', id);
				__stp.controls[id] = __rewardstyle.getElementsByClassName('stp-control', __stp.widgets[id]);
				__stp.outers[id] = __rewardstyle.getElementsByClassName('stp-outer', __stp.widgets[id])[0];
				__stp.inners[id] = __rewardstyle.getElementsByClassName('stp-inner', __stp.widgets[id])[0];
				__stp.slides[id] = __rewardstyle.getElementsByClassName('stp-slide', __stp.widgets[id])[0];
				__stp.widths[id] = false;
				__stp.visible[id] = 0;
				__stp.chunk[id] = 0;
				__stp.max[id] = 0;
				__stp.intervals[id] = null;
				__stp.clones[id] = {};
				__stp.products[id] = []
				var products = __rewardstyle.getElementsByClassName('stp-product', __stp.widgets[id]);
				for(var i = 0, l = products.length; i < l; i++) {
					__stp.products[id].push(products[i]);
					__stp.products[id][i].setAttribute('data-index', i);
					__stp.clones[id][i] = __stp.products[id][i].cloneNode(true);
				}
			},
			clearHover:function(){
				for(var i = 0, l = __stp.widgets.length; i < l; i++) {
					var hos = __rewardstyle.getElementsByClassName('stp-hover', __stp.widgets[i]);
					for(var j = 0, k = hos.length; j < k; j++) {
						__rewardstyle.removeClass(hos[j], 'stp-hover');
					}
				}
			},
			wrangleTouch:function(){
				doc.addEventListener('touchstart', function(e){
					if(__rewardstyle.hasClass(e.target, 'stp-tap') === true) {
						var el = e.target;
						while(__rewardstyle.hasClass(el, 'stp-product') === false) {
							el = el.parentElement;
						}
						if(__rewardstyle.hasClass(el, 'stp-hover') === false) {
							__stp.clearHover();
							__rewardstyle.addClass(el, 'stp-hover');
							e.preventDefault();
						}
					}
					else {
						__stp.clearHover();
					}
				});
			},
			wrangleHover:function(i){
				var ev = __rewardstyle.ev;
				__stp.outers[i][ev.add](ev.pre+'mouseover', __stp.m_over, true);
				__stp.outers[i][ev.add](ev.pre+'mouseout', __stp.m_out, true);
			},
			click:function(e){
				var t = e.target || e.srcElement;
				if(__rewardstyle.hasClass(t, 'stp-control') === true) {
					for(var i = 0, l = __stp.controls.length; i < l; i++) {
						for(var j = 0, k = __stp.controls[i].length; j < k; j++) {
							if(t === __stp.controls[i][j]) {
								if(__rewardstyle.hasClass(t, 'stp-left') === true) {
									__stp.left(i);
								}
								else if(__rewardstyle.hasClass(t, 'stp-right') === true) {
									__stp.right(i);
								}
								__stp.setAuto(i, __rewardstyle.hasClass(__stp.outers[i], 'stp-rotate'));
								break;
							}
						}
					}
				}
			},
			findParent:function(e){
				while(e !== undefined && e !== null && __rewardstyle.hasClass(e, 'shopthepost-widget') === false) {
					e = e.parentNode;
				}
				return e;
			},
			m_over:function(e){
				e = e.target || e.srcElement;
				e = __stp.findParent(e);
				if(e !== undefined && e !== null) {
					__stp.setAuto(e.getAttribute('data-widget-uid'), false);
				}
			},
			m_out:function(e){
				e = e.target || e.srcElement;
				e = __stp.findParent(e);
				if(e !== undefined && e !== null) {
					__stp.setAuto(e.getAttribute('data-widget-uid'), true);
				}
			},
			setAuto:function(i,a){
				clearInterval(__stp.intervals[i]);
				if(a !== undefined && a === true) {
					__stp.intervals[i] = setInterval(function(){
						__stp.right(i);
					}, 30000);
				}
			},
			left:function(i){
				var c = __stp.chunk[i] - 1,
					r = __stp.products[i].length % __stp.visible[i];
				if(c < 0) {
					__stp.inners[i].removeChild(__stp.slides[i]);
					__stp.goChunk(i, 1);
					for(var j = parseInt(__stp.slides[i].children[0].getAttribute('data-index'),10), l = __stp.products[i].length, k = 0; j >= 0 && k < __stp.visible[i]; j--, k++) {
						if(j - 1 < 0) {
							j = l;
						}
						__stp.slides[i].insertBefore(__stp.clones[i][j-1], __stp.slides[i].children[0]);
					}
					__stp.inners[i].appendChild(__stp.slides[i]);
					setTimeout(function(){__stp.goChunk(i,0);},10);
					setTimeout(function(){__stp.clearClones(i);}, 310);
				}
				else {
					__stp.goChunk(i, c);
				}
			},
			right:function(i){
				var c = __stp.chunk[i] + 1,
					r = __stp.products[i].length % __stp.visible[i];
				if((c >= __stp.max[i] && r !==0) || (c > __stp.max[i] && r === 0)) {
					for(var j = parseInt(__stp.slides[i].children[__stp.slides[i].children.length-1].getAttribute('data-index'),10), l = __stp.products[i].length, k = r; j < l && k < l; j++, k++) {
						if(j + 1 >= l) {
							j = -1;
						}
						__stp.slides[i].appendChild(__stp.clones[i][j+1]);
					}
					setTimeout(function(){__stp.clearClones(i);}, 300);
				}
				__stp.goChunk(i, c);
			},
			clearClones:function(i){
				var p = null;
				__stp.inners[i].removeChild(__stp.slides[i]);
				__stp.goChunk(i, 0);
				for(var j = 0, l = __stp.products[i].length; j < l; j++) {
					p = __stp.clones[i][j].parentElement;
					if(p !== null) {
						p.insertBefore(__stp.products[i][j], __stp.clones[i][j]);
						p.removeChild(__stp.clones[i][j]);
					}
				}
				__stp.inners[i].appendChild(__stp.slides[i]);
			},
			showControls:function(i,s){
				for(var j = 0, l = __stp.controls[i].length; j < l; j++) {
					if(s !== undefined && s === true) {
						__rewardstyle.removeClass(__stp.controls[i][j], 'stp-hidden');
					}
					else {
						__rewardstyle.addClass(__stp.controls[i][j], 'stp-hidden');
					}
				}

				if(s !== undefined && s === true) {
					__rewardstyle.removeClass(__stp.outers[i], 'stp-no-controls');
					__rewardstyle.addClass(__stp.inners[i], 'stp-shift');
				}
				else {
					__rewardstyle.addClass(__stp.outers[i], 'stp-no-controls');
					__rewardstyle.removeClass(__stp.inners[i], 'stp-shift');
				}
			},
			setMargins:function(i,m){
				var u = Math.ceil(m),
					d = Math.floor(m);
				for(var j = 0, l = __stp.products[i].length; j < l; j++) {
					__stp.products[i][j].setAttribute('style', 'margin: 0 '+u+'px 0 '+d+'px');
					__stp.clones[i][j].setAttribute('style', 'margin: 0 '+u+'px 0 '+d+'px');
				}
			},
			goChunk:function(i,c){
				__stp.chunk[i] = c;
				__stp.slides[i].setAttribute('style', 'left: -'+(c*100)+'%');
			},
			sizeCheck:function(i){
				var w = __stp.widths[i] === false ? {s:__stp.slides[i].offsetWidth,o:__stp.outers[i].clientWidth,c:0} : __stp.widths[i];
				if(w.s > w.o) {
					if(__stp.products[i].length > 1) {
						__stp.showControls(i, true);
						w.c = __stp.controls[i][0].offsetWidth;
					}
					var vp = w.o - (w.c * 2),
						pw = __stp.products[i][0].offsetWidth,
						co = Math.floor(vp / pw);
					if(pw > vp) {
						__rewardstyle.addClass(__stp.outers[i], 'stp-resp');
						__stp.visible[i] = 1;
					}
					else {
						__stp.setMargins(i, ((vp - (co * pw)) / (co * 2)));
						__stp.visible[i] = co;
					}
					__stp.max[i] = Math.ceil(__stp.products[i].length / __stp.visible[i]) - 1;
					__stp.inners[i].setAttribute('style', 'width: '+vp+'px');
					if(__stp.chunk[i] > __stp.max[i]) {
						__stp.goChunk(i, 0);
					}
					if(__stp.max[i] > 0 && __rewardstyle.hasClass(__stp.outers[i], 'stp-rotate') === true) {
						__stp.setAuto(i, true);
					}
				}
				else {
					__stp.goChunk(i, 0);
					__stp.max[i] = 0;
					__stp.setAuto(i, false);
				}
			},
			resize:function(){
				for(var i = 0, l = __stp.widgets.length; i < l; i++) {
					__rewardstyle.removeClass(__stp.outers[i], 'stp-resp');
					__stp.showControls(i, false);
					__stp.setMargins(i, 0);
					__stp.inners[i].setAttribute('style', 'width: auto');
				}
				for(i = 0; i < l; i++) {
					__stp.widths[i] = {s:__stp.slides[i].offsetWidth,o:__stp.outers[i].clientWidth,c:0};
				}
				for(i = 0; i < l; i++) {
					__stp.sizeCheck(i);
				}
			},
			init:function(e){
				if(e !== undefined && e.type === 'readystatechange' && doc.readyState !== 'complete') {
					return;
				}

				var ev = __rewardstyle.ev,
					ws = __rewardstyle.getElementsByClassName('shopthepost-widget'),
					src = document.getElementById('shopthepost-script').src.split('js/shopthepost.js')[0];

				for(var i = 0; i < ws.length; i++) {
					__stp.widgets[i] = ws[i];

					if(ws[i].getAttribute('data-widget-uid') !== null) {
						continue;
					}

					__rewardstyle.ajax.get(src + 'stps/' + ws[i].getAttribute('data-widget-id') + '.html' + (__rewardstyle.isMobile === true ? '?mobile' : ''), {uid:i}, function(params, data){
						try {
							if(__stp.widgets[params.uid].getAttribute('data-widget-uid') !== null) {
								return;
							}
							__stp.injectResponse(params.uid, data);
						} catch(err){}

						if(__rewardstyle.ajax.isIE8 === false || __rewardstyle.ajax.IEVersion > 8) {
							__stp.sizeCheck(params.uid);
						}

						if(__stp.max[params.uid] > 0 && __rewardstyle.hasClass(__stp.outers[params.uid], 'stp-rotate') === true) {
							__stp.wrangleHover(params.uid);
						}
					});
				}

				if(__stp.inited === false) {
					win[ev.add](ev.pre+'resize', __stp.resize, true);
					doc[ev.rem](ev.pre+'DOMContentLoaded', __stp.init, false);
					doc[ev.rem](ev.pre+'readystatechange', __stp.init, false);
					win[ev.rem](ev.pre+'load', __stp.init, false);
					doc[ev.add](ev.pre+(__rewardstyle.isMobile === true ? 'touchstart' : 'click'), __stp.click, true);

					if(__rewardstyle.isMobile === true) {
						__stp.wrangleTouch();
					}

					__stp.inited = true;
				}
			}
		};
	}(document, window);
}

!function(d, w){
	if(document.readyState === 'complete') {
		__stp.init();
	}
	else {
		var e = __rewardstyle.ev;
		d[e.add](e.pre+'DOMContentLoaded', __stp.init, false);
		d[e.add](e.pre+'readystatechange', __stp.init, false);
		w[e.add](e.pre+'load', __stp.init, false);
	}
}(document, window);