Merge pull request #159 from dkanada/plugin

remove some deprecated plugin code
This commit is contained in:
Joshua M. Boniface 2019-02-26 16:22:49 -05:00 committed by GitHub
commit 8f03439b7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 39 deletions

View File

@ -386,16 +386,13 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
function addPluginPagesToMainMenu(links, pluginItems, section) {
for (var i = 0, length = pluginItems.length; i < length; i++) {
var pluginItem = pluginItems[i];
if (Dashboard.allowPluginPages(pluginItem.PluginId)) {
if (pluginItem.EnableInMainMenu && pluginItem.MenuSection === section) {
links.push({
name: pluginItem.DisplayName,
icon: pluginItem.MenuIcon || "folder",
href: Dashboard.getConfigurationPageUrl(pluginItem.Name),
pageUrls: [Dashboard.getConfigurationPageUrl(pluginItem.Name)]
});
}
if (pluginItem.EnableInMainMenu && pluginItem.MenuSection === section) {
links.push({
name: pluginItem.DisplayName,
icon: pluginItem.MenuIcon || "folder",
href: Dashboard.getConfigurationPageUrl(pluginItem.Name),
pageUrls: [Dashboard.getConfigurationPageUrl(pluginItem.Name)]
});
}
}
}

View File

@ -3,7 +3,6 @@ define(["loading", "libraryMenu", "globalize", "cardStyle", "emby-linkbutton", "
function reloadList(page) {
loading.show();
query.IsAppStoreSafe = true;
var promise1 = ApiClient.getAvailablePlugins(query);
var promise2 = ApiClient.getInstalledPlugins();
Promise.all([promise1, promise2]).then(function (responses) {
@ -16,13 +15,8 @@ define(["loading", "libraryMenu", "globalize", "cardStyle", "emby-linkbutton", "
});
}
function populateList(options) {
populateListInternal(options);
}
function getHeaderText(category) {
category = category.replace(" ", "");
if ("Channel" === category) {
category = "Channels";
} else if ("Theme" === category) {
@ -36,11 +30,7 @@ define(["loading", "libraryMenu", "globalize", "cardStyle", "emby-linkbutton", "
return globalize.translate(category);
}
function isUserInstalledPlugin(plugin) {
return -1 === ["02528C96-F727-44D7-BE87-9EEF040758C3", "0277E613-3EC0-4360-A3DE-F8AF0AABB5E9", "4DCB591C-0FA2-4C5D-A7E5-DABE37164C8B"].indexOf(plugin.guid);
}
function populateListInternal(options) {
function populateList(options) {
var availablePlugins = options.availablePlugins;
var installedPlugins = options.installedPlugins;
var allPlugins = availablePlugins.filter(function (plugin) {
@ -113,7 +103,7 @@ define(["loading", "libraryMenu", "globalize", "cardStyle", "emby-linkbutton", "
}
return 0;
}).filter(isUserInstalledPlugin);
});
html += '<div class="itemsContainer vertical-wrap">';
var limit = screen.availWidth >= 1920 ? 15 : 12;
@ -215,11 +205,14 @@ define(["loading", "libraryMenu", "globalize", "cardStyle", "emby-linkbutton", "
var query = {
TargetSystems: "Server",
IsAppStoreSafe: true,
IsAdult: false
};
window.PluginCatalog = {
renderCatalog: populateList
};
return function (view, params) {
view.querySelector("#selectSystem").addEventListener("change", function () {
query.TargetSystems = this.value;

View File

@ -32,12 +32,37 @@ define(["loading", "libraryMenu", "dom", "globalize", "cardStyle", "emby-linkbut
function getPluginCardHtml(plugin, pluginConfigurationPages) {
var configPage = pluginConfigurationPages.filter(function(pluginConfigurationPage) {
return pluginConfigurationPage.PluginId == plugin.Id
})[0],
html = "",
disallowPlugins = !Dashboard.allowPluginPages(plugin.Id),
configPageUrl = configPage ? Dashboard.getConfigurationPageUrl(configPage.Name) : null,
href = configPage && !disallowPlugins ? configPageUrl : null;
return html += "<div data-id='" + plugin.Id + "' data-name='" + plugin.Name + "' class='card backdropCard'>", html += '<div class="cardBox visualCardBox">', html += '<div class="cardScalable">', html += '<div class="cardPadder cardPadder-backdrop"></div>', html += href ? '<a class="cardContent cardImageContainer" is="emby-linkbutton" href="' + href + '">' : configPageUrl ? disallowPlugins ? '<div class="cardContent connectModePluginCard cardImageContainer">' : '<div class="cardContent cardImageContainer">' : '<div class="cardContent noConfigPluginCard noHoverEffect cardImageContainer">', plugin.ImageUrl ? (html += '<div class="cardImage coveredImage" style="background-image:url(\'' + plugin.ImageUrl + "');\">", html += "</div>") : html += '<i class="cardImageIcon md-icon">&#xE2C7;</i>', html += href ? "</a>" : "</div>", html += "</div>", html += '<div class="cardFooter">', html += '<div style="text-align:right; float:right;padding-top:5px;">', html += '<button type="button" is="paper-icon-button-light" class="btnCardMenu autoSize"><i class="md-icon">more_horiz</i></button>', html += "</div>", html += "<div class='cardText'>", html += configPage ? configPage.DisplayName || plugin.Name : plugin.Name, html += "</div>", html += "<div class='cardText cardText-secondary'>", html += plugin.Version, html += "</div>", html += "</div>", html += "</div>", html += "</div>"
})[0];
var configPageUrl = configPage ? Dashboard.getConfigurationPageUrl(configPage.Name) : null;
var html = "";
html += "<div data-id='" + plugin.Id + "' data-name='" + plugin.Name + "' class='card backdropCard'>";
html += '<div class="cardBox visualCardBox">';
html += '<div class="cardScalable">';
html += '<div class="cardPadder cardPadder-backdrop"></div>';
html += configPageUrl ? '<a class="cardContent cardImageContainer" is="emby-linkbutton" href="' + configPageUrl + '">' : '<div class="cardContent noConfigPluginCard noHoverEffect cardImageContainer">';
if (plugin.ImageUrl) {
html += '<div class="cardImage coveredImage" style="background-image:url(\'' + plugin.ImageUrl + "');\">";
html += "</div>";
} else {
html += '<i class="cardImageIcon md-icon">&#xE2C7;</i>';
}
html += configPageUrl ? "</a>" : "</div>";
html += "</div>";
html += '<div class="cardFooter">';
html += '<div style="text-align:right; float:right;padding-top:5px;">';
html += '<button type="button" is="paper-icon-button-light" class="btnCardMenu autoSize"><i class="md-icon">more_horiz</i></button>';
html += "</div>";
html += "<div class='cardText'>";
html += configPage ? configPage.DisplayName || plugin.Name : plugin.Name;
html += "</div>";
html += "<div class='cardText cardText-secondary'>";
html += plugin.Version;
html += "</div>";
html += "</div>";
html += "</div>";
html += "</div>";
return html;
}
function renderPlugins(page, plugins, showNoPluginsMessage) {
@ -117,4 +142,4 @@ define(["loading", "libraryMenu", "dom", "globalize", "cardStyle", "emby-linkbut
}), window.PluginsPage = {
renderPlugins: renderPlugins
}
});
});

View File

@ -32,9 +32,6 @@ function pageIdOn(eventName, id, fn) {
})
}
var Dashboard = {
allowPluginPages: function(pluginId) {
return true;
},
getCurrentUser: function() {
return window.ApiClient.getCurrentUser(!1)
},
@ -153,14 +150,8 @@ var Dashboard = {
! function() {
"use strict";
function initializeApiClient(apiClient) {
"cordova" !== self.appMode && "android" !== self.appMode || (apiClient.getAvailablePlugins = function() {
return Promise.resolve([])
})
}
function onApiClientCreated(e, newApiClient) {
initializeApiClient(newApiClient), window.$ && ($.ajax = newApiClient.ajax)
window.$ && ($.ajax = newApiClient.ajax)
}
function defineConnectionManager(connectionManager) {