Skip to content

Commit

Permalink
Merge pull request #200 from csfloat/feature/tradeoffer-id-annotate
Browse files Browse the repository at this point in the history
Shows Trade Offer ID In Trades Page
  • Loading branch information
Step7750 authored Apr 4, 2024
2 parents 9eb6847 + 5608bc2 commit 9682318
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
5 changes: 5 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
"matches": ["*://*.steamcommunity.com/tradeoffer/*"],
"js": ["src/lib/page_scripts/trade_offer.js"],
"css": ["src/global.css"]
},
{
"matches": ["*://*.steamcommunity.com/*/tradeoffers/*"],
"js": ["src/lib/page_scripts/trade_offers.js"],
"css": ["src/global.css"]
}
],
"background": {
Expand Down
28 changes: 28 additions & 0 deletions src/lib/components/trade_offers/offer_id.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {html} from 'lit';

import {CustomElement, InjectBefore, InjectionMode} from '../injectors';
import {FloatElement} from '../custom';
import '../common/ui/steam-button';
import {cache} from 'decorator-cache-getter';

@CustomElement()
@InjectBefore('.tradeoffer .tradeoffer_items_ctn', InjectionMode.CONTINUOUS)
export class ShowTradeOfferId extends FloatElement {
@cache
get tradeOfferID(): string {
const rawId = $J(this).parent().attr('id');
if (!rawId) {
return '';
}

return rawId.replace('tradeofferid_', '');
}

async connectedCallback() {
super.connectedCallback();
}

render() {
return html` <span>Trade Offer ID: ${this.tradeOfferID}</span>`;
}
}
6 changes: 6 additions & 0 deletions src/lib/page_scripts/trade_offers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {init} from './utils';
import '../components/trade_offers/offer_id';

init('src/lib/page_scripts/trade_offers.js', main);

function main() {}

0 comments on commit 9682318

Please sign in to comment.