Faction and Company ID fixes
- Remove random event listener that didn't make any sense to be there (... I think)
- Remove debugging console statements
- Code style changes for readability
We should keep the listener as changing between companies on joblist.php will trigger the custom event and have the ID updated.
You should also add caching to the company ID call as it will mostly not change.
hashes.get returns null when the key/value pair isn't found, and isIntNumber(null) returns true, causing the final two case checks to always return true. Perhaps the built-in isIntNumber should also do a null check first? Would love to check this before making any changes
function isIntNumber(number) {
if (number == null) return false; // number == null is true for null and undefined, but false for 0 and NaN.
// could also do a strict check as undefined is caught by the function below, it doesn't really matter
return !isNaN(number) && isFinite(number) && number % 1 === 0; // already existing logic
}
You're right about the company pages, I knew there must have been a reason for having it in the first place. The only issue is this event listener also fires on opening the employees tab on your own company page, so I'll likely just add a pathname check in the callback.

Good call with the caching, I'll get that done as well, thanks!
Yes, a check so that the custom event listener is applied only for job listings should work.
I suggest isIntNumber as:
function isIntNumber(number) {
return number !== null && !isNaN(number) && isFinite(number) && number % 1 === 0;
}
undefined already returns false so no == needed.
Updated, and the faction ID feature has also been updated to match.
- Add a new element rather than modifying element text directly
- Double check the element doesn't already exist before inserting
- Cache the data for half a week (3.5 days, yes this is a weird value but I had no idea what else would be better... edits are open if you've got a better idea)
Both features are much more readable now in my opinion.