Created
January 2, 2018 16:22
-
-
Save iursevla/ddb35833291b77a7280810d54d9a6902 to your computer and use it in GitHub Desktop.
This file contains 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 New Userscript | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://coinmarketcap.com/ | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
console.log("Tampermonkey for Coinmarketcap.com"); | |
let tableBody = document.createElement('tbody'); | |
let listOfGoodCoins = ['id-maidsafecoin', 'id-ark', 'id-omisego', 'id-factom', 'id-ubiq', 'id-civic']; | |
let index = 0; | |
for(const coin of listOfGoodCoins){ | |
let domElem = document.getElementById(coin); | |
let elem = document.createElement('tr'); | |
elem.innerHTML = domElem.innerHTML; | |
//console.log(elem.innerHTML); | |
if(index++ % 2 === 0) | |
elem.style.backgroundColor = 'pink'; | |
// else | |
// elem.style.backgroundColor = '#47C0C2'; | |
elem.style.border = '5px solid'; | |
tableBody.appendChild(elem); | |
// Go to each coin value and write to localstorage and next time load it's value from the local Storage | |
} | |
console.log( getTabeBody(tableBody.innerHTML)); | |
let htmlDiv = document.createElement('div'); | |
htmlDiv.innerHTML = getTabeBody(tableBody.innerHTML); | |
document.getElementsByClassName('container')[0].appendChild(htmlDiv); | |
//Add result to the dom | |
})(); | |
function getTabeBody(tableBodyHTML){ | |
return ` | |
<div class="col-xs-12"> | |
<div id="currencies_wrapper" class="dataTables_wrapper no-footer"><table class="table dataTable no-footer" id="currencies" role="grid"> | |
<thead> | |
<tr role="row"><th class="text-center sorting_asc" rowspan="1" colspan="1" aria-label="#" style="width: 23px;">#</th><th id="th-name" class="sortable sorting" tabindex="0" aria-controls="currencies" rowspan="1" colspan="1" aria-label="Name: activate to sort column ascending" style="width: 167px;">Name</th><th id="th-marketcap" class="sortable text-right sorting" tabindex="0" aria-controls="currencies" rowspan="1" colspan="1" aria-label="Market Cap: activate to sort column descending" style="width: 115px;">Market Cap</th><th id="th-price" class="sortable text-right sorting" tabindex="0" aria-controls="currencies" rowspan="1" colspan="1" aria-label="Price: activate to sort column descending" style="width: 73px;">Price</th><th id="th-totalsupply" class="sortable text-right sorting" title="The number of coins in existence available to the public" tabindex="0" aria-controls="currencies" rowspan="1" colspan="1" aria-label="Circulating Supply: activate to sort column descending" style="width: 169px;">Circulating Supply</th><th id="th-volume" class="sortable text-right sorting" tabindex="0" aria-controls="currencies" rowspan="1" colspan="1" aria-label="Volume (24h): activate to sort column descending" style="width: 110px;">Volume (24h)</th><th id="th-change" class="sortable text-right sorting" tabindex="0" aria-controls="currencies" rowspan="1" colspan="1" aria-label="% Change (24h): activate to sort column descending" style="width: 115px;">% Change (24h)</th><th id="th-marketcap-graph" class="sorting_disabled" rowspan="1" colspan="1" aria-label="Price Graph (7d)" style="width: 162px;">Price Graph (7d)</th></tr> | |
</thead> | |
<tbody> | |
${tableBodyHTML} | |
</tbody> | |
</table> | |
</div> | |
<div class="pull-right"> | |
<ul class="pagination bottom-paginator"> | |
<li><a href="2">Next 100 →</a></li> | |
<li><a href="/all/views/all/">View All</a></li> | |
</ul> | |
</div> | |
<div id="asterisks"> * Not Mineable <br> ** Significantly Premined </div> | |
</div> | |
`; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment