Last active
February 9, 2022 12:36
-
-
Save cia-rana/1e06e9bb5901e9f4e66400c1f4ddeef3 to your computer and use it in GitHub Desktop.
TamperMonkey
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name CCSpreadVisualizer | |
// @namespace http://hitoriblog.com/ | |
// @version 0.4 | |
// @description try to take over the world! | |
// @author moyashi | |
// @match https://coincheck.com/ja/exchange | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
function floatFormat( number, n ) { | |
var _pow = Math.pow( 10 , n ); | |
return Math.round( number * _pow ) / _pow; | |
} | |
var currencies = ["btc", "eth", "etc", "lsk", "fct", "xrp", "xem", "ltc", "bch", "mona", "xlm", "qtum", "bat", "iost", "enj"]; | |
$(document).ready(function(){ | |
$(".buy-link a").css("padding", "1px"); | |
$.each(currencies, function(index, elem) { | |
$("[href='/ja/buys?pair=" + elem + "_jpy']").append("<div class=\"currency-rate\"><p class=\"currency_desc ng-binding append\" style=\"width:80px; text-align:left\"><span style=\"color:green; font-weight: bold;\">買</span><span id=\"" + elem + "-buy-price\"></span></span><span class=\"currency_desc ng-binding append\" style=\"width:50px\">(<span id=\"" + elem + "-buy-difference\"></span>%)</p><p class=\"currency_desc ng-binding append\" style=\"width:100px; text-align:left\"><span style=\"color:red; font-weight: bold;\">売</span><span id=\"" + elem + "-sell-price\"></span></span><span class=\"currency_desc ng-binding append\" style=\"width:50px\">(<span id=\"" + elem + "-sell-difference\"></span>%)</p>"); | |
}); | |
}); | |
function updatePrice(currency) { | |
$.getJSON("https://coincheck.com/buys/rate?amount=10&pair=" + currency + "_jpy", function getFunc(myData){ | |
var price = parseFloat(myData.price / 10); | |
$("#" + currency + "-buy-price").text(floatFormat(price, 2)); | |
var org = parseFloat($("[href='/ja/buys?pair=" + currency + "_jpy'] p:contains('円')").text().replace("円", "")); | |
var difference = floatFormat((price / org - 1) * 100, 2); | |
$("#" + currency + "-buy-difference").text(difference); | |
$.getJSON("https://coincheck.com/sells/rate?amount=10&pair=" + currency + "_jpy", function getFunc(myData){ | |
var price = parseFloat(myData.price / 10); | |
$("#" + currency + "-sell-price").text(floatFormat(price, 2)); | |
var org = parseFloat($("[href='/ja/buys?pair=" + currency + "_jpy'] p:contains('円')").text().replace("円", "")); | |
var difference = floatFormat((org / price - 1) * 100, 2); | |
$("#" + currency + "-sell-difference").text(difference); | |
}); | |
}); | |
} | |
function update() { | |
$.each(currencies, function(index, elem) { | |
updatePrice(elem); | |
}); | |
} | |
update(); | |
$(".currency_yen").on('DOMSubtreeModified propertychange', function() { | |
update(); | |
}); | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Close YouTube Ads | |
// @namespace https://tampermonkey.net/ | |
// @version 0.3 | |
// @description try to take over the world! | |
// @author cia-rana | |
// @match https://www.youtube.com/* | |
// ==/UserScript== | |
setInterval( | |
()=>{ | |
[ | |
"ytp-ad-overlay-close-button", | |
"ytp-ad-clickable", | |
].map(e=> | |
Array.from(document.getElementsByClassName(e))) | |
.flat() | |
.forEach(e=>e.click()) | |
}, | |
30 | |
); | |
setInterval( | |
()=>{ | |
if (!search_click_btn("//button[@role='button']")) { | |
return; | |
} | |
if (!search_click_btn("//button/span[text()='続行']")) { | |
return; | |
} | |
if (!search_click_btn("//button[@aria-label='閉じる']")) { | |
return; | |
} | |
}, | |
30 | |
); | |
let search_click_btn = (xpath) => { | |
console.log(xpath) | |
let btn = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; | |
if (btn === null) { | |
return false; | |
} | |
btn.click(); | |
return true; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment