Last active
May 10, 2018 01:59
-
-
Save vhoyer/63759ab3488b4540fd1a453c1cc78edb 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
excelIt = async () => { | |
let text = ""; | |
let unread = document.querySelectorAll(".emails-list-item.email-unreaded > a"); | |
unread.forEach(e => { | |
e.click(); | |
await new Promise(resolve => setTimeout(resolve, 10000)); | |
var iframe = document.querySelector("iframe").contentDocument; | |
var itables = iframe.querySelectorAll("td.mobile-center>table>tbody>tr>td>table>tbody>tr>td>table>tbody"); | |
var commitsContainer = iframe.querySelector("body > div.container > table > tbody > tr > td:nth-child(2) > table > tbody > tr:nth-child(4) > td > table > tbody > tr > td > table > tbody > tr:nth-child(2) > td > table > tbody").querySelectorAll("tr>td"); | |
var author = iframe.querySelector("body > div.container > table > tbody > tr > td:nth-child(2) > table > tbody > tr:nth-child(2) > td > table > tbody > tr > td > table > tbody > tr > td > table > tbody > tr:nth-child(1) > td").innerHTML.trim().replace(" pushed new changes", ""); | |
var commits = ""; | |
commitsContainer.forEach(e => { | |
try { | |
let a = e.querySelector("a").innerHTML.trim() | |
commits += a + ": "; | |
} catch { | |
commits += e.innerHTML.trim() + "\n"; | |
} | |
}); | |
var project = iframe.querySelector("div.container>table>tbody>tr>td>table>tbody>tr>td>table>tbody>tr>td>table>tbody>tr>td:nth-child(2)").innerHTML.trim(); | |
var time = document.querySelector("div.message-date-desktop.ng-binding").innerHTML.replace(/Enviado em:\n[ \t]*/,"").split(" | ")[0].trim(); | |
let coArr = commits.split("\n") | |
coArr.pop() | |
text = coArr.reduce((acc, cur) => { | |
return `${acc}${author}\t${cur}\t${project}\t${time}\n` | |
}, text); | |
}) | |
// | |
//COPY TEXT TO CLIPBOARD | |
// | |
document.querySelector("body").insertAdjacentHTML("beforeend",`<div id="clipboard-container" style=" | |
position: fixed; | |
left: 0px; | |
top: 0px; | |
width: 0px; | |
height: 0px; | |
z-index: 100; | |
opacity: 0;"><textarea id="clipboard" style=" | |
width: 1px; | |
height: 1px; | |
padding: 0px;">${text}</textarea></div>`); | |
//Get Input Element | |
document.getElementById("clipboard").select(); | |
//Copy Content | |
document.execCommand("copy"); | |
document.querySelector('#clipboard-container').remove(); | |
return text; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment