Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- document.cookie = 'same-site-cookie=foo; SameSite=Lax';
- document.cookie = 'cross-site-cookie=bar; SameSite=None; Secure';
- chrome.storage.sync.get(
- function(options) {
- let foundSkin;
- chrome.runtime.onMessage.addListener(
- function(request, sender, sendResponse) {
- if (request.priceSource == 'csgobackpack') {
- var url = "https://pixelboii.wtf/steamvalue.json";
- var skinFullName = request.itemURL;
- fetch(url)
- .then(res => res.json())
- .then(price => {
- let returnedValues = {
- id: request.id,
- value: price.items_list[skinFullName].price["7_days"].average
- }
- sendResponse(returnedValues);
- })
- .catch(err => { throw err });
- return true; // Will respond asynchronously.
- }
- else if (request.priceSource.includes('lootfarm')) {
- if (request.priceSource == 'lootfarmcsgo') {
- var url = "https://loot.farm/fullprice.json";
- } else if (request.priceSource == 'lootfarmdota2') {
- var url = "https://loot.farm/fullpriceDOTA.json";
- } else if (request.priceSource == 'lootfarmrust') {
- var url = "https://loot.farm/fullpriceRUST.json";
- } else if (request.priceSource == 'lootfarmh1z1') {
- var url = "https://loot.farm/fullpriceH1Z1.json";
- }
- var skinFullName = request.itemURL;
- fetch(url)
- .then(res => res.json())
- .then(price => {
- for(let i =0; i < price.length; i++){
- foundSkin = false;
- if(price[i].name === skinFullName){
- let returnedValues = {
- id: request.id,
- value: price[i].price / 100
- }
- sendResponse(returnedValues);
- foundSkin = true;
- break;
- }
- }
- if (foundSkin === false) {
- let returnedValues = {
- id: request.id,
- value: 'failed'
- }
- sendResponse(returnedValues);
- }
- })
- .catch(err => { throw err });
- return true; // Will respond asynchronously.
- }
- else if (request.priceSource == 'getPendingMarketNames') {
- var url = "https://csgoempire.com/api/v2/hermes/pending";
- fetch(url)
- .then(res => res.json())
- .then(marketName => {
- sendResponse(marketName.items[request.id].market_name);
- })
- .catch(err => { throw err });
- return true; // Will respond asynchronously.
- } else if (request.priceSource == 'getItems') {
- var url = "https://csgoempire.com/api/v2/hermes/inventory/10";
- fetch(url)
- .then(res => res.json())
- .then(marketName => {
- let marketNames = []
- let tradelockedItems = 0;
- for (i = 0; i < tradelockedItems + 50; i++) {
- marketNames.push(marketName[i].market_name);
- }
- sendResponse(marketNames);
- })
- .catch(err => { throw err });
- return true; // Will respond asynchronously.
- }
- else if (request.priceSource == 'inventoryValue') {
- var url = "https://csgobackpack.net/api/GetInventoryValue/?id=" + options.steamid64;
- console.log(url);
- fetch(url)
- .then(res => res.json())
- .then(price => {
- let returnedValues = {
- id: request.steamid64,
- inventoryValue: price
- }
- sendResponse(returnedValues);
- })
- .catch(err => { throw err });
- return true; // Will respond asynchronously.
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment