mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update components
This commit is contained in:
parent
af2e209ce4
commit
d4f9f432a4
19 changed files with 130 additions and 113 deletions
|
@ -1,4 +1,5 @@
|
|||
define(['events'], function (events) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Creates a new api client instance
|
||||
|
@ -29,11 +30,11 @@
|
|||
|
||||
if (val != null) {
|
||||
|
||||
if (val.toLowerCase().indexOf('http') != 0) {
|
||||
if (val.toLowerCase().indexOf('http') !== 0) {
|
||||
throw new Error('Invalid url: ' + val);
|
||||
}
|
||||
|
||||
var changed = val != serverAddress;
|
||||
var changed = val !== serverAddress;
|
||||
|
||||
serverAddress = val;
|
||||
|
||||
|
@ -189,7 +190,7 @@
|
|||
|
||||
var headers = request.headers || {};
|
||||
|
||||
if (request.dataType == 'json') {
|
||||
if (request.dataType === 'json') {
|
||||
headers.accept = 'application/json';
|
||||
}
|
||||
|
||||
|
@ -274,16 +275,16 @@
|
|||
self.setRequestHeaders(request.headers);
|
||||
}
|
||||
|
||||
if (self.enableAutomaticNetworking === false || request.type != "GET") {
|
||||
if (self.enableAutomaticNetworking === false || request.type !== "GET") {
|
||||
console.log('Requesting url without automatic networking: ' + request.url);
|
||||
|
||||
return getFetchPromise(request).then(function (response) {
|
||||
|
||||
if (response.status < 400) {
|
||||
|
||||
if (request.dataType == 'json' || request.headers.accept == 'application/json') {
|
||||
if (request.dataType === 'json' || request.headers.accept === 'application/json') {
|
||||
return response.json();
|
||||
} else if (request.dataType == 'text' || (response.headers.get('Content-Type') || '').toLowerCase().indexOf('text/') == 0) {
|
||||
} else if (request.dataType === 'text' || (response.headers.get('Content-Type') || '').toLowerCase().indexOf('text/') === 0) {
|
||||
return response.text();
|
||||
} else {
|
||||
return response;
|
||||
|
@ -349,7 +350,7 @@
|
|||
|
||||
console.log("Attempting reconnection to " + url);
|
||||
|
||||
var timeout = connectionMode == MediaBrowser.ConnectionMode.Local ? 7000 : 15000;
|
||||
var timeout = connectionMode === MediaBrowser.ConnectionMode.Local ? 7000 : 15000;
|
||||
|
||||
fetchWithTimeout(url + "/system/info/public", {
|
||||
|
||||
|
@ -406,9 +407,9 @@
|
|||
|
||||
if (response.status < 400) {
|
||||
|
||||
if (request.dataType == 'json' || request.headers.accept == 'application/json') {
|
||||
if (request.dataType === 'json' || request.headers.accept === 'application/json') {
|
||||
return response.json();
|
||||
} else if (request.dataType == 'text' || (response.headers.get('Content-Type') || '').toLowerCase().indexOf('text/') == 0) {
|
||||
} else if (request.dataType === 'text' || (response.headers.get('Content-Type') || '').toLowerCase().indexOf('text/') === 0) {
|
||||
return response.text();
|
||||
} else {
|
||||
return response;
|
||||
|
@ -478,11 +479,11 @@
|
|||
throw new Error("serverAddress is yet not set");
|
||||
}
|
||||
var lowered = url.toLowerCase();
|
||||
if (lowered.indexOf('/emby') == -1 && lowered.indexOf('/mediabrowser') == -1) {
|
||||
if (lowered.indexOf('/emby') === -1 && lowered.indexOf('/mediabrowser') === -1) {
|
||||
url += '/emby';
|
||||
}
|
||||
|
||||
if (name.charAt(0) != '/') {
|
||||
if (name.charAt(0) !== '/') {
|
||||
url += '/';
|
||||
}
|
||||
|
||||
|
@ -602,7 +603,7 @@
|
|||
else if (msg.MessageType === "UserUpdated" || msg.MessageType === "UserConfigurationUpdated") {
|
||||
|
||||
var user = msg.Data;
|
||||
if (user.Id == self.getCurrentUserId()) {
|
||||
if (user.Id === self.getCurrentUserId()) {
|
||||
|
||||
currentUser = null;
|
||||
}
|
||||
|
@ -674,13 +675,13 @@
|
|||
return self.getDownloadSpeed(1000000).then(function (bitrate) {
|
||||
|
||||
if (bitrate < 1000000) {
|
||||
return Math.round(bitrate * .8);
|
||||
return Math.round(bitrate * 0.8);
|
||||
} else {
|
||||
|
||||
// If that produced a fairly high speed, try again with a larger size to get a more accurate result
|
||||
return self.getDownloadSpeed(2400000).then(function (bitrate) {
|
||||
|
||||
return Math.round(bitrate * .8);
|
||||
return Math.round(bitrate * 0.8);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2073,7 +2074,7 @@
|
|||
throw new Error("File must be an image.");
|
||||
}
|
||||
|
||||
if (file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/jpeg") {
|
||||
if (file.type !== "image/png" && file.type !== "image/jpeg" && file.type !== "image/jpeg") {
|
||||
throw new Error("File must be an image.");
|
||||
}
|
||||
|
||||
|
@ -2130,7 +2131,7 @@
|
|||
throw new Error("File must be an image.");
|
||||
}
|
||||
|
||||
if (file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/jpeg") {
|
||||
if (file.type !== "image/png" && file.type !== "image/jpeg" && file.type !== "image/jpeg") {
|
||||
throw new Error("File must be an image.");
|
||||
}
|
||||
|
||||
|
@ -2364,7 +2365,7 @@
|
|||
};
|
||||
|
||||
self.getDefaultImageQuality = function (imageType) {
|
||||
return imageType.toLowerCase() == 'backdrop' ? 80 : 90;
|
||||
return imageType.toLowerCase() === 'backdrop' ? 80 : 90;
|
||||
};
|
||||
|
||||
function normalizeImageOptions(options) {
|
||||
|
@ -2904,7 +2905,7 @@
|
|||
|
||||
var url;
|
||||
|
||||
if ((typeof userId).toString().toLowerCase() == 'string') {
|
||||
if ((typeof userId).toString().toLowerCase() === 'string') {
|
||||
url = self.getUrl("Users/" + userId + "/Items", options);
|
||||
} else {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue