diff --git a/README.md b/README.md index 5366feb..b35fd02 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,15 @@ ## Highlights +Currently supports CSFloat.com and Skinport.com, but more sites are coming soon! + - Display Buff prices (buy order + listings) for every item -- Auto-refresh in the "Newest Items" +- Price difference to Buff at first glance next to the price tag +- Accurate sticker price calculation (%sp) with gradual coloring +- CSFloat: Auto-refresh in the "Newest Items" +- CSFloat: See the listing age of an item +- Skinport: Automatically check the checkboxes in the cart for faster buying +- Skinport: Multiple currency conversion options - More coming soon! ## Services @@ -92,6 +99,6 @@ Please follow the [conventional commits](https://www.conventionalcommits.org/en/ ## Disclaimer -BetterFloat is developed independently, and is not officially endorsed by or affiliated with CSFloat in any way. If you are a legal representative of CSFloat and would like this project to be taken down, please contact me. +BetterFloat is developed independently, and is not officially endorsed by or affiliated with CSFloat Inc. or Skinport GmbH in any way. If you are a legal representative of CSFloat or Skinport and would like this project to be taken down, please contact me directly. -Built with 🖤 in Munich +Built with 🖤 in Munich. diff --git a/manifest.json b/manifest.json index 3caed1a..823fdfa 100644 --- a/manifest.json +++ b/manifest.json @@ -36,7 +36,7 @@ }, "permissions": ["storage"], "web_accessible_resources": [ { - "matches": [ "https://csfloat.com/*", "https://csgofloat.com/*", "*://*.skinport.com/*" ], + "matches": [ "https://csfloat.com/*", "https://csgofloat.com/*", "*://*.skinport.com/*"], "resources": [ "public/buff_favicon.png", "public/clock-solid.svg", "public/chevron-up-solid.svg", "js/inject.js"] } ] } diff --git a/manifest_firefox.json b/manifest_firefox.json index f1ffef8..97d0f93 100644 --- a/manifest_firefox.json +++ b/manifest_firefox.json @@ -1,24 +1,30 @@ { "name": "BetterFloat", "author": "Rums", - "version": "1.3.2", - "description": "Enhance your experience on CSFloat.com", + "version": "1.4.0", + "description": "Enhance your experience on CSFloat.com and Skinport.com", "manifest_version": 3, - "host_permissions": ["*://prices.csgotrader.app/*", "*://csfloat.com/*"], + "host_permissions": ["*://prices.csgotrader.app/*", "*://csfloat.com/*", "*://*.skinport.com/*"], "background": { "scripts": ["js/background.js"] }, "content_scripts": [ { - "matches": ["https://csfloat.com/*", "https://csgofloat.com/*"], - "js": ["js/content_script.js"], - "css": ["css/stylesheet.css"], - "run_at": "document_idle" + "matches": ["*://*.csfloat.com/*", "*://*.csgofloat.com/*"], + "js": ["js/csfloat/content_script.js"], + "css": ["css/csfloat_styles.css"], + "run_at": "document_end" }, { - "matches": ["https://csfloat.com/*", "https://csgofloat.com/*"], + "matches": ["https://csfloat.com/*", "https://csgofloat.com/*", "*://*.skinport.com/*"], "js": ["js/injectionhandler.js"], "run_at": "document_start" + }, + { + "matches": ["*://*.skinport.com/*"], + "js": ["js/skinport/content_script.js"], + "css": ["css/skinport_styles.css"], + "run_at": "document_idle" } ], "icons": { @@ -39,7 +45,7 @@ "permissions": ["storage"], "web_accessible_resources": [ { - "matches": ["https://csfloat.com/*", "https://csgofloat.com/*"], + "matches": ["https://csfloat.com/*", "https://csgofloat.com/*", "*://*.skinport.com/*"], "resources": ["public/buff_favicon.png", "public/clock-solid.svg", "public/chevron-up-solid.svg", "js/inject.js"] } ] diff --git a/src/mappinghandler.ts b/src/mappinghandler.ts index 2f49cfe..2ab3d23 100644 --- a/src/mappinghandler.ts +++ b/src/mappinghandler.ts @@ -100,10 +100,16 @@ export async function getItemPrice(buff_name: string): Promise<{ starting_at: nu }; } } + if (priceMapping[buff_name]) { + return { + starting_at: priceMapping[buff_name]['buff163']['starting_at']['price'] ?? 0, + highest_order: priceMapping[buff_name]['buff163']['highest_order']['price'] ?? 0, + }; + } return { - starting_at: priceMapping[buff_name]['buff163']['starting_at']['price'] ?? 0, - highest_order: priceMapping[buff_name]['buff163']['highest_order']['price'] ?? 0, - }; + starting_at: 0, + highest_order: 0, + } } export async function getUserCurrencyRate(rates: "skinport" | "real" = "real") { diff --git a/src/popup.ts b/src/popup.ts index d7c4726..19b66ee 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -5,16 +5,16 @@ $(function () { $('#version').text('Version: ' + chrome.runtime.getManifest().version); // init loading of content - $('.MainContent').load('settings.html', function () { + $('.MainContent').load('csfloat.html', function () { //Loading complete - loadSettings('settings.html'); + loadSettings('csfloat.html'); addListeners(); }); //add listeners to all tabs $('.tabItem').on('click', function (e) { e.preventDefault(); - let url = e.currentTarget.getAttribute('data-page') ?? 'settings.html'; + let url = e.currentTarget.getAttribute('data-page') ?? 'csfloat.html'; $('.MainContent').load(url, function () { //Loading complete loadSettings(url); @@ -173,7 +173,7 @@ function loadForSkinport() { } function loadSettings(url: string) { - if (url == 'settings.html') { + if (url == 'csfloat.html') { loadForSettings(); } else if (url == 'skinport.html') { loadForSkinport(); diff --git a/src/skinport/content_script.ts b/src/skinport/content_script.ts index 8d13644..270ca6a 100644 --- a/src/skinport/content_script.ts +++ b/src/skinport/content_script.ts @@ -266,7 +266,7 @@ async function getBuffPrice(item: Skinport.Listing): Promise<{ buff_name: string if (typeof helperPrice == 'number') { priceListing = helperPrice; priceOrder = helperPrice; - } else { + } else if (priceMapping[buff_name]) { if (item.style != '' && item.style != 'Vanilla') { priceListing = priceMapping[buff_name]['buff163']['starting_at']['doppler'][item.style]; priceOrder = priceMapping[buff_name]['buff163']['highest_order']['doppler'][item.style];