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

update collection menus

This commit is contained in:
Luke Pulverenti 2015-10-07 17:42:29 -04:00
parent 65442321a0
commit 8119b930e4
17 changed files with 183 additions and 52 deletions

View file

@ -166,7 +166,7 @@
var accessToken = currentServerInfo.AccessToken; var accessToken = currentServerInfo.AccessToken;
if (accessToken) { if (accessToken) {
headers['X-Emby-Token'] = accessToken; headers['X-MediaBrowser-Token'] = accessToken;
} }
}; };

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-media-query", "name": "iron-media-query",
"version": "1.0.2", "version": "1.0.3",
"description": "Lets you bind to a CSS media query", "description": "Lets you bind to a CSS media query",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -28,11 +28,11 @@
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0", "iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"_release": "1.0.2", "_release": "1.0.3",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.2", "tag": "v1.0.3",
"commit": "34abf0a3b8bf9e9e478352dbb3d9e6a76bf3669a" "commit": "80e921f58e7688a840a0cf29e9e2aaaee72a66b2"
}, },
"_source": "git://github.com/PolymerElements/iron-media-query.git", "_source": "git://github.com/PolymerElements/iron-media-query.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-media-query", "name": "iron-media-query",
"version": "1.0.2", "version": "1.0.3",
"description": "Lets you bind to a CSS media query", "description": "Lets you bind to a CSS media query",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"

View file

@ -48,23 +48,47 @@ Example:
query: { query: {
type: String, type: String,
observer: 'queryChanged' observer: 'queryChanged'
},
_boundMQHandler: {
value: function() {
return this.queryHandler.bind(this);
}
} }
}, },
created: function() { attached: function() {
this._mqHandler = this.queryHandler.bind(this); this.queryChanged();
}, },
queryChanged: function(query) { detached: function() {
this._remove();
},
_add: function() {
if (this._mq) { if (this._mq) {
this._mq.removeListener(this._mqHandler); this._mq.addListener(this._boundMQHandler);
}
},
_remove: function() {
if (this._mq) {
this._mq.removeListener(this._boundMQHandler);
}
this._mq = null;
},
queryChanged: function() {
this._remove();
var query = this.query;
if (!query) {
return;
} }
if (query[0] !== '(') { if (query[0] !== '(') {
query = '(' + query + ')'; query = '(' + query + ')';
} }
this._mq = window.matchMedia(query); this._mq = window.matchMedia(query);
this._mq.addListener(this._mqHandler); this._add();
this.queryHandler(this._mq); this.queryHandler(this._mq);
}, },

View file

@ -61,6 +61,42 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
assert.equal(mq.queryMatches, true); assert.equal(mq.queryMatches, true);
}); });
test('automatically wrap with parens', function() {
mq.query = 'min-width: 1px';
assert.equal(mq.queryMatches, true);
});
suite('query does not activate on empty string or null', function() {
test('empty string', function() {
mq.query = '';
assert.notOk(mq._mq);
});
test('null', function() {
mq.query = null;
assert.notOk(mq._mq);
});
});
test('media query destroys on detach', function() {
mq.query = '(max-width: 800px)';
mq.parentNode.removeChild(mq);
Polymer.dom.flush();
assert.notOk(mq._mq);
});
test('media query re-enables on attach', function() {
mq.query = '(max-width: 800px)';
var parent = mq.parentNode;
parent.removeChild(mq);
Polymer.dom.flush();
parent.appendChild(mq);
Polymer.dom.flush();
assert.ok(mq._mq);
});
}); });
}); });

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-selector", "name": "iron-selector",
"version": "1.0.6", "version": "1.0.7",
"description": "Manages a set of elements that can be selected", "description": "Manages a set of elements that can be selected",
"private": true, "private": true,
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
@ -32,11 +32,11 @@
"web-component-tester": "*", "web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"_release": "1.0.6", "_release": "1.0.7",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.6", "tag": "v1.0.7",
"commit": "08fa18c70b79abdee8a02486223ab9a4f0acc72c" "commit": "0b2f484ac3b1b03400da2d38b0f543f3688150a4"
}, },
"_source": "git://github.com/PolymerElements/iron-selector.git", "_source": "git://github.com/PolymerElements/iron-selector.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-selector", "name": "iron-selector",
"version": "1.0.6", "version": "1.0.7",
"description": "Manages a set of elements that can be selected", "description": "Manages a set of elements that can be selected",
"private": true, "private": true,
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",

View file

@ -128,6 +128,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
created: function() { created: function() {
this._bindFilterItem = this._filterItem.bind(this); this._bindFilterItem = this._filterItem.bind(this);
this._selection = new Polymer.IronSelection(this._applySelection.bind(this)); this._selection = new Polymer.IronSelection(this._applySelection.bind(this));
// TODO(cdata): When polymer/polymer#2535 lands, we do not need to do this
// book keeping anymore:
this.__listeningForActivate = false;
}, },
attached: function() { attached: function() {
@ -136,6 +139,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
if (!this.selectedItem && this.selected) { if (!this.selectedItem && this.selected) {
this._updateSelected(this.attrForSelected,this.selected) this._updateSelected(this.attrForSelected,this.selected)
} }
this._addListener(this.activateEvent);
}, },
detached: function() { detached: function() {
@ -202,11 +206,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}, },
_addListener: function(eventName) { _addListener: function(eventName) {
if (!this.isAttached || this.__listeningForActivate) {
return;
}
this.__listeningForActivate = true;
this.listen(this, eventName, '_activateHandler'); this.listen(this, eventName, '_activateHandler');
}, },
_removeListener: function(eventName) { _removeListener: function(eventName) {
this.unlisten(this, eventName, '_activateHandler'); this.unlisten(this, eventName, '_activateHandler');
this.__listeningForActivate = false;
}, },
_activateEventChanged: function(eventName, old) { _activateEventChanged: function(eventName, old) {

View file

@ -130,6 +130,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
assert.equal(s.selected, '0'); assert.equal(s.selected, '0');
}); });
test('activates after detach and re-attach', function() {
// Detach and re-attach
var parent = s.parentNode;
parent.removeChild(s);
parent.appendChild(s);
// select Item 2
s.children[2].dispatchEvent(new CustomEvent('tap', {bubbles: true}));
assert.equal(s.selected, '2');
});
}); });
</script> </script>

View file

@ -54,6 +54,7 @@
// product attributes: // product attributes:
// https://github.com/j3k0/cordova-plugin-purchase/blob/master/doc/api.md#validation-error-codes // https://github.com/j3k0/cordova-plugin-purchase/blob/master/doc/api.md#validation-error-codes
alert(JSON.stringify(product));
alert(JSON.stringify(product.transaction)); alert(JSON.stringify(product.transaction));
callback(true, { callback(true, {
@ -86,11 +87,12 @@
// show some logs and finish the transaction. // show some logs and finish the transaction.
store.when(id).approved(function (product) { store.when(id).approved(function (product) {
if (product.type == store.PAID_SUBSCRIPTION) {
product.verify();
} else {
product.finish(); product.finish();
} //if (product.type == store.PAID_SUBSCRIPTION) {
// product.verify();
//} else {
// product.finish();
//}
}); });
store.when(id).verified(function (p) { store.when(id).verified(function (p) {

View file

@ -183,6 +183,13 @@
PaperDialogHelper.close(dlg); PaperDialogHelper.close(dlg);
}); });
$(dlg).on('iron-overlay-closed', function () {
if (window.TabBar) {
TabBar.show();
}
});
dlg.classList.add('inAppPurchaseOverlay'); dlg.classList.add('inAppPurchaseOverlay');
} }
@ -222,6 +229,10 @@
require(['components/paperdialoghelper'], function () { require(['components/paperdialoghelper'], function () {
if (window.TabBar) {
TabBar.hide();
}
showInAppPurchaseElement(subscriptionOptions, unlockableProductInfo, dialogOptions, deferred); showInAppPurchaseElement(subscriptionOptions, unlockableProductInfo, dialogOptions, deferred);
currentDisplayingDeferred = deferred; currentDisplayingDeferred = deferred;

View file

@ -1015,7 +1015,7 @@
renderCollectionItemType(page, parentItem, { name: Globalize.translate('HeaderItems') }, items, user); renderCollectionItemType(page, parentItem, { name: Globalize.translate('HeaderItems') }, items, user);
} }
$('.collectionItems', page).createCardMenus(); $('.collectionItems .itemsContainer', page).createCardMenus();
} }
function renderCollectionItemType(page, parentItem, type, items, user, context) { function renderCollectionItemType(page, parentItem, type, items, user, context) {
@ -1029,7 +1029,7 @@
html += '</h1>'; html += '</h1>';
html += '<div class="detailSectionContent">'; html += '<div class="detailSectionContent itemsContainer">';
var shape = type.type == 'MusicAlbum' ? 'detailPageSquare' : 'detailPagePortrait'; var shape = type.type == 'MusicAlbum' ? 'detailPageSquare' : 'detailPagePortrait';
@ -1114,7 +1114,9 @@
var reviews = result.Items; var reviews = result.Items;
if (reviews.length) {
html += '<div class="paperList">'; html += '<div class="paperList">';
}
for (var i = 0, length = reviews.length; i < length; i++) { for (var i = 0, length = reviews.length; i < length; i++) {
@ -1171,7 +1173,9 @@
html += '</paper-icon-item>'; html += '</paper-icon-item>';
} }
if (reviews.length) {
html += '</div>'; html += '</div>';
}
if (limit && result.TotalRecordCount > limit) { if (limit && result.TotalRecordCount > limit) {
html += '<p style="margin: 0;"><paper-button raised class="more moreCriticReviews">' + Globalize.translate('ButtonMore') + '</paper-button></p>'; html += '<p style="margin: 0;"><paper-button raised class="more moreCriticReviews">' + Globalize.translate('ButtonMore') + '</paper-button></p>';

View file

@ -174,7 +174,11 @@
var card = parentWithClass(e.target, 'card'); var card = parentWithClass(e.target, 'card');
if (card) { if (card) {
var itemSelectionPanel = card.querySelector('.itemSelectionPanel');
if (!itemSelectionPanel) {
showContextMenu(card, {}); showContextMenu(card, {});
}
e.preventDefault(); e.preventDefault();
return false; return false;
@ -1364,6 +1368,10 @@
playAllFromHere(index, itemsContainer, 'play'); playAllFromHere(index, itemsContainer, 'play');
} }
else if (action == 'instantmix') {
MediaController.instantMix(itemId);
}
return false; return false;
} }

View file

@ -1517,27 +1517,18 @@
self.instantMix = function (id) { self.instantMix = function (id) {
var userId = Dashboard.getCurrentUserId();
ApiClient.getItem(userId, id).done(function (item) {
var promise;
var itemLimit = 100; var itemLimit = 100;
promise = ApiClient.getInstantMixFromItem(id, { ApiClient.getInstantMixFromItem(id, {
UserId: Dashboard.getCurrentUserId(), UserId: Dashboard.getCurrentUserId(),
Fields: getItemFields, Fields: getItemFields,
Limit: itemLimit Limit: itemLimit
});
promise.done(function (result) { }).done(function (result) {
self.play({ items: result.Items }); self.play({ items: result.Items });
}); });
});
}; };
self.stop = function (destroyRenderer) { self.stop = function (destroyRenderer) {

View file

@ -87,7 +87,7 @@
shape: getSquareShape(), shape: getSquareShape(),
showTitle: true, showTitle: true,
showParentTitle: true, showParentTitle: true,
defaultAction: 'play', defaultAction: 'instantmix',
lazy: true, lazy: true,
centerText: true, centerText: true,
overlayMoreButton: true overlayMoreButton: true
@ -132,7 +132,7 @@
shape: getSquareShape(), shape: getSquareShape(),
showTitle: true, showTitle: true,
showParentTitle: true, showParentTitle: true,
defaultAction: 'play', defaultAction: 'instantmix',
lazy: true, lazy: true,
centerText: true, centerText: true,
overlayMoreButton: true overlayMoreButton: true

View file

@ -33,7 +33,7 @@ body {
} }
.background-theme-b, paper-dialog.background-theme-b { .background-theme-b, paper-dialog.background-theme-b {
background: radial-gradient(circle, #303030, #101010); background: radial-gradient(circle, #282828, #101010);
} }
.backdropContainer .pageBackground { .backdropContainer .pageBackground {

View file

@ -10915,6 +10915,9 @@ The `aria-labelledby` attribute will be set to the header element, if one exists
created: function() { created: function() {
this._bindFilterItem = this._filterItem.bind(this); this._bindFilterItem = this._filterItem.bind(this);
this._selection = new Polymer.IronSelection(this._applySelection.bind(this)); this._selection = new Polymer.IronSelection(this._applySelection.bind(this));
// TODO(cdata): When polymer/polymer#2535 lands, we do not need to do this
// book keeping anymore:
this.__listeningForActivate = false;
}, },
attached: function() { attached: function() {
@ -10923,6 +10926,7 @@ The `aria-labelledby` attribute will be set to the header element, if one exists
if (!this.selectedItem && this.selected) { if (!this.selectedItem && this.selected) {
this._updateSelected(this.attrForSelected,this.selected) this._updateSelected(this.attrForSelected,this.selected)
} }
this._addListener(this.activateEvent);
}, },
detached: function() { detached: function() {
@ -10989,11 +10993,17 @@ The `aria-labelledby` attribute will be set to the header element, if one exists
}, },
_addListener: function(eventName) { _addListener: function(eventName) {
if (!this.isAttached || this.__listeningForActivate) {
return;
}
this.__listeningForActivate = true;
this.listen(this, eventName, '_activateHandler'); this.listen(this, eventName, '_activateHandler');
}, },
_removeListener: function(eventName) { _removeListener: function(eventName) {
this.unlisten(this, eventName, '_activateHandler'); this.unlisten(this, eventName, '_activateHandler');
this.__listeningForActivate = false;
}, },
_activateEventChanged: function(eventName, old) { _activateEventChanged: function(eventName, old) {
@ -11174,23 +11184,47 @@ The `aria-labelledby` attribute will be set to the header element, if one exists
query: { query: {
type: String, type: String,
observer: 'queryChanged' observer: 'queryChanged'
},
_boundMQHandler: {
value: function() {
return this.queryHandler.bind(this);
}
} }
}, },
created: function() { attached: function() {
this._mqHandler = this.queryHandler.bind(this); this.queryChanged();
}, },
queryChanged: function(query) { detached: function() {
this._remove();
},
_add: function() {
if (this._mq) { if (this._mq) {
this._mq.removeListener(this._mqHandler); this._mq.addListener(this._boundMQHandler);
}
},
_remove: function() {
if (this._mq) {
this._mq.removeListener(this._boundMQHandler);
}
this._mq = null;
},
queryChanged: function() {
this._remove();
var query = this.query;
if (!query) {
return;
} }
if (query[0] !== '(') { if (query[0] !== '(') {
query = '(' + query + ')'; query = '(' + query + ')';
} }
this._mq = window.matchMedia(query); this._mq = window.matchMedia(query);
this._mq.addListener(this._mqHandler); this._add();
this.queryHandler(this._mq); this.queryHandler(this._mq);
}, },