I noticed a ton of scripts just broke due to recent updates to the website.
Per cloudjumper's reply to one of the bug threads:
This is basically on the script writers to fix, not for Torn devs. Torn uses React with CSS modules, which generates class names like status-icons___xYz123 where the suffix is a hash that changes between builds. Never hardcode the full class name - it will break when Torn deploys updates. Based on what the devs have told me, this is just down to bad scripting practices. You need to reach out to the script writers to get the issue fixed.
Closing and locking the report.
Examining a lot of the scripts I use which broke, I found that they all fall victim to hardcoding the react generated class names instead of an attribute selector with substring matching.
Using cloudjumper's example, here is how you can fix it to not have to fix this again in the future.
Change
document.querySelector('status-icons___xYz123');
To
document.querySelector('[class^="status-icons___"]');
This tells querySelector to search for any elements whose class name starts with status-icons___ and completely ignores the randomly generated react class name ending.
Here are my selectors for many different native torn elements in the code for my torn-stock-pocket script. Personally I omit most of the 3 underscores ___ just for the sake of readability.
export const STOCK_MARKET_SELECTOR = 'div[class^="stockMarket"]'
export const STOCK_DROPDOWN_ID = 'panel-ownedTab'
export const BUY_BUTTON_SELECTOR = '#panel-ownedTab button[class*="buy_"]'
export const SELL_BUTTON_SELECTOR = '#panel-ownedTab button[class*="sell_"]'
export const STOCK_LIST_SELECTOR = '#stockmarketroot > div[class^="stockMarket"] ul'
export const STOCK_NAME_SELECTOR = 'li[class^="stockName"]'
export const STOCK_ACRONYM_SELECTOR = '[data-acronym]'
export const STOCK_ACRONYM_ATTRIBUTE = 'data-acronym'
export const STOCK_AMOUNT_OWNED_SELECTOR = "p[class^='count_']"
export const STOCK_ICON_SVG_URL = 'https://www.torn.com/images/v2/stock-market/dark-mode/logos/'
Mentions: [Script] Stock Pocket: 1-click highly configurable buy/sell stock buttons, sell/buy by $ amount