1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

fixes #372 - Plugin "Overview"

This commit is contained in:
Luke Pulverenti 2013-07-29 11:27:43 -04:00
parent 9e05644d21
commit 86df2296f7
2 changed files with 41 additions and 51 deletions

View file

@ -14,26 +14,25 @@
<a href="pluginupdates.html" data-role="button">Automatic Updates</a> <a href="pluginupdates.html" data-role="button">Automatic Updates</a>
</div> </div>
<div style="display: inline-block; margin: .75em 0;"> <div style="margin: .75em 0;">
<button data-mini="true" data-icon="filter" data-inline="true" onclick="$('#filterPanel', $.mobile.activePage).panel( 'toggle' );">Filter</button>
<div style="display: inline-block; margin-right: 1em;">
<label for="selectTargetSystem">Show plugins for</label>
<select id="selectTargetSystem" data-role="none" style="margin-left: .5em;">
<option value="Server">MB Server</option>
<option value="MBTheater">MB Theater</option>
<option value="MBClassic">MB Classic</option>
</select>
</div>
<button data-mini="true" data-icon="filter" data-inline="true" onclick="$('#filterPanel', $.mobile.activePage).panel( 'toggle' );">Filter</button>
</div> </div>
<div id="noPlugins" class="hide"><div style="text-align:center;margin: 10px;">No available plugins</div></div> <div id="noPlugins" class="hide">
<div style="text-align: center; margin: 10px;">No available plugins</div>
</div>
<div data-role="collapsible" id="pluginServerCollapsible" class="hide" data-collapsed="false" data-mini="true"> <div id="pluginTiles"></div>
<h3>MB Server</h3>
<div id="pluginServerTiles"></div>
</div>
<div data-role="collapsible" id="pluginTheatreCollapsible" class="hide" data-mini="true">
<h3>MB Theater</h3>
<div id="pluginTheatreTiles"></div>
</div>
<div data-role="collapsible" id="pluginClassicCollapsible" class="hide" data-mini="true">
<h3>MB Classic</h3>
<div id="pluginClassicTiles"></div>
</div>
</div> </div>
</div> </div>

View file

@ -2,7 +2,7 @@
// The base query options // The base query options
var query = { var query = {
TargetSystems: 'Server,MBTheater,MBClassic' TargetSystems: 'Server'
}; };
function reloadList(page) { function reloadList(page) {
@ -26,17 +26,28 @@
availablePlugins = availablePlugins.filter(function (p) { availablePlugins = availablePlugins.filter(function (p) {
return p.type == "UserInstalled"; return p.type == "UserInstalled";
}).sort(function (a, b) { }).sort(function (a, b) {
return a.name > b.name ? 1 : -1;
var aName = (a.category || "General") + " " + a.name;
var bame = (b.category || "General") + " " + b.name;
return aName > bame ? 1 : -1;
}); });
var serverhtml = ''; var pluginhtml = '';
var theatrehtml = '';
var classichtml = ""; var currentCategory;
for (var i = 0, length = availablePlugins.length; i < length; i++) { for (var i = 0, length = availablePlugins.length; i < length; i++) {
var html = ''; var html = '';
var plugin = availablePlugins[i]; var plugin = availablePlugins[i];
var category = plugin.category || "General";
if (category != currentCategory) {
html += '<h2 style="margin: .5em 0 0;">' + category + '</h2>';
currentCategory = category;
}
html += "<a class='posterItem smallBackdropPosterItem transparentPosterItem borderlessPosterItem' href='addPlugin.html?name=" + encodeURIComponent(plugin.name) + "'>"; html += "<a class='posterItem smallBackdropPosterItem transparentPosterItem borderlessPosterItem' href='addPlugin.html?name=" + encodeURIComponent(plugin.name) + "'>";
if (plugin.thumbImage) { if (plugin.thumbImage) {
@ -62,7 +73,7 @@
})[0]; })[0];
if (installedPlugin) { if (installedPlugin) {
html += "<span class='installedPluginTitle'>"+ plugin.name + "</span> (Installed)"; html += "<span class='installedPluginTitle'>" + plugin.name + "</span> (Installed)";
} else { } else {
html += plugin.name; html += plugin.name;
} }
@ -71,13 +82,7 @@
html += "</a>"; html += "</a>";
if (plugin.targetSystem == "Server") { pluginhtml += html;
serverhtml += html;
} else if (plugin.targetSystem == "MBTheater") {
theatrehtml += html;
} else if (plugin.targetSystem == "MBClassic") {
classichtml += html;
}
} }
@ -85,27 +90,7 @@
$("#noPlugins", page).hide(); $("#noPlugins", page).hide();
} }
$('#pluginServerTiles', page).html(serverhtml); $('#pluginTiles', page).html(pluginhtml);
$('#pluginTheatreTiles', page).html(theatrehtml);
$('#pluginClassicTiles', page).html(classichtml);
if (serverhtml) {
$('#pluginServerCollapsible', page).show();
} else {
$('#pluginServerCollapsible', page).hide();
}
if (theatrehtml) {
$('#pluginTheatreCollapsible', page).show();
} else {
$('#pluginTheatreCollapsible', page).hide();
}
if (classichtml) {
$('#pluginClassicCollapsible', page).show();
} else {
$('#pluginClassicCollapsible', page).hide();
}
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
} }
@ -127,6 +112,12 @@
reloadList(page); reloadList(page);
}); });
$('#selectTargetSystem', page).on('change', function () {
query.TargetSystems = this.value;
reloadList(page);
});
}).on('pageshow', "#pluginCatalogPage", function () { }).on('pageshow', "#pluginCatalogPage", function () {
var page = this; var page = this;