mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-16 02:18:16 -07:00
Merge pull request #1663 from Camc314/migrate-to-ES6-44
Migration of libraryBrowser and multiDownload to ES6 modules
This commit is contained in:
commit
231c965ad9
@ -248,6 +248,8 @@
|
||||
"src/scripts/imagehelper.js",
|
||||
"src/scripts/inputManager.js",
|
||||
"src/scripts/keyboardNavigation.js",
|
||||
"src/scripts/libraryBrowser.js",
|
||||
"src/scripts/multiDownload.js",
|
||||
"src/scripts/playlists.js",
|
||||
"src/scripts/settings/appSettings.js",
|
||||
"src/scripts/settings/userSettings.js",
|
||||
|
@ -1,6 +1,8 @@
|
||||
define(['cardBuilder', 'imageLoader', 'libraryBrowser', 'loading', 'events', 'userSettings', 'emby-itemscontainer'], function (cardBuilder, imageLoader, libraryBrowser, loading, events, userSettings) {
|
||||
'use strict';
|
||||
|
||||
libraryBrowser = libraryBrowser.default || libraryBrowser;
|
||||
|
||||
return function (view, params, tabContent) {
|
||||
function getPageData() {
|
||||
if (!pageData) {
|
||||
|
@ -1,6 +1,8 @@
|
||||
define(['loading', 'events', 'libraryBrowser', 'imageLoader', 'listView', 'cardBuilder', 'userSettings', 'globalize', 'emby-itemscontainer'], function (loading, events, libraryBrowser, imageLoader, listView, cardBuilder, userSettings, globalize) {
|
||||
'use strict';
|
||||
|
||||
libraryBrowser = libraryBrowser.default || libraryBrowser;
|
||||
|
||||
return function (view, params, tabContent) {
|
||||
function getPageData(context) {
|
||||
var key = getSavedQueryKey(context);
|
||||
|
@ -1,6 +1,8 @@
|
||||
define(['layoutManager', 'loading', 'libraryBrowser', 'cardBuilder', 'lazyLoader', 'apphost', 'globalize', 'appRouter', 'dom', 'emby-button'], function (layoutManager, loading, libraryBrowser, cardBuilder, lazyLoader, appHost, globalize, appRouter, dom) {
|
||||
'use strict';
|
||||
|
||||
libraryBrowser = libraryBrowser.default || libraryBrowser;
|
||||
|
||||
return function (view, params, tabContent) {
|
||||
function getPageData() {
|
||||
var key = getSavedQueryKey();
|
||||
|
@ -1,6 +1,8 @@
|
||||
define(['loading', 'layoutManager', 'userSettings', 'events', 'libraryBrowser', 'alphaPicker', 'listView', 'cardBuilder', 'globalize', 'emby-itemscontainer'], function (loading, layoutManager, userSettings, events, libraryBrowser, AlphaPicker, listView, cardBuilder, globalize) {
|
||||
'use strict';
|
||||
|
||||
libraryBrowser = libraryBrowser.default || libraryBrowser;
|
||||
|
||||
return function (view, params, tabContent, options) {
|
||||
function onViewStyleChange() {
|
||||
if (self.getCurrentViewStyle() == 'List') {
|
||||
|
@ -1,6 +1,8 @@
|
||||
define(['layoutManager', 'loading', 'events', 'libraryBrowser', 'imageLoader', 'alphaPicker', 'listView', 'cardBuilder', 'userSettings', 'globalize', 'emby-itemscontainer'], function (layoutManager, loading, events, libraryBrowser, imageLoader, AlphaPicker, listView, cardBuilder, userSettings, globalize) {
|
||||
'use strict';
|
||||
|
||||
libraryBrowser = libraryBrowser.default || libraryBrowser;
|
||||
|
||||
return function (view, params, tabContent) {
|
||||
function getPageData(context) {
|
||||
var key = getSavedQueryKey(context);
|
||||
|
@ -1,6 +1,8 @@
|
||||
define(['layoutManager', 'playbackManager', 'loading', 'events', 'libraryBrowser', 'imageLoader', 'alphaPicker', 'listView', 'cardBuilder', 'userSettings', 'globalize', 'emby-itemscontainer'], function (layoutManager, playbackManager, loading, events, libraryBrowser, imageLoader, AlphaPicker, listView, cardBuilder, userSettings, globalize) {
|
||||
'use strict';
|
||||
|
||||
libraryBrowser = libraryBrowser.default || libraryBrowser;
|
||||
|
||||
return function (view, params, tabContent) {
|
||||
function playAll() {
|
||||
ApiClient.getItem(ApiClient.getCurrentUserId(), params.topParentId).then(function (item) {
|
||||
|
@ -1,6 +1,8 @@
|
||||
define(['layoutManager', 'loading', 'events', 'libraryBrowser', 'imageLoader', 'alphaPicker', 'listView', 'cardBuilder', 'apphost', 'userSettings', 'emby-itemscontainer'], function (layoutManager, loading, events, libraryBrowser, imageLoader, AlphaPicker, listView, cardBuilder, appHost, userSettings) {
|
||||
'use strict';
|
||||
|
||||
libraryBrowser = libraryBrowser.default || libraryBrowser;
|
||||
|
||||
return function (view, params, tabContent) {
|
||||
function getPageData(context) {
|
||||
var key = getSavedQueryKey(context);
|
||||
|
@ -1,6 +1,8 @@
|
||||
define(['libraryBrowser', 'cardBuilder', 'apphost', 'imageLoader', 'loading'], function (libraryBrowser, cardBuilder, appHost, imageLoader, loading) {
|
||||
'use strict';
|
||||
|
||||
libraryBrowser = libraryBrowser.default || libraryBrowser;
|
||||
|
||||
return function (view, params, tabContent) {
|
||||
function getPageData() {
|
||||
var key = getSavedQueryKey();
|
||||
|
@ -1,6 +1,8 @@
|
||||
define(['libraryBrowser', 'cardBuilder', 'apphost', 'imageLoader', 'loading'], function (libraryBrowser, cardBuilder, appHost, imageLoader, loading) {
|
||||
'use strict';
|
||||
|
||||
libraryBrowser = libraryBrowser.default || libraryBrowser;
|
||||
|
||||
return function (view, params, tabContent) {
|
||||
function getPageData() {
|
||||
var key = getSavedQueryKey();
|
||||
|
@ -1,6 +1,8 @@
|
||||
define(['events', 'libraryBrowser', 'imageLoader', 'listView', 'loading', 'userSettings', 'globalize', 'emby-itemscontainer'], function (events, libraryBrowser, imageLoader, listView, loading, userSettings, globalize) {
|
||||
'use strict';
|
||||
|
||||
libraryBrowser = libraryBrowser.default || libraryBrowser;
|
||||
|
||||
return function (view, params, tabContent) {
|
||||
function getPageData(context) {
|
||||
var key = getSavedQueryKey(context);
|
||||
|
@ -1,11 +1,11 @@
|
||||
define(['userSettings', 'globalize'], function (userSettings, globalize) {
|
||||
'use strict';
|
||||
import * as userSettings from 'userSettings';
|
||||
import globalize from 'globalize';
|
||||
|
||||
var libraryBrowser = {
|
||||
getSavedQueryKey: function (modifier) {
|
||||
export function getSavedQueryKey(modifier) {
|
||||
return window.location.href.split('#')[0] + (modifier || '');
|
||||
},
|
||||
loadSavedQueryValues: function (key, query) {
|
||||
}
|
||||
|
||||
export function loadSavedQueryValues(key, query) {
|
||||
var values = userSettings.get(key);
|
||||
|
||||
if (values) {
|
||||
@ -14,8 +14,9 @@ define(['userSettings', 'globalize'], function (userSettings, globalize) {
|
||||
}
|
||||
|
||||
return query;
|
||||
},
|
||||
saveQueryValues: function (key, query) {
|
||||
}
|
||||
|
||||
export function saveQueryValues(key, query) {
|
||||
var values = {};
|
||||
|
||||
if (query.SortBy) {
|
||||
@ -27,14 +28,17 @@ define(['userSettings', 'globalize'], function (userSettings, globalize) {
|
||||
}
|
||||
|
||||
userSettings.set(key, JSON.stringify(values));
|
||||
},
|
||||
saveViewSetting: function (key, value) {
|
||||
}
|
||||
|
||||
export function saveViewSetting (key, value) {
|
||||
userSettings.set(key + '-_view', value);
|
||||
},
|
||||
getSavedView: function (key) {
|
||||
}
|
||||
|
||||
export function getSavedView (key) {
|
||||
return userSettings.get(key + '-_view');
|
||||
},
|
||||
showLayoutMenu: function (button, currentLayout, views) {
|
||||
}
|
||||
|
||||
export function showLayoutMenu (button, currentLayout, views) {
|
||||
var dispatchEvent = true;
|
||||
|
||||
if (!views) {
|
||||
@ -51,7 +55,7 @@ define(['userSettings', 'globalize'], function (userSettings, globalize) {
|
||||
};
|
||||
});
|
||||
|
||||
require(['actionsheet'], function (actionsheet) {
|
||||
import('actionsheet').then(({default: actionsheet}) => {
|
||||
actionsheet.show({
|
||||
items: menuItems,
|
||||
positionTo: button,
|
||||
@ -72,8 +76,9 @@ define(['userSettings', 'globalize'], function (userSettings, globalize) {
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
getQueryPagingHtml: function (options) {
|
||||
}
|
||||
|
||||
export function getQueryPagingHtml (options) {
|
||||
var startIndex = options.startIndex;
|
||||
var limit = options.limit;
|
||||
var totalRecordCount = options.totalRecordCount;
|
||||
@ -111,8 +116,9 @@ define(['userSettings', 'globalize'], function (userSettings, globalize) {
|
||||
}
|
||||
|
||||
return html += '</div>';
|
||||
},
|
||||
showSortMenu: function (options) {
|
||||
}
|
||||
|
||||
export function showSortMenu (options) {
|
||||
require(['dialogHelper', 'emby-radio'], function (dialogHelper) {
|
||||
function onSortByChange() {
|
||||
var newValue = this.value;
|
||||
@ -192,8 +198,19 @@ define(['userSettings', 'globalize'], function (userSettings, globalize) {
|
||||
sortOrders[i].addEventListener('change', onSortOrderChange);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
window.LibraryBrowser = libraryBrowser;
|
||||
return libraryBrowser;
|
||||
});
|
||||
}
|
||||
|
||||
const libraryBrowser = {
|
||||
getSavedQueryKey,
|
||||
loadSavedQueryValues,
|
||||
saveQueryValues,
|
||||
saveViewSetting,
|
||||
getSavedView,
|
||||
showLayoutMenu,
|
||||
getQueryPagingHtml,
|
||||
showSortMenu
|
||||
};
|
||||
|
||||
window.LibraryBrowser = libraryBrowser;
|
||||
|
||||
export default libraryBrowser;
|
||||
|
@ -1,7 +1,6 @@
|
||||
define(['browser'], function (browser) {
|
||||
'use strict';
|
||||
import browser from 'browser';
|
||||
|
||||
function fallback(urls) {
|
||||
function fallback(urls) {
|
||||
var i = 0;
|
||||
|
||||
(function createIframe() {
|
||||
@ -26,24 +25,24 @@ define(['browser'], function (browser) {
|
||||
}
|
||||
}, 100);
|
||||
})();
|
||||
}
|
||||
}
|
||||
|
||||
function sameDomain(url) {
|
||||
function sameDomain(url) {
|
||||
var a = document.createElement('a');
|
||||
a.href = url;
|
||||
|
||||
return location.hostname === a.hostname && location.protocol === a.protocol;
|
||||
}
|
||||
}
|
||||
|
||||
function download(url) {
|
||||
function download(url) {
|
||||
var a = document.createElement('a');
|
||||
a.download = '';
|
||||
a.href = url;
|
||||
// firefox doesn't support `a.click()`...
|
||||
a.dispatchEvent(new MouseEvent('click'));
|
||||
}
|
||||
}
|
||||
|
||||
return function (urls) {
|
||||
export default function (urls) {
|
||||
if (!urls) {
|
||||
throw new Error('`urls` required');
|
||||
}
|
||||
@ -62,5 +61,5 @@ define(['browser'], function (browser) {
|
||||
|
||||
download(url);
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user