[devdocsgjs/main: 925/1867] Fix various favicon-related Sentry issues
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 925/1867] Fix various favicon-related Sentry issues
- Date: Fri, 19 Nov 2021 23:47:35 +0000 (UTC)
commit 782429ca02ff13c2cdada9a6d02cff33530e81bf
Author: Jasper van Merle <jaspervmerle gmail com>
Date: Thu Sep 5 14:21:23 2019 +0200
Fix various favicon-related Sentry issues
assets/javascripts/lib/favicon.coffee | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/assets/javascripts/lib/favicon.coffee b/assets/javascripts/lib/favicon.coffee
index 8f3708e4..696bd784 100644
--- a/assets/javascripts/lib/favicon.coffee
+++ b/assets/javascripts/lib/favicon.coffee
@@ -28,12 +28,19 @@ withImage = (url, action) ->
currentSlug = doc.slug
return
- styles = window.getComputedStyle($("._icon-#{doc.slug.split('~')[0]}"), ':before')
+ iconEl = $("._icon-#{doc.slug.split('~')[0]}")
+ return if iconEl == null
+
+ styles = window.getComputedStyle(iconEl, ':before')
+
+ backgroundPositionX = styles['background-position-x']
+ backgroundPositionY = styles['background-position-y']
+ return if backgroundPositionX == undefined || backgroundPositionY == undefined
bgUrl = app.config.favicon_spritesheet
sourceSize = 16
- sourceX = Math.abs(parseInt(styles['background-position-x'].slice(0, -2)))
- sourceY = Math.abs(parseInt(styles['background-position-y'].slice(0, -2)))
+ sourceX = Math.abs(parseInt(backgroundPositionX.slice(0, -2)))
+ sourceY = Math.abs(parseInt(backgroundPositionY.slice(0, -2)))
withImage(bgUrl, (docImg) ->
withImage(defaultUrl, (defaultImg) ->
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]