Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Wednesday, 25 October 2017

how to hide ajax requests from firebug console

we use an image attach to body tag
masoffer_order_info = {
  transaction_id: '',
  offer_id: '',
  transaction_time: , // 1447388224436
  signature: '',
  /*transaction_discount: 100000, */
  traffic_id: Cookies.get('mp_traffic_id'),
  
  products: [
   $value)
        {
            $i++;
            //if ($key == 'totalSanPham') continue;
            $product3 = $value;
     ?>
     {
        id: '',
        sku: '',
        url: 'http://myphamchonam.com',
        price: ,
        name: '',
        category: '',
        category_id : ,
        status_code: 0,
        quantity: 
    }
      
     
      
    
  ]
};

}


var MasOffer = {
    transaction: function (x) {
        var y = JSON.stringify(MasOffer.parseTransaction(x));
        var url = 'https://static.masoffer.net/img/oid/' + x.offer_id + '/?data=' + encodeURIComponent(y);

        var oImg = document.createElement("img");
        oImg.setAttribute('src', url);
        oImg.style.width = '1px';
        oImg.style.height = '1px';
        oImg.style.position = 'fixed';
        oImg.style.top = '0';

        document.body.appendChild(oImg);
    },
    parseTransaction: function (z) {
        var products = z.products;
        products.forEach(function(product, index){
            try {
                products[index] = MasOffer.parseProduct(product);
            }
            catch(err) {
                console.log(err.message);
            }

        });
        return z;
    },
    parseProduct: function (p) {
        if (p.category_id !== undefined) {
            p.category_id_raw = p.category_id;
            p.category_id = 1;
        }
        return p;
    }
};
var interval;
interval = setInterval(function(){
    if (typeof masoffer_order_info !== "undefined") {
        clearInterval(window.interval);
        MasOffer.transaction(masoffer_order_info)
    }
}, 2000);