Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function SyncGetPurchasedData(){
- var intervalID2 = setInterval(function(){
- if(isPayedRequest){
- clearInterval(intervalID2);
- GetPurchasedData();
- }
- }, 200);
- }
- // getting items name for analystic
- var itemsCount = 0;
- var currentTick = 0;
- var itemDiv = null;
- var lastItemName = "";
- var isEndGrabbing = false;
- var itemsForGrab = [];
- var itemsForGrabImg = [];
- var itemsForGrabSumm = [];
- var itemsInOutRange = [];
- function startGrabber()
- {
- itemsCount = $("#left .reals .placeholder").length;
- itemsForGrab = [];
- itemsForGrabImg = [];
- itemsForGrabSumm = [];
- for(var i=0;i<itemsCount;i++)
- {
- itemDiv = $("#left .reals .placeholder").eq(currentTick);
- if(lastItemName==itemDiv.attr("data-name"))
- {
- currentTick++;
- continue;
- }
- itemsForGrab.push(itemDiv.attr("data-name"));
- itemsForGrabSumm.push(itemDiv.attr("data-price"));
- var imgUrl = itemDiv.children(".slot").css('background-image').substr(5);
- imgUrl = imgUrl.substr(0,imgUrl.length-2);
- itemsForGrabImg.push(imgUrl);
- lastItemName = itemDiv.attr("data-name");
- currentTick++;
- }
- var jsonObj = {
- itemsNames: itemsForGrab,
- itemsImg: itemsForGrabImg,
- itemsSumm: itemsForGrabSumm
- };
- currentTick = 0;
- isEndGrabbing = true;
- async_worker_grab(function(){
- var jsonForSend = JSON.stringify(jsonObj);
- $.ajax({
- url: 'http://analystic.ru/api/parseDoubleItems',
- type: 'POST',
- data: {itemsForGrab: jsonForSend},
- success: function(data){
- }
- })
- .fail(function() {
- });
- });
- }
- function async_worker_grab(callback){
- var intervalID = setInterval(function(){
- if(isEndGrabbing){
- clearInterval(intervalID);
- callback();
- }
- }, 1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement