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

plugin catalog filtering

This commit is contained in:
Techywarrior 2013-04-03 20:56:02 -07:00
parent 74631a28d5
commit 317f06f607
2 changed files with 144 additions and 83 deletions

View file

@ -13,22 +13,38 @@
<a href="plugincatalog.html" data-role="button" class="ui-btn-active">Plugin Catalog</a>
<a href="pluginupdates.html" data-role="button">Automatic Updates</a>
</div>
<div class="hide" id="pluginServer" data-role="collapsible" data-content-theme="c" data-collapsed="false" style="margin-top: 2em;" data-theme="a">
<h3>Server</h3>
<div id="pluginServerTiles"></div>
<div class="viewSettings">
<button data-mini="true" data-icon="filter" data-inline="true" onclick="$('#filterPanel', $.mobile.activePage).panel( 'toggle' );">Filter</button>
</div>
<div class="hide" id="pluginMBTheatre" data-role="collapsible" data-content-theme="c" data-collapsed="false" style="margin-top: 2em;" data-theme="a">
<h3>MB Theatre</h3>
<div id="pluginMBTheatreTiles"></div>
<div id="pluginTiles"></div>
</div>
</div>
<div class="hide" id="pluginMBClassic" data-role="collapsible" data-content-theme="c" data-collapsed="false" style="margin-top: 2em;" data-theme="a">
<h3>MB Classic</h3>
<div id="pluginMBClassicTiles"></div>
</div>
</div>
<div data-role="panel" id="filterPanel" data-position="right" data-display="overlay" data-theme="b" data-position-fixed="true">
<form>
<fieldset data-role="controlgroup">
<legend>
<h3>Application:</h3>
</legend>
<input class="chkStandardFilter" type="checkbox" name="chkServer" id="chkServer" data-theme="c" data-filter="Server">
<label for="chkServer">Media Browser Server</label>
<input class="chkStandardFilter" type="checkbox" name="chkTheatre" id="chkTheatre" data-theme="c" data-filter="MBTheatre">
<label for="chkTheatre">Media Browser Theatre</label>
<input class="chkStandardFilter" type="checkbox" name="chkClassic" id="chkClassic" data-theme="c" data-filter="MBClassic">
<label for="chkClassic">Media Browser Classic</label>
</fieldset>
<fieldset data-role="controlgroup">
<legend>
<h3> </h3>
</legend>
<input class="chkPremiumFilter" type="checkbox" name="chkPremium" id="chkPremium" data-theme="c" data-filter="IsPremium">
<label for="chkPremium">Premium</label>
</fieldset>
</form>
</div>
</div>
</body>

View file

@ -1,22 +1,26 @@
var PluginCatalogPage = {
(function ($, document) {
onPageShow: function () {
PluginCatalogPage.reloadList();
},
// The base query options
var query = {
IsPremium: false,
TargetSystems: ""
};
reloadList: function () {
function reloadList() {
Dashboard.showLoadingMsg();
var promise1 = ApiClient.getAvailablePlugins();
var promise1 = ApiClient.getAvailablePlugins(query);
var promise2 = ApiClient.getInstalledPlugins();
$.when(promise1, promise2).done(function (response1, response2) {
PluginCatalogPage.populateList(response1[0], response2[0]);
populateList(response1[0], response2[0]);
});
},
populateList: function (availablePlugins, installedPlugins) {
Dashboard.hideLoadingMsg();
}
function populateList(availablePlugins, installedPlugins) {
var page = $($.mobile.activePage);
availablePlugins = availablePlugins.filter(function (p) {
@ -25,13 +29,10 @@
return a.name > b.name ? 1 : -1;
});
var serverHtml = '';
var theatreHtml = '';
var classicHtml = '';
for (var i = 0, length = availablePlugins.length; i < length; i++) {
var html = "";
for (var i = 0, length = availablePlugins.length; i < length; i++) {
var plugin = availablePlugins[i];
html += "<div class='posterViewItem'><a href='addPlugin.html?name=" + encodeURIComponent(plugin.name) + "'>";
@ -70,25 +71,69 @@
html += "</a></div>";
if (plugin.targetSystem == 'Server') {
serverHtml += html;
}else if (plugin.targetSystem == 'MBTheater') {
theatreHtml += html;
}else if (plugin.targetSystem == 'MBClassic') {
classicHtml += html;
}
}
$('#pluginServerTiles', page).html(serverHtml);
$('#pluginMBTheatreTiles', page).html(theatreHtml);
$('#pluginMBClassicTiles', page).html(classicHtml);
if (serverHtml) $('#pluginServer', page).show();
if (theatreHtml) $('#pluginMBTheatre', page).show();
if (classicHtml) $('#pluginMBClassic', page).show();
$('#pluginTiles', page).html(html);
Dashboard.hideLoadingMsg();
}
};
$(document).on('pageshow', "#pluginCatalogPage", PluginCatalogPage.onPageShow);
$(document).on('pageinit', "#pluginCatalogPage", function () {
var page = this;
$('.chkStandardFilter', this).on('change', function () {
var filterName = this.getAttribute('data-filter');
var filters = query.TargetSystems || "";
filters = (',' + filters).replace(',' + filterName, '').substring(1);
if (this.checked) {
filters = filters ? (filters + ',' + filterName) : filterName;
}
query.TargetSystems = filters;
reloadList();
});
$('.chkPremiumFilter', this).on('change', function () {
var filterName = this.getAttribute('data-filter');
if (this.checked) {
query.IsPremium = true;
}else {
query.IsPremium = false;
}
reloadList();
});
}).on('pageshow', "#pluginCatalogPage", function () {
reloadList();
// Reset form values using the last used query
$('.chkStandardFilter', this).each(function () {
var filters = "," + (query.TargetSystems || "");
var filterName = this.getAttribute('data-filter');
this.checked = filters.indexOf(',' + filterName) != -1;
}).checkboxradio('refresh');
$('.chkPremiumFilter', this).each(function () {
var filters = query.IsPremium || false;
this.checked = filters;
}).checkboxradio('refresh');
});
})(jQuery, document);