mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 11:28:23 -07:00
commit
831de782a0
@ -1,8 +1,8 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
//require(['imageFetcher'], function (imageFetcher) {
|
require(['imageFetcher'], function (imageFetcher) {
|
||||||
// window.ImageFetcherLazyloadImage = imageFetcher;
|
window.ImageFetcherLazyloadImage = imageFetcher;
|
||||||
//});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <lazyload-image>
|
* <lazyload-image>
|
||||||
@ -16,83 +16,25 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var FALLBACK_IMAGE = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAEElEQVR42gEFAPr/AP///wAI/AL+Sr4t6gAAAABJRU5ErkJggg==';
|
var FALLBACK_IMAGE = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAEElEQVR42gEFAPr/AP///wAI/AL+Sr4t6gAAAABJRU5ErkJggg==';
|
||||||
var DEFAULT_OFFSET = 0;
|
|
||||||
|
|
||||||
// create prototype from HTMLImageElement
|
// create prototype from HTMLImageElement
|
||||||
var LazyloadImagePrototype = Object.create(HTMLImageElement.prototype);
|
var LazyloadImagePrototype = Object.create(HTMLImageElement.prototype);
|
||||||
|
|
||||||
function fadeIn(elem) {
|
|
||||||
|
|
||||||
if (elem.classList.contains('noFade')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var keyframes = [
|
|
||||||
{ opacity: '0', offset: 0 },
|
|
||||||
{ opacity: '1', offset: 1 }];
|
|
||||||
var timing = { duration: 300, iterations: 1 };
|
|
||||||
elem.animate(keyframes, timing);
|
|
||||||
}
|
|
||||||
|
|
||||||
function imgObserver(that, mutations) {
|
|
||||||
mutations.forEach(function (mutation) {
|
|
||||||
|
|
||||||
if (mutation.attributeName != 'src') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var src = that.src;
|
|
||||||
|
|
||||||
if (src && src != FALLBACK_IMAGE) {
|
|
||||||
|
|
||||||
if (!that.loadingSrc) {
|
|
||||||
that.src = FALLBACK_IMAGE;
|
|
||||||
that.loadingSrc = src;
|
|
||||||
|
|
||||||
ImageFetcherLazyloadImage.loadImage(that, src);
|
|
||||||
} else {
|
|
||||||
that.loadingSrc = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (!src) {
|
|
||||||
that.src = FALLBACK_IMAGE;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// lifecycle callbacks
|
// lifecycle callbacks
|
||||||
LazyloadImagePrototype.createdCallback = function () {
|
//LazyloadImagePrototype.createdCallback = function () {
|
||||||
|
|
||||||
var that = this;
|
|
||||||
|
|
||||||
if (window.ImageFetcherLazyloadImage) {
|
|
||||||
// swap original src attribute
|
|
||||||
this.original = this.currentSrc || this.src;
|
|
||||||
this.src = FALLBACK_IMAGE;
|
|
||||||
|
|
||||||
var observer = new MutationObserver(function (mutations) {
|
|
||||||
imgObserver(that, mutations);
|
|
||||||
});
|
|
||||||
|
|
||||||
// pass in the target node, as well as the observer options
|
|
||||||
observer.observe(this, { attributes: true, childList: false, characterData: false });
|
|
||||||
|
|
||||||
this.observer = observer;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//LazyloadImagePrototype.attachedCallback = function () {
|
|
||||||
|
|
||||||
|
|
||||||
//};
|
//};
|
||||||
|
|
||||||
LazyloadImagePrototype.detachedCallback = function () {
|
LazyloadImagePrototype.attachedCallback = function () {
|
||||||
|
|
||||||
if (this.observer) {
|
var original = this.currentSrc || this.src;
|
||||||
// later, you can stop observing
|
|
||||||
this.observer.disconnect();
|
if (original && window.ImageFetcherLazyloadImage) {
|
||||||
|
//console.log(original);
|
||||||
|
this.src = FALLBACK_IMAGE;
|
||||||
|
console.log('loading ' + original);
|
||||||
|
ImageFetcherLazyloadImage.loadImage(this, original);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return document.registerElement('lazyload-image', {
|
return document.registerElement('lazyload-image', {
|
||||||
|
@ -32,14 +32,14 @@
|
|||||||
"web-component-tester": "^4.0.0",
|
"web-component-tester": "^4.0.0",
|
||||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/PolymerElements/iron-icon",
|
"homepage": "https://github.com/polymerelements/iron-icon",
|
||||||
"_release": "1.0.8",
|
"_release": "1.0.8",
|
||||||
"_resolution": {
|
"_resolution": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"tag": "v1.0.8",
|
"tag": "v1.0.8",
|
||||||
"commit": "f36b38928849ef3853db727faa8c9ef104d611eb"
|
"commit": "f36b38928849ef3853db727faa8c9ef104d611eb"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/PolymerElements/iron-icon.git",
|
"_source": "git://github.com/polymerelements/iron-icon.git",
|
||||||
"_target": "^1.0.0",
|
"_target": "^1.0.0",
|
||||||
"_originalSource": "PolymerElements/iron-icon"
|
"_originalSource": "polymerelements/iron-icon"
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
function getTemplate(scrollTarget) {
|
function getTemplate(scrollTarget) {
|
||||||
|
|
||||||
var maxPhysical = 80;
|
var maxPhysical = 200;
|
||||||
|
|
||||||
// is="lazyload-image"
|
// is="lazyload-image"
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<div class="cardScalable">
|
<div class="cardScalable">
|
||||||
<div class="cardPadder"></div>
|
<div class="cardPadder"></div>
|
||||||
<a onclick$="{{item.onclick}}" data-action$="{{item.defaultAction}}" class$="{{item.anchorClass}}" href$="{{item.href}}">
|
<a onclick$="{{item.onclick}}" data-action$="{{item.defaultAction}}" class$="{{item.anchorClass}}" href$="{{item.href}}">
|
||||||
<img class$="{{item.imageClass}}" src$="{{item.imgUrl}}" />
|
<img is="lazyload-image" class$="{{item.imageClass}}" src$="{{item.imgUrl}}" />
|
||||||
<div inner-h-t-m-l="{{item.overlayHtml}}"></div>
|
<div inner-h-t-m-l="{{item.overlayHtml}}"></div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1192,7 +1192,7 @@ span.itemCommunityRating:not(:empty) + .userDataIcons {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.layout-desktop .absolutePageTabContent .alphabetPicker {
|
.layout-desktop .absolutePageTabContent .alphabetPicker {
|
||||||
right: 15px;
|
right: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.alphabetPicker a {
|
.alphabetPicker a {
|
||||||
|
@ -183,7 +183,7 @@
|
|||||||
self.showFilterMenu();
|
self.showFilterMenu();
|
||||||
});
|
});
|
||||||
|
|
||||||
tabContent.querySelector('.btnSort').addEventListener('click', function () {
|
tabContent.querySelector('.btnSort').addEventListener('click', function (e) {
|
||||||
libraryBrowser.showSortMenu({
|
libraryBrowser.showSortMenu({
|
||||||
items: [{
|
items: [{
|
||||||
name: Globalize.translate('OptionNameSort'),
|
name: Globalize.translate('OptionNameSort'),
|
||||||
@ -224,7 +224,8 @@
|
|||||||
callback: function () {
|
callback: function () {
|
||||||
reloadItems(tabContent);
|
reloadItems(tabContent);
|
||||||
},
|
},
|
||||||
query: getQuery(tabContent)
|
query: getQuery(tabContent),
|
||||||
|
button: e.target
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2163,7 +2163,6 @@
|
|||||||
item['data-' + att.name] = att.value;
|
item['data-' + att.name] = att.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(item['data-commands']);
|
|
||||||
|
|
||||||
var defaultAction = options.defaultAction;
|
var defaultAction = options.defaultAction;
|
||||||
if (defaultAction == 'play' || defaultAction == 'playallfromhere') {
|
if (defaultAction == 'play' || defaultAction == 'playallfromhere') {
|
||||||
|
@ -671,7 +671,7 @@
|
|||||||
if (itemSelectionPanel) {
|
if (itemSelectionPanel) {
|
||||||
return onItemSelectionPanelClick(e, itemSelectionPanel);
|
return onItemSelectionPanelClick(e, itemSelectionPanel);
|
||||||
}
|
}
|
||||||
if (card.classList.contains('groupedCard')) {
|
else if (card.classList.contains('groupedCard')) {
|
||||||
return onGroupedCardClick(e, card);
|
return onGroupedCardClick(e, card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -891,7 +891,6 @@
|
|||||||
element.classList.add('hasTapHold');
|
element.classList.add('hasTapHold');
|
||||||
|
|
||||||
manager.on('press', onTapHold);
|
manager.on('press', onTapHold);
|
||||||
manager.on('pressup', onTapHoldUp);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
showTapHoldHelp(element);
|
showTapHoldHelp(element);
|
||||||
@ -952,23 +951,6 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTapHoldUp(e) {
|
|
||||||
|
|
||||||
var itemSelectionPanel = parentWithClass(e.target, 'itemSelectionPanel');
|
|
||||||
|
|
||||||
if (itemSelectionPanel) {
|
|
||||||
if (!parentWithClass(e.target, 'chkItemSelect')) {
|
|
||||||
var chkItemSelect = itemSelectionPanel.querySelector('.chkItemSelect');
|
|
||||||
|
|
||||||
if (chkItemSelect) {
|
|
||||||
chkItemSelect.checked = !chkItemSelect.checked;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
e.preventDefault();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onItemSelectionPanelClick(e, itemSelectionPanel) {
|
function onItemSelectionPanelClick(e, itemSelectionPanel) {
|
||||||
|
|
||||||
// toggle the checkbox, if it wasn't clicked on
|
// toggle the checkbox, if it wasn't clicked on
|
||||||
@ -976,11 +958,16 @@
|
|||||||
var chkItemSelect = itemSelectionPanel.querySelector('.chkItemSelect');
|
var chkItemSelect = itemSelectionPanel.querySelector('.chkItemSelect');
|
||||||
|
|
||||||
if (chkItemSelect) {
|
if (chkItemSelect) {
|
||||||
|
|
||||||
|
if (chkItemSelect.classList.contains('checkedInitial')) {
|
||||||
|
chkItemSelect.classList.remove('checkedInitial');
|
||||||
|
} else {
|
||||||
var newValue = !chkItemSelect.checked;
|
var newValue = !chkItemSelect.checked;
|
||||||
chkItemSelect.checked = newValue;
|
chkItemSelect.checked = newValue;
|
||||||
updateItemSelection(chkItemSelect, newValue);
|
updateItemSelection(chkItemSelect, newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@ -991,7 +978,7 @@
|
|||||||
updateItemSelection(this, this.checked);
|
updateItemSelection(this, this.checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showSelection(item) {
|
function showSelection(item, isChecked) {
|
||||||
|
|
||||||
var itemSelectionPanel = item.querySelector('.itemSelectionPanel');
|
var itemSelectionPanel = item.querySelector('.itemSelectionPanel');
|
||||||
|
|
||||||
@ -1002,12 +989,16 @@
|
|||||||
|
|
||||||
item.querySelector('.cardContent').appendChild(itemSelectionPanel);
|
item.querySelector('.cardContent').appendChild(itemSelectionPanel);
|
||||||
|
|
||||||
var chkItemSelect = document.createElement('paper-checkbox');
|
var cssClass = 'chkItemSelect';
|
||||||
chkItemSelect.classList.add('chkItemSelect');
|
if (isChecked && !browserInfo.firefox) {
|
||||||
|
// In firefox, the initial tap hold doesnt' get treated as a click
|
||||||
$(chkItemSelect).on('change', onSelectionChange);
|
// In other browsers it does, so we need to make sure that initial click is ignored
|
||||||
|
cssClass += ' checkedInitial';
|
||||||
itemSelectionPanel.appendChild(chkItemSelect);
|
}
|
||||||
|
var checkedAttribute = isChecked ? ' checked' : '';
|
||||||
|
itemSelectionPanel.innerHTML = '<paper-checkbox class="' + cssClass + '"' + checkedAttribute + '></paper-checkbox>';
|
||||||
|
var chkItemSelect = itemSelectionPanel.querySelector('paper-checkbox');
|
||||||
|
chkItemSelect.addEventListener('change', onSelectionChange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1059,7 +1050,10 @@
|
|||||||
{ transform: 'translate3d(-10px, 0, 0)', offset: 0.9 },
|
{ transform: 'translate3d(-10px, 0, 0)', offset: 0.9 },
|
||||||
{ transform: 'translate3d(0, 0, 0)', offset: 1 }];
|
{ transform: 'translate3d(0, 0, 0)', offset: 1 }];
|
||||||
var timing = { duration: 900, iterations: iterations };
|
var timing = { duration: 900, iterations: iterations };
|
||||||
return elem.animate(keyframes, timing);
|
|
||||||
|
if (elem.animate) {
|
||||||
|
elem.animate(keyframes, timing);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showSelections(initialCard) {
|
function showSelections(initialCard) {
|
||||||
@ -1067,11 +1061,10 @@
|
|||||||
require(['paper-checkbox'], function () {
|
require(['paper-checkbox'], function () {
|
||||||
var cards = document.querySelectorAll('.card');
|
var cards = document.querySelectorAll('.card');
|
||||||
for (var i = 0, length = cards.length; i < length; i++) {
|
for (var i = 0, length = cards.length; i < length; i++) {
|
||||||
showSelection(cards[i]);
|
showSelection(cards[i], initialCard == cards[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
showSelectionCommands();
|
showSelectionCommands();
|
||||||
initialCard.querySelector('.chkItemSelect').checked = true;
|
|
||||||
updateItemSelection(initialCard, true);
|
updateItemSelection(initialCard, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -3107,11 +3107,11 @@ pageClassOn('viewshow', "page", function () {
|
|||||||
page.classList.remove('ui-body-a');
|
page.classList.remove('ui-body-a');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentTheme != 'a' && !browserInfo.mobile) {
|
//if (currentTheme != 'a' && !browserInfo.mobile) {
|
||||||
document.documentElement.classList.add('darkScrollbars');
|
// document.documentElement.classList.add('darkScrollbars');
|
||||||
} else {
|
//} else {
|
||||||
document.documentElement.classList.remove('darkScrollbars');
|
// document.documentElement.classList.remove('darkScrollbars');
|
||||||
}
|
//}
|
||||||
|
|
||||||
var apiClient = window.ApiClient;
|
var apiClient = window.ApiClient;
|
||||||
|
|
||||||
|
@ -153,7 +153,6 @@
|
|||||||
|
|
||||||
// Hack: notifyResize needs to be done after the items have been rendered
|
// Hack: notifyResize needs to be done after the items have been rendered
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
|
||||||
ironList.notifyResize();
|
ironList.notifyResize();
|
||||||
self.scrollThreshold.resetSize();
|
self.scrollThreshold.resetSize();
|
||||||
}, 300);
|
}, 300);
|
||||||
@ -213,7 +212,7 @@
|
|||||||
self.showFilterMenu();
|
self.showFilterMenu();
|
||||||
});
|
});
|
||||||
|
|
||||||
tabContent.querySelector('.btnSort').addEventListener('click', function () {
|
tabContent.querySelector('.btnSort').addEventListener('click', function (e) {
|
||||||
libraryBrowser.showSortMenu({
|
libraryBrowser.showSortMenu({
|
||||||
items: [{
|
items: [{
|
||||||
name: Globalize.translate('OptionNameSort'),
|
name: Globalize.translate('OptionNameSort'),
|
||||||
@ -251,7 +250,8 @@
|
|||||||
getQuery(tabContent).StartIndex = 0;
|
getQuery(tabContent).StartIndex = 0;
|
||||||
reloadItems(tabContent);
|
reloadItems(tabContent);
|
||||||
},
|
},
|
||||||
query: getQuery(tabContent)
|
query: getQuery(tabContent),
|
||||||
|
button: e.target
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -287,6 +287,11 @@
|
|||||||
|
|
||||||
tabContent.querySelector('.itemsContainer').innerHTML = html;
|
tabContent.querySelector('.itemsContainer').innerHTML = html;
|
||||||
self.listCreated = true;
|
self.listCreated = true;
|
||||||
|
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
|
setTimeout(resolve, 2000);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user