-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
var numberWithCommas = (x) => { | ||
return x.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ","); // https://stackoverflow.com/questions/2901102/how-to-format-a-number-with-commas-as-thousands-separators | ||
} | ||
|
||
var addSummaryNetRow = () => { | ||
var table = document.querySelector('.lifetimeSummaryCtn table'); | ||
if (!table) return; // If no table is found, exit the function | ||
|
||
console.log(table); | ||
|
||
var rows = table.rows; | ||
var netRevenueCell = rows[1].cells[1]; | ||
var netRevenue = netRevenueCell.textContent; | ||
netRevenue = netRevenue.replace('$', ''); | ||
netRevenue = netRevenue.replace(',', ''); | ||
console.log(Number(netRevenue)) | ||
var devRevenue = Number(netRevenue * 0.7); | ||
var devRevenueString = numberWithCommas(Math.floor(devRevenue)); | ||
|
||
var newRow = table.insertRow(2); // Insert after net | ||
|
||
var nameElem = document.createElement('td'); | ||
var sumElem = document.createElement('td'); | ||
var descElem = document.createElement('td'); | ||
descElem.textContent = '(Net revenue for the developer. Net * 0.7)' | ||
nameElem.textContent = 'Lifetime Steam revenue (developer net)'; | ||
sumElem.textContent = `$${devRevenueString}` | ||
sumElem.setAttribute('align', 'right') | ||
newRow.appendChild(nameElem); | ||
newRow.appendChild(sumElem); | ||
newRow.appendChild(descElem); | ||
|
||
console.log("Steamworks Dev Net: Added summary net"); | ||
} | ||
|
||
var addSalesNetRow = () => { | ||
var parentElement = document.getElementById('gameDataLeft'); | ||
|
||
var childElements = parentElement.children; | ||
var divs = []; | ||
|
||
// Filter out only those children that are divs | ||
for (var i = 0; i < childElements.length; i++) { | ||
if (childElements[i].tagName === 'DIV') { | ||
divs.push(childElements[i]); | ||
} | ||
} | ||
|
||
var salesDiv = divs[3]; | ||
|
||
console.log(salesDiv); | ||
|
||
var salesTable = salesDiv.getElementsByTagName('table')[0]; | ||
|
||
var rows = salesTable.rows; | ||
console.log(rows); | ||
var revenueCell = rows[13].cells[2]; | ||
var revenue = revenueCell.textContent; | ||
revenue = revenue.replace('$', ''); | ||
revenue = revenue.replace(',', ''); | ||
console.log(Number(revenue)) | ||
var devRevenue = Number(revenue * 0.51); | ||
var devRevenueString = numberWithCommas(Math.floor(devRevenue)); | ||
|
||
var newRow = salesTable.insertRow(14); // Insert after net | ||
|
||
var nameElem = document.createElement('td'); | ||
var sumElem = document.createElement('td'); | ||
var spacerElem = document.createElement('td'); | ||
nameElem.innerHTML = '<b>Developer net revenue</b>'; | ||
sumElem.textContent = `$${devRevenueString}` | ||
sumElem.setAttribute('align', 'right') | ||
newRow.appendChild(nameElem); | ||
newRow.appendChild(spacerElem); | ||
newRow.appendChild(sumElem); | ||
|
||
console.log("Steamworks Dev Net: Added sales for date range net"); | ||
} | ||
|
||
console.log("Steamworks Dev Net: Begin"); | ||
|
||
addSummaryNetRow(); | ||
addSalesNetRow(); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"manifest_version": 3, | ||
"name": "Steamworks Dev Chrome Extension", | ||
"version": "1.0", | ||
"permissions": [ | ||
"activeTab" | ||
], | ||
"content_scripts": [ | ||
{ | ||
"matches": ["https://partner.steampowered.com/app/details/*"], | ||
"js": ["content_script.js"] | ||
} | ||
], | ||
"background": { | ||
}, | ||
"action": { | ||
}, | ||
"icons": { | ||
"16": "icon-16.png", | ||
"48": "icon-48.png", | ||
"128": "icon-128.png" | ||
} | ||
} |