jellyfin-web/dashboard-ui/scripts/appsettings.js

130 lines
3.2 KiB
JavaScript
Raw Normal View History

2015-06-25 14:50:56 -07:00
(function (window) {
2015-05-27 22:51:48 -07:00
function update(key, val) {
2015-06-25 14:50:56 -07:00
appStorage.setItem(key, val);
2015-05-27 22:51:48 -07:00
Events.trigger(AppSettings, 'settingupdated', [key]);
}
window.AppSettings = {
2015-09-05 14:15:36 -07:00
enableAutomaticBitrateDetection: function (val) {
if (val != null) {
update('enableAutomaticBitrateDetection', val.toString());
}
var savedVal = appStorage.getItem('enableAutomaticBitrateDetection');
if (!savedVal) {
if (AppInfo.isNativeApp) {
//return false;
}
}
return appStorage.getItem('enableAutomaticBitrateDetection') != 'false';
},
2015-05-27 22:51:48 -07:00
maxStreamingBitrate: function (val) {
if (val != null) {
update('preferredVideoBitrate', val);
}
2015-06-25 14:50:56 -07:00
return parseInt(appStorage.getItem('preferredVideoBitrate') || '') || 1500000;
2015-05-27 22:51:48 -07:00
},
maxChromecastBitrate: function (val) {
if (val != null) {
update('chromecastBitrate1', val);
2015-05-27 22:51:48 -07:00
}
val = appStorage.getItem('chromecastBitrate1');
2015-06-07 20:16:42 -07:00
return val ? parseInt(val) : null;
2015-06-07 20:16:42 -07:00
},
2015-05-27 22:51:48 -07:00
enableExternalPlayers: function (val) {
if (val != null) {
update('externalplayers', val.toString());
}
2015-06-25 14:50:56 -07:00
return appStorage.getItem('externalplayers') == 'true';
2015-05-27 22:51:48 -07:00
},
2015-12-14 08:43:03 -07:00
enableCinemaMode: function (val) {
if (val != null) {
update('enableCinemaMode', val.toString());
}
val = appStorage.getItem('enableCinemaMode');
if (val) {
return val != 'false';
}
if (browserInfo.mobile) {
return false;
}
return true;
},
2015-05-27 22:51:48 -07:00
enableFullScreen: function (val) {
if (val != null) {
update('enableFullScreen', val.toString());
}
2015-06-25 14:50:56 -07:00
return appStorage.getItem('enableFullScreen') == 'true';
2015-06-09 21:01:14 -07:00
},
2015-08-12 14:39:02 -07:00
syncOnlyOnWifi: function (val) {
if (val != null) {
update('syncOnlyOnWifi', val.toString());
}
return appStorage.getItem('syncOnlyOnWifi') != 'false';
},
2015-08-10 17:14:15 -07:00
syncPath: function (val) {
2015-06-09 21:01:14 -07:00
if (val != null) {
2015-08-10 17:14:15 -07:00
update('syncPath', val);
2015-06-09 21:01:14 -07:00
}
2015-08-10 17:14:15 -07:00
return appStorage.getItem('syncPath');
2015-07-03 10:55:29 -07:00
},
2015-05-27 22:51:48 -07:00
2015-08-04 11:14:16 -07:00
displayLanguage: function (val) {
if (val != null) {
update('displayLanguage', val);
}
2015-12-14 08:43:03 -07:00
return appStorage.getItem('displayLanguage') || navigator.language || navigator.userLanguage || 'en-US';
2015-08-04 11:14:16 -07:00
},
2015-09-26 07:51:26 -07:00
cameraUploadServers: function (val) {
if (val != null) {
update('cameraUploadServers', val.join(','));
}
val = appStorage.getItem('cameraUploadServers');
if (val) {
return val.split(',');
}
return [];
},
2015-08-04 11:14:16 -07:00
displayPreferencesKey: function () {
2015-07-03 10:55:29 -07:00
if (AppInfo.isNativeApp) {
return 'Emby Mobile';
}
return 'webclient';
}
2015-05-27 22:51:48 -07:00
};
2015-06-25 14:50:56 -07:00
})(window);