Skip to content

Instantly share code, notes, and snippets.

@drifterz28
Created April 25, 2019 16:30
Show Gist options
  • Save drifterz28/d2ff7032d778f9ca3017b569a4021c34 to your computer and use it in GitHub Desktop.
Save drifterz28/d2ff7032d778f9ca3017b569a4021c34 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://barnoneauction.hibid.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
setTimeout(() => {
const prices = document.querySelectorAll('.lot-high-bid, .lot-price-realized');
[...prices].forEach(price => {
const cleanPrice = +price.textContent.replace('USD', '').replace(',', '').trim();
const feePercent = cleanPrice > 1500 ? 12 : 17;
const fee = (feePercent / 100 * cleanPrice);
const total = cleanPrice + fee;
price.textContent = `${cleanPrice.toFixed(2)} + ${fee.toFixed(2)} = ${total.toFixed(2)}`;
});
}, 1500);
/*const exportBtn = document.querySelector('.navbar-text.btn-toolbar.m-b-0.m-t');
exportBtn.insertAdjacentHTML('beforeend', '<button class="js-export btn btn-default btn-sm">Export</button>');
document.querySelector('.js-export').addEventListener('click', () => {
const lotList = document.getElementById('lot-list');
const carList = lotList.querySelectorAll('tbody tr');
let exportData = [];
[].forEach.call(carList, (lot) => {
if(!lot.classList.contains('group')) {
const lotLink = lot.querySelector('.inline-lot-number-lead');
const lotTitle = lotLink.textContent;
const carLink = lotLink.href;
const saleDate = lot.querySelector('.lot-date-sold').textContent;
const saleStatus = lot.querySelector('.lot-price-realized').textContent;
const salebid = lot.querySelector('.lot-bid-max').textContent;
const bidStatus = lot.querySelector('.lot-status').textContent;
exportData.push([lotTitle, carLink, saleDate, saleStatus, salebid, bidStatus]);
}
});
console.log(JSON.stringify(exportData));
});*/
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment