Skip to content

Commit c01982c

Browse files
committed
Fix favicon on HiDPI displays
1 parent 8d57c48 commit c01982c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

assets/javascripts/app/config.coffee.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ app.config =
1313
version: <%= Time.now.to_i %>
1414
release: <%= Time.now.utc.httpdate.to_json %>
1515
mathml_stylesheet: '<%= App.cdn_origin %>/mathml.css'
16+
favicon_spritesheet: '<%= image_path('sprites/docs.png') %>'
1617
service_worker_path: '/service-worker.js'
1718
service_worker_enabled: <%= App.environment == :production || ENV['ENABLE_SERVICE_WORKER'] == 'true' %>

assets/javascripts/lib/favicon.coffee

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ withImage = (url, action) ->
3030

3131
styles = window.getComputedStyle($("._icon-#{doc.slug.split('~')[0]}"), ':before')
3232

33-
bgUrl = styles['background-image'].slice(5, -2)
34-
sourceSize = if bgUrl.includes('@2x') then 32 else 16
33+
bgUrl = app.config.favicon_spritesheet
34+
sourceSize = 16
3535
sourceX = Math.abs(parseInt(styles['background-position-x'].slice(0, -2)))
3636
sourceY = Math.abs(parseInt(styles['background-position-y'].slice(0, -2)))
3737

0 commit comments

Comments
 (0)