History

Fix various favicon-related Sentry issues

Jasper van Merle committed 7 years ago

Commit 782429c1 parent fa2fab71 file · +10 −3Browse files

Showing the changes to assets/javascripts (1 of 1 file). Show all

Unified · Split

assets/javascripts/lib/favicon.coffee+10−3
@@ -28,12 +28,19 @@ withImage = (url, action) -> · 27 unmodified lines
28 currentSlug = doc.slug28 currentSlug = doc.slug
29 return29 return
30 30
31 styles = window.getComputedStyle($("._icon-#{doc.slug.split('~')[0]}"), ':before')31 iconEl = $("._icon-#{doc.slug.split('~')[0]}")
32 return if iconEl == null
33
34 styles = window.getComputedStyle(iconEl, ':before')
35
36 backgroundPositionX = styles['background-position-x']
37 backgroundPositionY = styles['background-position-y']
38 return if backgroundPositionX == undefined || backgroundPositionY == undefined
32 39
33 bgUrl = app.config.favicon_spritesheet40 bgUrl = app.config.favicon_spritesheet
34 sourceSize = 1641 sourceSize = 16
35 sourceX = Math.abs(parseInt(styles['background-position-x'].slice(0, -2)))42 sourceX = Math.abs(parseInt(backgroundPositionX.slice(0, -2)))
36 sourceY = Math.abs(parseInt(styles['background-position-y'].slice(0, -2)))43 sourceY = Math.abs(parseInt(backgroundPositionY.slice(0, -2)))
37 44
38 withImage(bgUrl, (docImg) ->45 withImage(bgUrl, (docImg) ->
39 withImage(defaultUrl, (defaultImg) ->46 withImage(defaultUrl, (defaultImg) ->