Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Endzeitspiel: Freie Händler Skript
(() => {
if (window.location.search.indexOf('cms=haendler') === -1) {
return;
}
const $buy = $('[name="kaufen"]');
const $buyMainTable = $buy.next('table');
const $buyTables = $buyMainTable.find('table');
const $sell = $('[name="verkaufen"]');
const $sellMainTable = $sell.next('table');
const $sellTables = $sellMainTable.find('table');
function extractSellInformation($table) {
const resType = $table.find('tbody tr:first-child td:last-child b').text().trim();
const singleCost = $table.find('tbody tr:nth-child(2) td:last-child').text().trim();
const maxAmount = $table.find('tbody tr:nth-child(3) td:last-child').text().trim();
return `<p><strong>${resType}</strong><br />Kaufpreis: ${singleCost}<br />Maximum: ${maxAmount}</p>`;
}
function extractBuyInformation($table) {
const resType = $table.find('tbody tr:first-child td:last-child b').text().trim();
const singleCost = $table.find('tbody tr:nth-child(2) td:last-child').text().trim();
return `<p><strong>${resType}</strong><br />Verksaufpreis: ${singleCost}</p>`;
}
const text = ['<div style="display: flex;"><div style="flex: 1;"><strong>Kaufen</strong><br /><br />'];
$buyTables.each((index, table) => text.push(extractSellInformation($(table))));
text.push('</div><div style="flex: 1;"><strong>Verkaufen</strong><br/><br />');
$sellTables.each((index, table) => text.push(extractBuyInformation($(table))));
text.push('</div></div>');
const ressWindow = window.open('', 'Endzeitspiel Handelsseite', 'width=400,height=500');
ressWindow.document.body.innerHTML = text.join('');
ressWindow.document.body.style.padding = '1rem'
const style = document.createElement('link');
style.href = 'https://endzeitspiel.de/assets/css/endzeitspiel.css';
style.rel = 'stylesheet';
ressWindow.document.head.appendChild(style);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.