added new item by name filters

This commit is contained in:
Luke Pulverenti 2014-01-14 15:03:35 -05:00
parent 48d1641783
commit 32386e817b
9 changed files with 62 additions and 105 deletions

View File

@ -378,20 +378,9 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
});
};
self.getAuthorizedFeatures = function (options) {
self.getLiveTvInfo = function (options) {
var url = self.getUrl("Users/AuthorizedFeatures", options || {});
return self.ajax({
type: "GET",
url: url,
dataType: "json"
});
};
self.getLiveTvServices = function (options) {
var url = self.getUrl("LiveTv/Services", options || {});
var url = self.getUrl("LiveTv/Info", options || {});
return self.ajax({
type: "GET",
@ -2714,22 +2703,6 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
});
};
self.updateLiveTvChannel = function (item) {
if (!item) {
throw new Error("null item");
}
var url = self.getUrl("LiveTv/Channels/" + item.Id);
return self.ajax({
type: "POST",
url: url,
data: JSON.stringify(item),
contentType: "application/json"
});
};
self.updateArtist = function (item) {
if (!item) {

View File

@ -91,18 +91,18 @@
var promise1 = ApiClient.getRootFolder(Dashboard.getCurrentUserId());
var promise2 = ApiClient.getLiveTvServices();
var promise2 = ApiClient.getLiveTvInfo();
$.when(promise1, promise2).done(function (response1, response2) {
var rootFolder = response1[0];
var liveTvServices = response2[0];
var liveTvInfo = response2[0];
var nodes = [];
nodes.push(getNode(rootFolder, 'open'));
if (liveTvServices.length) {
if (liveTvInfo.Services.length) {
nodes.push({ attr: { id: 'livetv', rel: 'folder', itemtype: 'livetv' }, data: 'Live TV', state: 'open' });
}
@ -113,9 +113,9 @@
function loadLiveTvServices(openItems, callback) {
ApiClient.getLiveTvServices().done(function (services) {
ApiClient.getLiveTvInfo().done(function (info) {
var nodes = services.map(function (i) {
var nodes = info.Services.map(function (i) {
var state = openItems.indexOf(i.Id) == -1 ? 'closed' : 'open';
@ -1231,9 +1231,6 @@
else if (currentItem.Type == "Studio") {
updatePromise = ApiClient.updateStudio(item);
}
else if (currentItem.Type == "Channel") {
updatePromise = ApiClient.updateLiveTvChannel(item);
}
else {
updatePromise = ApiClient.updateItem(item);
}

View File

@ -502,7 +502,7 @@
var isPlaying = MediaPlayer.isPlaying();
if (!isPlaying && !resumePositionTicks && mediaType != "Audio") {
MediaPlayer.playById(itemId, itemType);
MediaPlayer.playById(itemId);
return;
}
@ -516,7 +516,7 @@
if (itemType == "MusicArtist") {
html += '<li><a href="#" onclick="MediaPlayer.playArtist(\'' + itemId + '\');LibraryBrowser.closePlayMenu();">Play</a></li>';
} else if (itemType != "MusicGenre") {
html += '<li><a href="#" onclick="MediaPlayer.playById(\'' + itemId + '\', \'' + itemType + '\');LibraryBrowser.closePlayMenu();">Play</a></li>';
html += '<li><a href="#" onclick="MediaPlayer.playById(\'' + itemId + '\');LibraryBrowser.closePlayMenu();">Play</a></li>';
}
if (itemType == "Audio") {
@ -536,7 +536,7 @@
}
if (resumePositionTicks) {
html += '<li><a href="#" onclick="MediaPlayer.playById(\'' + itemId + '\', \'' + itemType + '\', ' + resumePositionTicks + ');LibraryBrowser.closePlayMenu();">Resume</a></li>';
html += '<li><a href="#" onclick="MediaPlayer.playById(\'' + itemId + '\', ' + resumePositionTicks + ');LibraryBrowser.closePlayMenu();">Resume</a></li>';
}
if (isPlaying) {
@ -2442,17 +2442,17 @@
html += LibraryBrowser.getMiscInfoHtml(item);
html += '</p>';
html += '<p>';
html += '<p style="margin: 1.25em 0;">';
html += '<span class="itemCommunityRating">';
html += LibraryBrowser.getRatingHtml(item);
html += '</span>';
html += '</p>';
//html += '<p>';
//html += '<span class="userDataIcons">';
//html += LibraryBrowser.getUserDataIconsHtml(item);
//html += '</span>';
//html += '</p>';
html += '<p style="margin: 1.25em 0;">';
html += '<span class="userDataIcons">';
html += LibraryBrowser.getUserDataIconsHtml(item);
html += '</span>';
html += '</p>';
html += '<p class="itemOverlayHtml">';
html += (item.OverviewHtml || item.Overview || '');
@ -2494,14 +2494,26 @@
var popup = $('.itemFlyout').on('mouseenter', onOverlayMouseOver).on('mouseleave', onOverlayMouseOut).popup({ positionTo: elem }).trigger('create').popup("open").on("popupafterclose", function () {
$(elem).off('mouseleave.overlay', onHoverOut);
$(this).off("popupafterclose").off("mouseenter").off("mouseleave").remove();
});
popup.parents().prev('.ui-popup-screen').remove();
currentPosterItem = elem;
}
$(elem).on('mouseleave.overlay', onHoverOut).on('click.overlay', hideOverlay);
function onPosterItemClicked() {
if (showOverlayTimeout) {
clearTimeout(showOverlayTimeout);
showOverlayTimeout = null;
}
if (hideOverlayTimeout) {
clearTimeout(hideOverlayTimeout);
hideOverlayTimeout = null;
}
hideOverlay();
}
function hideOverlay() {
@ -2510,7 +2522,7 @@
if (currentPosterItem) {
$(currentPosterItem).off('mouseleave.overlay').off('click.overlay');
$(currentPosterItem).off('click.overlay');
currentPosterItem = null;
}
}
@ -2535,7 +2547,7 @@
startHideOverlayTimer();
}
$.fn.createPosterItemHoverMenu = function (items) {
$.fn.createPosterItemHoverMenu = function () {
function onShowTimerExpired(elem) {
@ -2573,14 +2585,19 @@
}, 600);
}
return this.hoverIntent({
over: onHoverIn,
out: function () {
// https://hacks.mozilla.org/2013/04/detecting-touch-its-the-why-not-the-how/
},
selector: '.posterItem'
if (('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)) {
/* browser with either Touch Events of Pointer Events
running on touch-capable device */
return this;
}
});
return this;
return this.on('mouseenter', '.posterItem', onHoverIn)
.on('mouseleave', '.posterItem', onHoverOut)
.on('click', '.posterItem', onPosterItemClicked);
};
})(jQuery, document, window);

View File

@ -1,11 +1,11 @@
(function (window, document, $) {
var itemCountsPromise;
var liveTvServicesPromise;
var liveTvInfoPromise;
function ensurePromises() {
itemCountsPromise = itemCountsPromise || ApiClient.getItemCounts(Dashboard.getCurrentUserId());
liveTvServicesPromise = liveTvServicesPromise || ApiClient.getLiveTvServices();
liveTvInfoPromise = liveTvInfoPromise || ApiClient.getLiveTvInfo();
}
function renderHeader(page, user) {
@ -56,7 +56,7 @@
$('.viewMenuBar', page).trigger('create');
}
function insertViews(page, user, counts, liveTvServices) {
function insertViews(page, user, counts, liveTvInfo) {
var html = '';
@ -74,7 +74,7 @@
html += '<a class="viewMenuLink viewMenuTextLink desktopViewMenuLink' + (view == 'tv' ? selectedCssClass : '') + '" href="tvrecommended.html">' + (view == 'tv' ? selectedHtml : '') + '<span class="viewName">TV</span></a>';
}
if (liveTvServices.length) {
if (liveTvInfo.ActiveServiceName) {
html += '<a class="viewMenuLink viewMenuTextLink desktopViewMenuLink' + (view == 'livetv' ? selectedCssClass : '') + '" href="livetvsuggested.html">' + (view == 'livetv' ? selectedHtml : '') + '<span class="viewName">Live TV</span></a>';
}
@ -93,18 +93,18 @@
ensurePromises();
$.when(itemCountsPromise, liveTvServicesPromise).done(function (response1, response2) {
$.when(itemCountsPromise, liveTvInfoPromise).done(function (response1, response2) {
var counts = response1[0];
var liveTvServices = response2[0];
var liveTvInfo = response2[0];
var panel = getLibraryMenu(page, counts, liveTvServices);
var panel = getLibraryMenu(page, counts, liveTvInfo);
$(panel).panel('toggle');
});
}
function getLibraryMenu(page, counts, liveTvServices) {
function getLibraryMenu(page, counts, liveTvInfo) {
var panel = $('#libraryPanel', page);
@ -146,7 +146,7 @@
]);
}
if (liveTvServices.length) {
if (liveTvInfo.ActiveServiceName) {
html += getCollapsibleHtml('Live TV', [
{ text: 'Suggested', href: 'livetvsuggested.html' },
@ -249,12 +249,12 @@
ensurePromises();
$.when(itemCountsPromise, liveTvServicesPromise).done(function (response1, response2) {
$.when(itemCountsPromise, liveTvInfoPromise).done(function (response1, response2) {
var counts = response1[0];
var liveTvServices = response2[0];
var liveTvInfo = response2[0];
insertViews(page, user, counts, liveTvServices);
insertViews(page, user, counts, liveTvInfo);
});

View File

@ -1,8 +1,8 @@
(function ($, document, window) {
function loadPage(page, config, tvServices) {
function loadPage(page, config, liveTvInfo) {
if (tvServices.length) {
if (liveTvInfo.Services.length) {
$('.liveTvSettingsForm', page).show();
$('.noLiveTvServices', page).hide();
@ -25,7 +25,7 @@
var promise1 = ApiClient.getServerConfiguration();
var promise2 = ApiClient.getLiveTvServices();
var promise2 = ApiClient.getLiveTvInfo();
$.when(promise1, promise2).done(function (response1, response2) {

View File

@ -14,7 +14,7 @@
Dashboard.alert('Recording cancelled.');
reload(page);
Dashboard.navigate('livetvtimers.html');
});
}

View File

@ -363,7 +363,7 @@
if (!$(this).hasClass('selectedMediaFlyoutOption')) {
var channelId = this.getAttribute('data-channelid');
self.playById(channelId, 'Channel');
self.playById(channelId);
}
hideFlyout($('#channelsFlyout'));
@ -1229,29 +1229,7 @@
return ApiClient.getItems(userId, query);
};
self.playById = function (id, itemType, startPositionTicks) {
if (itemType == "Recording") {
ApiClient.getLiveTvRecording(id, Dashboard.getCurrentUserId()).done(function (item) {
self.play([item], startPositionTicks);
});
return;
}
if (itemType == "Channel") {
ApiClient.getLiveTvChannel(id, Dashboard.getCurrentUserId()).done(function (item) {
self.play([item], startPositionTicks);
});
return;
}
self.playById = function (id, startPositionTicks) {
ApiClient.getItem(Dashboard.getCurrentUserId(), id).done(function (item) {

View File

@ -1,8 +0,0 @@
/*!
* hoverIntent r7 // 2013.03.11 // jQuery 1.9.1+
* http://cherne.net/brian/resources/jquery.hoverIntent.html
*
* You may use hoverIntent under the terms of the MIT license.
* Copyright 2007, 2013 Brian Cherne
*/
(function(e){e.fn.hoverIntent=function(t,n,r){var i={interval:100,sensitivity:7,timeout:0};if(typeof t==="object"){i=e.extend(i,t)}else if(e.isFunction(n)){i=e.extend(i,{over:t,out:n,selector:r})}else{i=e.extend(i,{over:t,out:t,selector:n})}var s,o,u,a;var f=function(e){s=e.pageX;o=e.pageY};var l=function(t,n){n.hoverIntent_t=clearTimeout(n.hoverIntent_t);if(Math.abs(u-s)+Math.abs(a-o)<i.sensitivity){e(n).off("mousemove.hoverIntent",f);n.hoverIntent_s=1;return i.over.apply(n,[t])}else{u=s;a=o;n.hoverIntent_t=setTimeout(function(){l(t,n)},i.interval)}};var c=function(e,t){t.hoverIntent_t=clearTimeout(t.hoverIntent_t);t.hoverIntent_s=0;return i.out.apply(t,[e])};var h=function(t){var n=jQuery.extend({},t);var r=this;if(r.hoverIntent_t){r.hoverIntent_t=clearTimeout(r.hoverIntent_t)}if(t.type=="mouseenter"){u=n.pageX;a=n.pageY;e(r).on("mousemove.hoverIntent",f);if(r.hoverIntent_s!=1){r.hoverIntent_t=setTimeout(function(){l(n,r)},i.interval)}}else{e(r).off("mousemove.hoverIntent",f);if(r.hoverIntent_s==1){r.hoverIntent_t=setTimeout(function(){c(n,r)},i.timeout)}}};return this.on({"mouseenter.hoverIntent":h,"mouseleave.hoverIntent":h},i.selector)}})(jQuery)

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.228" targetFramework="net45" />
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.230" targetFramework="net45" />
</packages>