Last active
June 24, 2020 18:11
-
-
Save alejandrocoding/f072191220f9d928e75041749ca222f7 to your computer and use it in GitHub Desktop.
Content script adding p element to show latest commit
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
try { | |
const authorAnchor = document.querySelector('.commit-author') as HTMLAnchorElement; | |
const commit = (authorAnchor.nextElementSibling as HTMLAnchorElement).href.split('commit/')[1]; | |
const p = document.createElement('p'); | |
p.classList.add('my-commit-msg'); | |
p.innerText = `Latest commit was: ${commit}`; | |
anchorMyBtn.parentNode.parentNode.prepend(p); | |
} catch { | |
console.error('Error retrieving last commit'); | |
} |
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
.my-commit-msg { | |
text-align: center; | |
padding: 10px; | |
margin-bottom: 25px; | |
border: 1px solid transparent; | |
border-radius: 5px; | |
background-color: aquamarine; | |
color: #333; | |
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment