From 42272c9164e5e329b0bb21f44840fe682d88920b Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Thu, 19 May 2016 21:51:54 +0200 Subject: [PATCH] CSS fix + preparation for the new peers photos --- css/style.css | 2 +- js/public/app.js | 18 ++++++++++++++++++ templates/main.php | 4 ++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/css/style.css b/css/style.css index db0530c..a763b61 100644 --- a/css/style.css +++ b/css/style.css @@ -37,7 +37,7 @@ padding: 0 12px; } #app-mailbox-peers li > a { - display: block; + display: inline-block; overflow: hidden; -moz-box-sizing: border-box; box-sizing: border-box; white-space: nowrap; diff --git a/js/public/app.js b/js/public/app.js index ab1ac72..081b0f0 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -32,6 +32,24 @@ function arrayUnique(arr) { }); } +// Imported from ownCloud contact app +app.filter('peerColor', function() { + return function(input) { + // Check if core has the new color generator + if(typeof input.toHsl === 'function') { + var hsl = input.toHsl(); + return 'hsl('+hsl[0]+', '+hsl[1]+'%, '+hsl[2]+'%)'; + } else { + // If not, we use the old one + /* global md5 */ + var hash = md5(input).substring(0, 4), + maxRange = parseInt('ffff', 16), + hue = parseInt(hash, 16) / maxRange * 256; + return 'hsl(' + hue + ', 90%, 65%)'; + } + }; +}); + app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile', function ($scope, $interval, $timeout, $compile) { $scope.buttons = [ diff --git a/templates/main.php b/templates/main.php index 3a7a5d4..fd8584d 100644 --- a/templates/main.php +++ b/templates/main.php @@ -10,8 +10,8 @@ use \OCA\OcSms\Lib\CountryCodes;