mirror of
https://github.com/MeiK2333/github-style.git
synced 2025-10-07 01:54:06 +00:00
Fix twitter javascript
When you hate twitter/ X after how awful it's got since Musk bought it, the code will throw a fatal error as `twitterIconElement` is `NULL` when unused - so `setAttribute()` isn't callable.
This commit is contained in:
@@ -208,13 +208,15 @@ var style = localStorage.getItem('data-color-mode');
|
||||
iconElement = document.getElementById('github-icon');
|
||||
twitterIconElement = document.getElementById('twitter-icon');
|
||||
if (style == 'light') {
|
||||
iconElement.setAttribute('fill', '#24292e');
|
||||
twitterIconElement.setAttribute("fill","black")
|
||||
if (iconElement) iconElement.setAttribute('fill', '#24292e');
|
||||
if (twitterIconElement) twitterIconElement.setAttribute("fill","black")
|
||||
}
|
||||
else {
|
||||
if (iconElement) {
|
||||
iconElement.removeAttribute('fill');
|
||||
iconElement.setAttribute('class', 'octicon');
|
||||
iconElement.setAttribute('color', '#f0f6fc');
|
||||
twitterIconElement.setAttribute("fill","white")
|
||||
}
|
||||
if (twitterIconElement) twitterIconElement.setAttribute("fill","white")
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user