[devdocsgjs/main: 704/1867] Fix favicon on HiDPI displays
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 704/1867] Fix favicon on HiDPI displays
- Date: Fri, 19 Nov 2021 23:47:25 +0000 (UTC)
commit c01982ca9add42352d8ffe1f9b83579d4fdd7892
Author: Jasper van Merle <jaspervmerle gmail com>
Date: Sun Aug 4 12:51:19 2019 +0200
Fix favicon on HiDPI displays
assets/javascripts/app/config.coffee.erb | 1 +
assets/javascripts/lib/favicon.coffee | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/assets/javascripts/app/config.coffee.erb b/assets/javascripts/app/config.coffee.erb
index dba368e0..a822f7e2 100644
--- a/assets/javascripts/app/config.coffee.erb
+++ b/assets/javascripts/app/config.coffee.erb
@@ -13,5 +13,6 @@ app.config =
version: <%= Time.now.to_i %>
release: <%= Time.now.utc.httpdate.to_json %>
mathml_stylesheet: '<%= App.cdn_origin %>/mathml.css'
+ favicon_spritesheet: '<%= image_path('sprites/docs.png') %>'
service_worker_path: '/service-worker.js'
service_worker_enabled: <%= App.environment == :production || ENV['ENABLE_SERVICE_WORKER'] == 'true' %>
diff --git a/assets/javascripts/lib/favicon.coffee b/assets/javascripts/lib/favicon.coffee
index 5254b54c..2f2d9f93 100644
--- a/assets/javascripts/lib/favicon.coffee
+++ b/assets/javascripts/lib/favicon.coffee
@@ -30,8 +30,8 @@ withImage = (url, action) ->
styles = window.getComputedStyle($("._icon-#{doc.slug.split('~')[0]}"), ':before')
- bgUrl = styles['background-image'].slice(5, -2)
- sourceSize = if bgUrl.includes('@2x') then 32 else 16
+ 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)))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]