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');
|
iconElement = document.getElementById('github-icon');
|
||||||
twitterIconElement = document.getElementById('twitter-icon');
|
twitterIconElement = document.getElementById('twitter-icon');
|
||||||
if (style == 'light') {
|
if (style == 'light') {
|
||||||
iconElement.setAttribute('fill', '#24292e');
|
if (iconElement) iconElement.setAttribute('fill', '#24292e');
|
||||||
twitterIconElement.setAttribute("fill","black")
|
if (twitterIconElement) twitterIconElement.setAttribute("fill","black")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
iconElement.removeAttribute('fill');
|
if (iconElement) {
|
||||||
iconElement.setAttribute('class', 'octicon');
|
iconElement.removeAttribute('fill');
|
||||||
iconElement.setAttribute('color', '#f0f6fc');
|
iconElement.setAttribute('class', 'octicon');
|
||||||
twitterIconElement.setAttribute("fill","white")
|
iconElement.setAttribute('color', '#f0f6fc');
|
||||||
|
}
|
||||||
|
if (twitterIconElement) twitterIconElement.setAttribute("fill","white")
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user