show/hide live tv menu based on installed services

This commit is contained in:
Luke Pulverenti 2013-11-15 11:00:50 -05:00
parent 732cbeaad8
commit 66ced0ebc8
4 changed files with 56 additions and 13 deletions

View File

@ -378,6 +378,39 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
});
};
self.getLiveTvServices = function (options) {
var url = self.getUrl("/LiveTv/Services", options || {});
return self.ajax({
type: "GET",
url: url,
dataType: "json"
});
};
self.getLiveTvChannels = function (options) {
var url = self.getUrl("/LiveTv/Channels", options || {});
return self.ajax({
type: "GET",
url: url,
dataType: "json"
});
};
self.getLiveTvRecordings = function (options) {
var url = self.getUrl("/LiveTv/Recordings", options || {});
return self.ajax({
type: "GET",
url: url,
dataType: "json"
});
};
/**
* Gets the current server status
*/

View File

@ -129,7 +129,7 @@
.libraryViewNav a {
display: inline-block;
padding: .5em .25em;
padding: .25em .25em;
color: #eee!important;
text-decoration: none;
}
@ -486,6 +486,13 @@ a.itemTag:hover {
}
}
@media all and (min-width: 750px) {
.libraryViewNav a {
padding: .5em 1em;
}
}
@media all and (max-width: 750px) {
.itemBackdrop {
@ -525,10 +532,6 @@ a.itemTag:hover {
.noBackdrop .lnkSibling {
bottom: 260px;
}
.libraryViewNav a {
padding: .5em 1em;
}
}
@media all and (min-width: 1000px) {

View File

@ -1257,7 +1257,7 @@
}
if (providerIds.NesBox) {
if (item.GameSystem == "Nintendo") {
links.push('<a class="textlink" href="http://nesbox.com/game/' + providerIds.NesBox + '" target="_blank">NESbox</a>');
}
@ -2287,6 +2287,7 @@
(function (window, document, $) {
var itemCountsPromise;
var liveTvServicesPromise;
function renderHeader(page, user) {
@ -2329,11 +2330,11 @@
Search.onSearchRendered($('.viewMenuBar', page));
}
function insertViews(page, user, counts) {
function insertViews(page, user, counts, liveTvServices) {
var html = '';
var selectedCssClass = ' selectedViewLink';
var selectedHtml = "<span class='selectedViewIndicator'>&#9654;</span>";
@ -2352,7 +2353,7 @@
viewCount++;
}
if (false) {
if (liveTvServices.length) {
html += '<a class="viewMenuLink viewMenuTextLink' + (view == 'livetv' ? selectedCssClass : '') + '" href="livetvchannels.html">' + (view == 'livetv' ? selectedHtml : '') + '<span class="viewName">Live TV</span></a>';
viewCount++;
}
@ -2383,10 +2384,16 @@
renderHeader(page, user);
itemCountsPromise = itemCountsPromise || ApiClient.getItemCounts(Dashboard.getCurrentUserId());
liveTvServicesPromise = liveTvServicesPromise || ApiClient.getLiveTvServices();
$.when(itemCountsPromise, liveTvServicesPromise).done(function (response1, response2) {
var counts = response1[0];
var liveTvServices = response2[0];
insertViews(page, user, counts, liveTvServices);
itemCountsPromise.done(function (counts) {
insertViews(page, user, counts);
});
});
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.192" targetFramework="net45" />
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.193" targetFramework="net45" />
<package id="ServiceStack.Common" version="3.9.62" targetFramework="net45" />
<package id="ServiceStack.Text" version="3.9.62" targetFramework="net45" />
</packages>