Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into en
Browse files Browse the repository at this point in the history
  • Loading branch information
kabalin committed Nov 28, 2023
2 parents 4bc6ec6 + d4aa1e6 commit 85ca98b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 19 deletions.
1 change: 0 additions & 1 deletion public/js/lib/Browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ define([], function () {
}()),
cssAnimation: true,
chromeframe: false,
selectOptionFont: !(uA.indexOf('FIREFOX') >= 0 || navigator.platform.toUpperCase().indexOf('MAC') >= 0),
},
};

Expand Down
39 changes: 27 additions & 12 deletions public/js/module/photo/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
8 changes: 2 additions & 6 deletions public/js/module/photo/photo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
});
});

0 comments on commit 85ca98b

Please sign in to comment.