Fix various favicon-related Sentry issues

pull/1086/head
Jasper van Merle 5 years ago
parent fa2fab7d7d
commit 782429ca02

@ -28,12 +28,19 @@ withImage = (url, action) ->
currentSlug = doc.slug currentSlug = doc.slug
return 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 bgUrl = app.config.favicon_spritesheet
sourceSize = 16 sourceSize = 16
sourceX = Math.abs(parseInt(styles['background-position-x'].slice(0, -2))) sourceX = Math.abs(parseInt(backgroundPositionX.slice(0, -2)))
sourceY = Math.abs(parseInt(styles['background-position-y'].slice(0, -2))) sourceY = Math.abs(parseInt(backgroundPositionY.slice(0, -2)))
withImage(bgUrl, (docImg) -> withImage(bgUrl, (docImg) ->
withImage(defaultUrl, (defaultImg) -> withImage(defaultUrl, (defaultImg) ->

Loading…
Cancel
Save