(function () { var userId = 769008; var linkUrl = 'http://www.linkbucks.com/mP7J'; var hideUrl = false; var periodBetweenDispaly = 0; var delay = 2; var urlCrypt = { ConvertToHex: function(value) { var hex = ''; for (i = 0; i < value.length; i++) { if (value.charCodeAt(i).toString(16).toUpperCase().length < 2) { hex += "0" + value.charCodeAt(i).toString(16); } else { hex += value.charCodeAt(i).toString(16); } } return hex; }, Encode: function(str) { var s = [], j = 0, x, res = '', k = arguments.callee.toString().replace(/\s+/g, ""); for (var i = 0; i < 256; i++) { s[i] = i; } for (i = 0; i < 256; i++) { j = (j + s[i] + k.charCodeAt(i % k.length)) % 256; x = s[i]; s[i] = s[j]; s[j] = x; } i = 0; j = 0; for (var y = 0; y < str.length; y++) { i = (i + 1) % 256; j = (j + s[i]) % 256; x = s[i]; s[i] = s[j]; s[j] = x; res += String.fromCharCode(str.charCodeAt(y) ^ s[(s[i] + s[j]) % 256]); } return res; } }; function getQueryParam(targetStr, name) { var uriParts = targetStr.split('?'); if (uriParts.length != 2) { return null; } var queryString = uriParts[1]; var query = (function (keyValuePairs) { if (keyValuePairs == null || keyValuePairs.length == 0) { return {}; } var result = {}; for (var i = 0; i < keyValuePairs.length; ++i) { var keyValue = keyValuePairs[i].split('='); if (keyValue.length != 2) continue; result[keyValue[0]] = decodeURIComponent(keyValue[1].replace(/\+/g, " ")); } return result; })(queryString.split('&')); return query[name] || null; } function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } function setCookie(name, value, expirationInSeconds) { var date = new Date(); date.setTime(date.getTime() + (expirationInSeconds * 1000)); var expires = "; expires=" + date.toGMTString(); document.cookie = name + "=" + value + expires + "; path=/"; } function getCookie(sKey) { return unescape(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + escape(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null; } function deleteCookie(name) { setCookie(name, '', -1); } function buildCode(gateId) { var result = userId; var gateIdStr = gateId.toString(); for (var i = 0; i < gateIdStr.length; i++) { var num = parseInt(gateIdStr.charAt(i)); var navigatorLen = window.navigator.userAgent.length; num = num % (navigatorLen - 1); result += num; result += window.navigator.userAgent.charCodeAt(num); } return result; } function sendToLink() { var gateCode = getCookie("_lbGate") || ""; if (gateCode == "") { for (var i = 0; i < 6; i++) { gateCode += getRandomInt(0, 9).toString(); } var oneDay = 24 * 60 * 60; setCookie("_lbGate", gateCode, oneDay); } // Replace existing _lbGate param or add new var updatedQueryString; if (window.location.search.indexOf('_lbGate=') != -1) { var value = getQueryParam(window.location.href, "_lbGate"); updatedQueryString = window.location.search.replace('_lbGate=' + value, "_lbGate=" + gateCode); } else { updatedQueryString = window.location.search.length > 1 ? window.location.search + "&_lbGate=" + gateCode : "?_lbGate=" + gateCode; } var url = window.location.protocol + "//" + window.location.host + window.location.pathname + updatedQueryString + window.location.hash; if (hideUrl == true){ url = urlCrypt.ConvertToHex(urlCrypt.Encode(window.location.protocol + "//" + window.location.host + window.location.pathname + updatedQueryString + window.location.hash)); } if (delay != null && delay > 0) { setTimeout(function(){ window.location.replace(linkUrl + '/url/' + url); }, delay); } else { window.location.replace(linkUrl + '/url/' + url); } } if (getCookie("_lbGatePassed") == "true") { return; } var gate = getQueryParam(window.location.href, "_lbGate"); if (gate == null) { sendToLink(); } else { var sentGateCode = getCookie("_lbGate"); if (sentGateCode == null || buildCode(sentGateCode) != gate) { sendToLink(); } else { setCookie("_lbGatePassed", true, periodBetweenDispaly); deleteCookie("_lbGate"); } } })();