Skip to content

Instantly share code, notes, and snippets.

@wispborne
Last active December 22, 2020 19:19
Show Gist options
  • Save wispborne/55de0286b5dafdadf7c01022a64cd566 to your computer and use it in GitHub Desktop.
Save wispborne/55de0286b5dafdadf7c01022a64cd566 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Inara Engineer Tweaks
// @namespace reddit.com/r/EliteDangerous
// @match https://inara.cz/galaxy-engineers/
// @grant GM_addStyle
// @version 1.1 (Dec 2020)
// @author /u/Locust377
// @description - G5s are highlighted - Engineers that are more than 10,000ly away from me are "hidden"
// ==/UserScript==
GM_addStyle(`
.highlighted {
font-weight: bold;
color: #faf;
font-size: 1em !important;
}
.silenced {
opacity: 0.1 !important;
}
`);
window.onload = () => {
const highlightClass = 'highlighted';
const silencedClass = 'silenced';
const lightyearRegex = /( \d+|\d{1,3}(,\d{3})*)(\.\d+)?/;
document.querySelectorAll('.engineerslistportraitcontainer .engineeritemsinfo .smaller').forEach(e => {
if (e.innerHTML.startsWith('G5')) {
e.classList.add(highlightClass);
e.nextElementSibling.classList.add(highlightClass);
}
});
document.querySelectorAll('.engineerslistportraitcontainer .engineerlocationinfo a .minor').forEach(e => {
const ly = Number(lightyearRegex.exec(e.innerHTML)[0].replace(',',''));
ly && ly > 10000 && e.closest('.engineerslistportraitcontainer').classList.add(silencedClass);
console.log(ly);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment