Created
April 29, 2019 23:04
-
-
Save cikal/02e1d02faba9268f8e4414ccbe72811a to your computer and use it in GitHub Desktop.
JS dpr ri
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
document.getElementsByTagName('head')[0].appendChild(document.createElement('script')).src = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js' | |
setTimeout(function() { | |
let csvContent = "data:text/csv;charset=utf-8,"; | |
var tabel = []; | |
$('tbody tr').each(function() { | |
var tr = []; | |
tr.push($(this).find('td > span:nth-child(1)').eq(0).text().trim()) | |
tr.push($(this).find('td > span:nth-child(2)').eq(0).text().trim().replace('(','').replace(/\,/g, '.').replace(')','')) | |
for(let i = 1; i <= 16; i++) { | |
tr.push($(this).find('td').eq(i).text().trim().replace(/\./g, '')) | |
} | |
tabel.push(tr); | |
}) | |
tabel.forEach(function(rowArray) { | |
let row = rowArray.join(","); | |
csvContent += row + "\r\n"; | |
}); | |
var encodedUri = encodeURI(csvContent); | |
var link = document.createElement("a"); | |
link.setAttribute("href", encodedUri); | |
link.setAttribute("download", "dpr_ri.csv"); | |
document.body.appendChild(link); // Required for FF | |
link.click(); | |
}, 1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment