add remote control script file

This commit is contained in:
Luke Pulverenti 2013-05-28 21:45:39 -04:00
parent 1c9f49e4f3
commit 57fed6b0ad
5 changed files with 146 additions and 103 deletions

View File

@ -1,16 +1,6 @@
(function ($, document, LibraryBrowser, window) {
var currentItem;
var sessionsPromise;
function getSessionsPromise() {
if (sessionsPromise == null) {
sessionsPromise = ApiClient.getSessions();
}
return sessionsPromise;
}
function reload(page) {
@ -874,6 +864,11 @@
Dashboard.navigate("edititemmetadata.html?id=" + currentItem.Id);
});
$('#btnRemote', page).on('click', function () {
RemoteControl.showMenu(page, currentItem);
});
}).on('pageshow', "#itemDetailPage", function () {
var page = this;

View File

@ -0,0 +1,93 @@
(function (window, document, $) {
function getPickerHtml() {
var html = '';
html += '<a href="#">#</a>';
html += '<a href="#">A</a>';
html += '<a href="#">B</a>';
html += '<a href="#">C</a>';
html += '<a href="#">D</a>';
html += '<a href="#">E</a>';
html += '<a href="#">F</a>';
html += '<a href="#">G</a>';
html += '<a href="#">H</a>';
html += '<a href="#">I</a>';
html += '<a href="#">J</a>';
html += '<a href="#">K</a>';
html += '<a href="#">L</a>';
html += '<a href="#">M</a>';
html += '<a href="#">N</a>';
html += '<a href="#">O</a>';
html += '<a href="#">P</a>';
html += '<a href="#">Q</a>';
html += '<a href="#">R</a>';
html += '<a href="#">S</a>';
html += '<a href="#">T</a>';
html += '<a href="#">U</a>';
html += '<a href="#">V</a>';
html += '<a href="#">W</a>';
html += '<a href="#">X</a>';
html += '<a href="#">Y</a>';
html += '<a href="#">Z</a>';
return html;
}
$(document).on('pageinit', ".libraryPage", function () {
var page = this;
var picker = $('.alphabetPicker', page);
if (!picker.length) {
return;
}
$('.itemsContainer', page).addClass('itemsContainerWithAlphaPicker');
picker.html(getPickerHtml()).trigger('create').on('click', 'a', function () {
var elem = $(this);
var isSelected = elem.hasClass('selectedCharacter');
$('.selectedCharacter', picker).removeClass('selectedCharacter');
if (!isSelected) {
elem.addClass('selectedCharacter');
picker.trigger('alphaselect', [this.innerHTML]);
} else {
picker.trigger('alphaclear');
}
});
});
$.fn.alphaValue = function (val) {
if (val == null) {
return $('.selectedCharacter', this).html();
}
val = val.toLowerCase();
$('.selectedCharacter', this).removeClass('selectedCharacter');
$('a', this).each(function () {
if (this.innerHTML.toLowerCase() == val) {
$(this).addClass('selectedCharacter');
} else {
$(this).removeClass('selectedCharacter');
}
});
return this;
};
})(window, document, jQuery);

View File

@ -1745,96 +1745,3 @@
})(window, document, jQuery);
(function (window, document, $) {
function getPickerHtml() {
var html = '';
html += '<a href="#">#</a>';
html += '<a href="#">A</a>';
html += '<a href="#">B</a>';
html += '<a href="#">C</a>';
html += '<a href="#">D</a>';
html += '<a href="#">E</a>';
html += '<a href="#">F</a>';
html += '<a href="#">G</a>';
html += '<a href="#">H</a>';
html += '<a href="#">I</a>';
html += '<a href="#">J</a>';
html += '<a href="#">K</a>';
html += '<a href="#">L</a>';
html += '<a href="#">M</a>';
html += '<a href="#">N</a>';
html += '<a href="#">O</a>';
html += '<a href="#">P</a>';
html += '<a href="#">Q</a>';
html += '<a href="#">R</a>';
html += '<a href="#">S</a>';
html += '<a href="#">T</a>';
html += '<a href="#">U</a>';
html += '<a href="#">V</a>';
html += '<a href="#">W</a>';
html += '<a href="#">X</a>';
html += '<a href="#">Y</a>';
html += '<a href="#">Z</a>';
return html;
}
$(document).on('pageinit', ".libraryPage", function () {
var page = this;
var picker = $('.alphabetPicker', page);
if (!picker.length) {
return;
}
$('.itemsContainer', page).addClass('itemsContainerWithAlphaPicker');
picker.html(getPickerHtml()).trigger('create').on('click', 'a', function () {
var elem = $(this);
var isSelected = elem.hasClass('selectedCharacter');
$('.selectedCharacter', picker).removeClass('selectedCharacter');
if (!isSelected) {
elem.addClass('selectedCharacter');
picker.trigger('alphaselect', [this.innerHTML]);
} else {
picker.trigger('alphaclear');
}
});
});
$.fn.alphaValue = function (val) {
if (val == null) {
return $('.selectedCharacter', this).html();
}
val = val.toLowerCase();
$('.selectedCharacter', this).removeClass('selectedCharacter');
$('a', this).each(function () {
if (this.innerHTML.toLowerCase() == val) {
$(this).addClass('selectedCharacter');
} else {
$(this).removeClass('selectedCharacter');
}
});
return this;
};
})(window, document, jQuery);

View File

@ -492,6 +492,13 @@
level: 3
}));
var tsVideoUrl = ApiClient.getUrl('Videos/' + item.Id + '/stream.ts', $.extend({}, baseParams, {
videoCodec: 'h264',
audioCodec: 'aac',
profile: 'baseline',
level: 3
}));
var webmVideoUrl = ApiClient.getUrl('Videos/' + item.Id + '/stream.webm', $.extend({}, baseParams, {
videoCodec: 'vpx',
audioCodec: 'Vorbis'
@ -517,6 +524,7 @@
}
html += '<source type="application/x-mpegURL" src="' + hlsVideoUrl + '" />';
html += '<source type="video/mp2t" src="' + tsVideoUrl + '" />';
html += '<source type="video/webm" src="' + webmVideoUrl + '" />';
html += '<source type="video/mp4" src="' + mp4VideoUrl + '" />';
html += '</video';

View File

@ -0,0 +1,40 @@
(function (window, document, $) {
function remoteControl() {
var self = this;
self.showMenu = function (page, item) {
$('#confirmFlyout').popup("close").remove();
var html = '<div data-role="popup" id="remoteControlFlyout">';
html += '<div class="ui-corner-top ui-bar-a" style="text-align:center;">';
html += '<h3>Remote Control</h3>';
html += '</div>';
html += '<div data-role="content" class="ui-corner-bottom ui-content">';
html += '<div style="padding: 1em;margin: 0;">test';
html += '</div>';
html += '<p><button type="button" data-icon="ok" onclick="$(\'#confirmFlyout\')[0].confirm=true;$(\'#confirmFlyout\').popup(\'close\');" data-theme="b" data-mini="true" data-inline="true">Ok</button>';
html += '<button type="button" data-icon="delete" onclick="$(\'#confirmFlyout\').popup(\'close\');" data-theme="a" data-mini="true" data-inline="true">Cancel</button></p>';
html += '</div>';
html += '</div>';
$(document.body).append(html);
$('#remoteControlFlyout').popup({ history: false }).trigger('create').popup("open").on("popupafterclose", function () {
$(this).off("popupafterclose").remove();
});
};
}
window.RemoteControl = new remoteControl();
})(window, document, jQuery);