diff --git a/public/js/lib/Browser.js b/public/js/lib/Browser.js index b0bf54b5..32d698b0 100644 --- a/public/js/lib/Browser.js +++ b/public/js/lib/Browser.js @@ -67,7 +67,6 @@ define([], function () { }()), cssAnimation: true, chromeframe: false, - selectOptionFont: !(uA.indexOf('FIREFOX') >= 0 || navigator.platform.toUpperCase().indexOf('MAC') >= 0), }, }; diff --git a/public/js/module/photo/fields.js b/public/js/module/photo/fields.js index 84907a18..6dc56389 100644 --- a/public/js/module/photo/fields.js +++ b/public/js/module/photo/fields.js @@ -3,8 +3,34 @@ * GNU Affero General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/agpl.txt) */ -define(['m/photo/status'], function () { +define(['Browser'], function (Browser) { + const dirIcons = { + // Arrows are not unified accross browsers and platforms. + // The choices we use [default, FF, Mac]. + n: ['', '🡡', '↑'], + ne: ['', '🡥', '↗'], + e: ['', '🡢', '→'], + se: ['', '🡦', '↘'], + s: ['', '🡣', '↓'], + sw: ['', '🡧', '↙'], + w: ['', '🡠', '←'], + nw: ['', '🡤', '↖'], + aero: ['', '◎', '◎'], + }; + + const getDirIcon = function (dir) { + const iconIndex = Browser.platform.indexOf('MAC') >= 0 ? 2 : Browser.name === 'FIREFOX' ? 1 : 0; + + if (iconIndex === 2 && !(dir === 'e' || dir === 'w' || dir === 'aero')) { + // Ugly hack to align text in options on Mac. + return dirIcons[dir][iconIndex] + ' '; + } + + return dirIcons[dir][iconIndex]; + }; + return { + getDirIcon: getDirIcon, s: 'Status', y: 'Year', geo: 'Coordinates', @@ -32,17 +58,6 @@ define(['m/photo/status'], function () { nw: 'Northwest', aero: 'Aero/Satellite', }, - dirIcons: { - n: ['', '🡡'], - ne: ['', '🡥'], - e: ['', '🡢'], - se: ['', '🡦'], - s: ['', '🡣'], - sw: ['', '🡧'], - w: ['', '🡠'], - nw: ['', '🡤'], - aero: ['', '◎'], - }, dirValsArr: ['w', 'nw', 'n', 'ne', 'e', 'se', 's', 'sw', 'aero'], watersign: { 'title': 'Text on picture\'s watermark', diff --git a/public/js/module/photo/photo.js b/public/js/module/photo/photo.js index 225b3731..c9869475 100644 --- a/public/js/module/photo/photo.js +++ b/public/js/module/photo/photo.js @@ -2227,17 +2227,13 @@ define(['underscore', 'Utils', 'Browser', 'socket!', 'Params', 'knockout', 'knoc setDirOptionHTML: function (option, item) { // Render option content as html to decode entitites. if (item !== undefined) { - const iconIndex = Browser.support.selectOptionFont ? 0 : 1; - ko.applyBindingsToNode(option, { - html: fields.dirIcons[item][iconIndex] + ' ' + fields.dirVals[item], + html: fields.getDirIcon(item) + ' ' + fields.dirVals[item], }); } }, getDirIcon: function (dir) { - const iconIndex = Browser.support.selectOptionFont ? 0 : 1; - - return fields.dirIcons[dir][iconIndex]; + return fields.getDirIcon(dir); }, }); });