Move platform check to FeatureDetector

This commit is contained in:
Enrico Monese 2017-03-26 16:46:26 +02:00
parent ff65ef6cc6
commit aec6129041
3 changed files with 6 additions and 4 deletions

View File

@ -35,6 +35,9 @@ const FeatureDetector = {
},
canCopyReadonlyInput: function() {
return !(/CriOS/i.test(navigator.userAgent));
},
supportsTitleBarStyles: function () {
return this.isMac;
}
};

View File

@ -82,10 +82,8 @@ const SettingsGeneralView = Backbone.View.extend({
const updateFound = UpdateModel.instance.get('updateStatus') === 'found';
const updateManual = UpdateModel.instance.get('updateManual');
const storageProviders = this.getStorageProviders();
const platform = (typeof process !== 'undefined') ? process.platform : 'web';
this.renderTemplate({
platform: platform,
themes: this.allThemes,
activeTheme: AppSettingsModel.instance.get('theme'),
locales: this.allLocales,
@ -117,6 +115,7 @@ const SettingsGeneralView = Backbone.View.extend({
updateManual: updateManual,
releaseNotesLink: Links.ReleaseNotes,
colorfulIcons: AppSettingsModel.instance.get('colorfulIcons'),
supportsTitleBarStyles: FeatureDetector.supportsTitleBarStyles,
titlebarStyle: AppSettingsModel.instance.get('titlebarStyle'),
storageProviders: storageProviders
});

View File

@ -64,7 +64,7 @@
<option value="2" {{#ifeq fontSize 2}}selected{{/ifeq}}>{{res 'setGenFontSizeLargest'}}</option>
</select>
</div>
{{#ifeq platform 'darwin'}}
{{#if supportsTitleBarStyles}}
<div>
<label for="settings__general-titlebar-style">{{res 'setGenTitlebarStyle'}}:</label>
<select class="settings__general-titlebar-style settings__select input-base" id="settings__general-titlebar-style">
@ -73,7 +73,7 @@
<option value="hidden-inset" {{#ifeq titlebarStyle 'hidden-inset'}}selected{{/ifeq}}>{{res 'setGenTitlebarStyleHiddenInset'}}</option>
</select>
</div>
{{/ifeq}}
{{/if}}
<div>
<input type="checkbox" class="settings__input input-base settings__general-expand" id="settings__general-expand" {{#if expandGroups}}checked{{/if}} />
<label for="settings__general-expand">{{res 'setGenShowSubgroups'}}</label>