From acf82a4e3e2c1732fa0f6d177e6848bf0679d81a Mon Sep 17 00:00:00 2001 From: Ashesh Vidyut Date: Thu, 21 Mar 2019 01:08:11 +0530 Subject: [PATCH] varaible name changed to more meaningful Co-authored-by: timvisee --- app/ui/faviconProgressbar.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/ui/faviconProgressbar.js b/app/ui/faviconProgressbar.js index b2ca84b5..551fb967 100644 --- a/app/ui/faviconProgressbar.js +++ b/app/ui/faviconProgressbar.js @@ -3,20 +3,21 @@ const assets = require('../../common/assets'); module.exports.updateFavicon = function(percentageString) { if (platform() === 'web') { - const percentage = parseInt(percentageString.replace('%', '')); - if (percentage === 0 || percentage === 100) { + let progress = parseInt(percentageString.replace('%', '')); + if (progress === 0 || progress === 100) { const link = document.querySelector("link[rel*='icon']"); link.type = 'image/png'; link.href = assets.get('favicon-32x32.png'); document.getElementsByTagName('head')[0].appendChild(link); return; } + progress = progress * 0.01; const link = document.querySelector("link[rel*='icon']"); const canvas = document.createElement('canvas'); const size = 32; - const lineWidth = 5; - const color = '#0090ed'; + const loaderWidth = 5; + const loaderColor = '#0090ed'; const span = document.createElement('span'); span.textContent = percentageString; @@ -25,7 +26,7 @@ module.exports.updateFavicon = function(percentageString) { context.translate(size / 2, size / 2); - const radius = (size - lineWidth) / 2; + const radius = (size - loaderWidth) / 2; const drawCircle = function(color, lineWidth, percent) { context.beginPath(); @@ -37,8 +38,8 @@ module.exports.updateFavicon = function(percentageString) { }; const drawNewFavicon = function() { - drawCircle('#efefef', lineWidth, 1); - drawCircle(color, lineWidth, percentage / 100); + drawCircle('#efefef', loaderWidth, 1); + drawCircle(loaderColor, loaderWidth, progress); }; drawNewFavicon(link);