From 51b8e7b93a94b4aafa5edb0249d5dab64d60d510 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Mon, 19 Jan 2015 21:50:16 +0300 Subject: [PATCH] Minor stylefixes --- app/css/app.css | 1 + app/js/services.js | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/app/css/app.css b/app/css/app.css index 31d36c6d..a65e8e92 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -10,6 +10,7 @@ body { background: none; font: 12px/18px 'Open Sans', "Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica, Verdana, sans-serif; overflow: visible; + overflow-x: hidden; } body.non_osx { font: 13px/18px Tahoma, sans-serif, Arial, Helvetica; diff --git a/app/js/services.js b/app/js/services.js index b183d6d8..9229ec7d 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -3599,8 +3599,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) var nextSoundAt = false; var prevSoundVolume = false; var peerSettings = {}; - var faviconBackupEl = $('link[rel="icon"]:first'), - faviconNewEl = $(''); + var faviconEl = $('link[rel="icon"]:first')[0]; var langNotificationsPluralize = _.pluralize('page_title_pluralize_notifications'); var titleBackup = document.title, @@ -3614,7 +3613,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) $interval.cancel(titlePromise); if (!newVal) { document.title = titleBackup; - $('link[rel="icon"]:first').replaceWith(faviconBackupEl); + setFavicon(); } else { titleBackup = document.title; @@ -3622,13 +3621,10 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) var time = tsNow(); if (!notificationsCount || time % 2000 > 1000) { document.title = titleBackup; - var curFav = $('link[rel="icon"]:first'); - if (curFav.attr('href').indexOf('favicon_unread') != -1) { - curFav.replaceWith(faviconBackupEl); - } + setFavicon(); } else { document.title = langNotificationsPluralize(notificationsCount); - $('link[rel="icon"]:first').replaceWith(faviconNewEl); + setFavicon('favicon_unread.ico'); } }, 1000); } @@ -3687,6 +3683,15 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) }); } + function setFavicon (href) { + var link = document.createElement('link'); + link.rel = 'shortcut icon'; + link.type = 'image/x-icon'; + link.href = href || 'favicon.ico'; + faviconEl.parentNode.replaceChild(link, faviconEl); + faviconEl = link; + } + function savePeerSettings (peerID, settings) { // console.trace(dT(), 'peer settings', peerID, settings); peerSettings[peerID] = $q.when(settings);