Skip to content

Instantly share code, notes, and snippets.

@1v
Last active March 28, 2024 16:37
Show Gist options
  • Save 1v/fa3d41bf43c63d960e2b48dd8312e340 to your computer and use it in GitHub Desktop.
Save 1v/fa3d41bf43c63d960e2b48dd8312e340 to your computer and use it in GitHub Desktop.
BestChange.ru - выделить избранные обменники
// ==UserScript==
// @name BestChange
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Highlights favorite exchanges
// @homepage https://gist.github.com/1v/fa3d41bf43c63d960e2b48dd8312e340
// @match https://www.bestchange.ru/*
// @match https://www.bestchange.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=bestchange.ru
// @require https://code.jquery.com/jquery-3.7.1.min.js
// @grant none
// ==/UserScript==
const favoriteExchanges = [
"AlfaBit",
"NetEx24",
"Finex24",
"Шахта",
"CoinDrop",
"WorldChange"
]
const blacklistedExchanges = [
"BitExchanger", // stand with ukraine
"WestChange", // country: ukraine
"CoinFusion", // country: ukraine
"24BestEx", // country: ukraine
"Ukr-Obmen", // country: ukraine
"Transfer24", // country: ukraine
"CryptoBox", // country: ukraine
"TraiderIdeal", // country: ukraine
"VV-Obmen", // country: ukraine
"UAchanger", // country: ukraine
"BitcoinObmennik", // country: ukraine
"CryptoChicken", // country: ukraine
"WmMoney", // country: ukraine
"First-BTC", // country: ukraine
"Crybex", // country: ukraine
"BTCSale", // slow exchange, slow support
]
function highlight() {
function filterExchange(exchangeName) {
return function() {
return $(this).text().toLowerCase().includes(exchangeName.toLowerCase())
}
}
favoriteExchanges.map(exchangeName => {
$("#rates_block td").filter(filterExchange(exchangeName)).css("font-weight", "bold")
})
blacklistedExchanges.map(exchangeName => {
$("#rates_block td").filter(filterExchange(exchangeName))
.css("text-decoration", "line-through").css("text-decoration-thickness", "30%")
})
}
highlight()
function mutationCallback(mutationList) {
mutationList.forEach( (mutation) => {
if (mutation.target.id !== "rates_block") return
highlight()
})
}
const targetNode = document.querySelector("#content_rates")
const observerOptions = {
childList: true,
subtree: true
}
const observer = new MutationObserver(mutationCallback)
observer.observe(targetNode, observerOptions)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment