aboutsummaryrefslogtreecommitdiff
path: root/addons/webinterface.default/js
diff options
context:
space:
mode:
authorDoraXBMC <DoraXBMC>2013-01-05 22:39:15 +0200
committerDoraXBMC <DoraXBMC>2013-08-09 09:56:23 +0300
commit2492ed8e1ff0d5c92b199de7610f652085ebfc09 (patch)
treee9169503ed8388beae68502eace8ecdd2b7856aa /addons/webinterface.default/js
parent85bfca08835d489877f4fa3bd47b74f1da179e31 (diff)
Adding Profiles support to the XBMC default web interface.
Diffstat (limited to 'addons/webinterface.default/js')
-rwxr-xr-xaddons/webinterface.default/js/MediaLibrary.js82
1 files changed, 82 insertions, 0 deletions
diff --git a/addons/webinterface.default/js/MediaLibrary.js b/addons/webinterface.default/js/MediaLibrary.js
index 5731eb3e9a..916c418794 100755
--- a/addons/webinterface.default/js/MediaLibrary.js
+++ b/addons/webinterface.default/js/MediaLibrary.js
@@ -32,6 +32,7 @@ MediaLibrary.prototype = {
$('#tvshowLibrary').click(jQuery.proxy(this.tvshowLibraryOpen, this));
$('#pictureLibrary').click(jQuery.proxy(this.pictureLibraryOpen, this));
$('#remoteControl').click(jQuery.proxy(this.remoteControlOpen, this));
+ $('#profiles').click(jQuery.proxy(this.profilesOpen, this));
$('#overlay').click(jQuery.proxy(this.hideOverlay, this));
$(window).resize(jQuery.proxy(this.updatePlayButtonLocation, this));
$(document).on('keydown', jQuery.proxy(this.handleKeyPress, this));
@@ -43,6 +44,7 @@ MediaLibrary.prototype = {
$('#tvshowLibrary').removeClass('selected');
$('#remoteControl').removeClass('selected');
$('#pictureLibrary').removeClass('selected');
+ $('#profilesLibrary').removeClass('selected');
this.hideOverlay();
},
replaceAll: function (haystack, needle, thread) {
@@ -329,6 +331,10 @@ MediaLibrary.prototype = {
className = 'floatableAlbum';
code = '<p class="album" title="' + title + '">' + showTitle + '</p>';
break;
+ case 'profile':
+ className = 'floatableProfileThumb';
+ code = '<p class="album" title="' + title + '">' + showTitle + '</p>';
+ break;
}
return floatableAlbum.addClass(className).html('<div class="imgWrapper"><div class="inner"><img src="' + path + '" alt="' + title + '" /></div></div>' + code);
},
@@ -747,6 +753,15 @@ MediaLibrary.prototype = {
}
});
},
+ loadProfile: function (event) {
+ return xbmc.rpc.request({
+ 'context': this,
+ 'method': 'Profiles.LoadProfile',
+ 'params': {
+ 'profile': event.data.profile.label
+ }
+ });
+ },
movieLibraryOpen: function () {
this.resetPage();
$('#movieLibrary').addClass('selected');
@@ -891,6 +906,73 @@ MediaLibrary.prototype = {
libraryContainer.trigger('scroll');
}
},
+ profilesOpen: function () {
+ this.resetPage();
+ $('#profiles').addClass('selected');
+ $('.contentContainer').hide();
+ var libraryContainer = $('#profilesContainer');
+ if (!libraryContainer || libraryContainer.length == 0) {
+ $('#spinner').show();
+ var currentProfile = "";
+ xbmc.rpc.request({
+ 'method': 'Profiles.GetCurrentProfile',
+ 'params': {
+ 'properties': [
+ 'lockmode'
+ ]
+ },
+ 'success': function (data) {
+ if (data)
+ if (data.result)
+ currentProfile = data.result.label;
+ }
+ });
+ xbmc.rpc.request({
+ 'context': this,
+ 'method': 'Profiles.GetProfiles',
+ 'params': {
+ 'limits': {
+ 'start': 0
+ },
+ 'properties': [
+ 'thumbnail'
+ ],
+ 'sort': {
+ 'method': 'sorttitle',
+ 'ignorearticle': true
+ }
+ },
+ 'success': function (data) {
+ if (data && data.result && data.result.profiles) {
+ libraryContainer = $('<div>');
+ libraryContainer.attr('id', 'profilesContainer')
+ .addClass('contentContainer');
+ $('#content').append(libraryContainer);
+ } else {
+ libraryContainer.html('');
+ }
+ $.each($(data.result.profiles), jQuery.proxy(function (i, item) {
+ var itemLabel = item.label;
+ if (currentProfile == itemLabel)
+ {
+ itemLabel = itemLabel + "*";
+ }
+ var floatableProfileThumb = this.generateThumb('profile', item.thumbnail, itemLabel);
+ floatableProfileThumb.bind('click', { profile: item }, jQuery.proxy(this.loadProfile, this));
+ libraryContainer.append(floatableProfileThumb);
+ }, this));
+ libraryContainer.append($('<div>').addClass('footerPadding'));
+ $('#spinner').hide();
+ libraryContainer.bind('scroll', { activeLibrary: libraryContainer }, jQuery.proxy(this.updateScrollEffects, this));
+ libraryContainer.trigger('scroll');
+ myScroll = new iScroll('profilesContainer');
+ }
+ });
+ } else {
+ libraryContainer.show();
+ libraryContainer.trigger('scroll');
+ }
+ },
updateScrollEffects: function (event) {
if (event.data.activeLibrary && $(event.data.activeLibrary).scrollTop() > 0) {
$('#topScrollFade').fadeIn();