mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update file input behavior
This commit is contained in:
parent
262f60b800
commit
5e27de701a
17 changed files with 173 additions and 149 deletions
|
@ -2123,8 +2123,6 @@
|
|||
}
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="cardOverlayTarget"></div>';
|
||||
|
||||
if (item.LocationType == "Virtual" || item.LocationType == "Offline") {
|
||||
if (options.showLocationTypeIndicator !== false) {
|
||||
html += LibraryBrowser.getOfflineIndicatorHtml(item);
|
||||
|
@ -2193,8 +2191,6 @@
|
|||
|
||||
var html = '';
|
||||
|
||||
html += '<div class="' + footerClass + '">';
|
||||
|
||||
if (options.cardLayout) {
|
||||
html += '<div class="cardButtonContainer">';
|
||||
html += '<paper-icon-button icon="' + AppInfo.moreIcon + '" class="listviewMenuButton btnCardOptions"></paper-icon-button>';
|
||||
|
@ -2307,8 +2303,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
//cardFooter
|
||||
html += "</div>";
|
||||
if (html) {
|
||||
html = '<div class="' + footerClass + '">' + html;
|
||||
|
||||
//cardFooter
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
return html;
|
||||
},
|
||||
|
|
|
@ -17,25 +17,36 @@
|
|||
|
||||
elem = elem.querySelector('.cardOverlayTarget');
|
||||
|
||||
if ($(elem).is(':visible')) {
|
||||
slideDown(elem, 1);
|
||||
if (elem) {
|
||||
slideDownToHide(elem);
|
||||
}
|
||||
}
|
||||
|
||||
function slideDown(elem, iterations) {
|
||||
function slideDownToHide(elem) {
|
||||
|
||||
if (elem.classList.contains('hide')) {
|
||||
return;
|
||||
}
|
||||
|
||||
requestAnimationFrame(function () {
|
||||
var keyframes = [
|
||||
{ height: '100%', offset: 0 },
|
||||
{ height: '0', display: 'none', offset: 1 }];
|
||||
var timing = { duration: 300, iterations: iterations, fill: 'forwards', easing: 'ease-out' };
|
||||
var timing = { duration: 300, iterations: 1, fill: 'forwards', easing: 'ease-out' };
|
||||
|
||||
elem.animate(keyframes, timing).onfinish = function () {
|
||||
elem.style.display = 'none';
|
||||
elem.classList.add('hide');
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function slideUp(elem, iterations) {
|
||||
function slideUpToShow(elem) {
|
||||
|
||||
if (!elem.classList.contains('hide')) {
|
||||
return;
|
||||
}
|
||||
|
||||
elem.classList.remove('hide');
|
||||
|
||||
requestAnimationFrame(function () {
|
||||
elem.style.display = 'block';
|
||||
|
@ -43,7 +54,7 @@
|
|||
var keyframes = [
|
||||
{ height: '0', offset: 0 },
|
||||
{ height: '100%', offset: 1 }];
|
||||
var timing = { duration: 300, iterations: iterations, fill: 'forwards', easing: 'ease-out' };
|
||||
var timing = { duration: 300, iterations: 1, fill: 'forwards', easing: 'ease-out' };
|
||||
elem.animate(keyframes, timing);
|
||||
});
|
||||
}
|
||||
|
@ -690,6 +701,13 @@
|
|||
|
||||
var innerElem = elem.querySelector('.cardOverlayTarget');
|
||||
|
||||
if (!innerElem) {
|
||||
innerElem = document.createElement('div');
|
||||
innerElem.classList.add('hide');
|
||||
innerElem.classList.add('cardOverlayTarget');
|
||||
parentWithClass(elem, 'cardContent').appendChild(innerElem);
|
||||
}
|
||||
|
||||
var dataElement = elem;
|
||||
while (dataElement && !dataElement.getAttribute('data-itemid')) {
|
||||
dataElement = dataElement.parentNode;
|
||||
|
@ -721,7 +739,7 @@
|
|||
|
||||
$(innerElem).show();
|
||||
|
||||
slideUp(innerElem, 1);
|
||||
slideUpToShow(innerElem);
|
||||
}
|
||||
|
||||
function onHoverIn(e) {
|
||||
|
@ -920,7 +938,7 @@
|
|||
|
||||
if (!itemSelectionPanel) {
|
||||
|
||||
require(['paper-checkbox'], function() {
|
||||
require(['paper-checkbox'], function () {
|
||||
itemSelectionPanel = document.createElement('div');
|
||||
itemSelectionPanel.classList.add('itemSelectionPanel');
|
||||
|
||||
|
@ -1273,19 +1291,27 @@
|
|||
|
||||
if (userData.Played) {
|
||||
|
||||
if (!$('.playedIndicator', card).length) {
|
||||
var playedIndicator = card.querySelector('.playedIndicator');
|
||||
|
||||
$('<div class="playedIndicator"></div>').insertAfter($('.cardOverlayTarget', card));
|
||||
if (!playedIndicator) {
|
||||
|
||||
playedIndicator = document.createElement('div');
|
||||
playedIndicator.classList.add('playedIndicator');
|
||||
card.querySelector('.cardContent').appendChild(playedIndicator);
|
||||
}
|
||||
$('.playedIndicator', card).html('<iron-icon icon="check"></iron-icon>');
|
||||
playedIndicator.innerHTML = '<iron-icon icon="check"></iron-icon>';
|
||||
}
|
||||
else if (userData.UnplayedItemCount) {
|
||||
|
||||
if (!$('.playedIndicator', card).length) {
|
||||
var playedIndicator = card.querySelector('.playedIndicator');
|
||||
|
||||
$('<div class="playedIndicator"></div>').insertAfter($('.cardOverlayTarget', card));
|
||||
if (!playedIndicator) {
|
||||
|
||||
playedIndicator = document.createElement('div');
|
||||
playedIndicator.classList.add('playedIndicator');
|
||||
card.querySelector('.cardContent').appendChild(playedIndicator);
|
||||
}
|
||||
$('.playedIndicator', card).html(userData.UnplayedItemCount);
|
||||
playedIndicator.innerHTML = userData.UnplayedItemCount;
|
||||
}
|
||||
|
||||
var progressHtml = LibraryBrowser.getItemProgressBarHtml(userData);
|
||||
|
|
|
@ -31,10 +31,10 @@
|
|||
|
||||
$('#fldImage', page).show().html('').html("<img width='140px' src='" + imageUrl + "' />");
|
||||
|
||||
var showNewImageForm = false;
|
||||
|
||||
if (user.ConnectLinkType == 'Guest') {
|
||||
|
||||
$('.newImageForm', page).hide();
|
||||
$('#btnDeleteImage', page).hide();
|
||||
$('.connectMessage', page).show();
|
||||
}
|
||||
|
@ -42,16 +42,22 @@
|
|||
|
||||
$('#btnDeleteImage', page).show();
|
||||
$('#headerUploadNewImage', page).show();
|
||||
$('.newImageForm', page).show();
|
||||
showNewImageForm = true;
|
||||
$('.connectMessage', page).hide();
|
||||
|
||||
} else {
|
||||
$('.newImageForm', page).show();
|
||||
showNewImageForm = true;
|
||||
$('#btnDeleteImage', page).hide();
|
||||
$('#headerUploadNewImage', page).show();
|
||||
$('.connectMessage', page).hide();
|
||||
}
|
||||
|
||||
if (showNewImageForm && AppInfo.supportsFileInput) {
|
||||
$('.newImageForm', page).show();
|
||||
} else {
|
||||
$('.newImageForm', page).hide();
|
||||
}
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
||||
|
@ -115,16 +121,14 @@
|
|||
reader.onabort = onFileReaderAbort;
|
||||
|
||||
// Closure to capture the file information.
|
||||
reader.onload = (function (theFile) {
|
||||
return function (e) {
|
||||
reader.onload = function (e) {
|
||||
|
||||
// Render thumbnail.
|
||||
var html = ['<img style="max-width:500px;max-height:200px;" src="', e.target.result, '" title="', escape(theFile.name), '"/>'].join('');
|
||||
// Render thumbnail.
|
||||
var html = ['<img style="max-width:500px;max-height:200px;" src="', e.target.result, '" title="', escape(file.name), '"/>'].join('');
|
||||
|
||||
$('#userImageOutput', page).html(html);
|
||||
$('#fldUpload', page).show();
|
||||
};
|
||||
})(file);
|
||||
$('#userImageOutput', page).html(html);
|
||||
$('#fldUpload', page).show();
|
||||
};
|
||||
|
||||
// Read in the image file as a data URL.
|
||||
reader.readAsDataURL(file);
|
||||
|
@ -172,11 +176,6 @@
|
|||
|
||||
return false;
|
||||
};
|
||||
|
||||
self.onFileUploadChange = function (fileUpload) {
|
||||
|
||||
setFiles($.mobile.activePage, fileUpload.files);
|
||||
};
|
||||
}
|
||||
|
||||
window.MyProfilePage = new myProfilePage();
|
||||
|
@ -207,6 +206,9 @@
|
|||
|
||||
$('.newImageForm').off('submit', MyProfilePage.onImageSubmit).on('submit', MyProfilePage.onImageSubmit);
|
||||
|
||||
page.querySelector('#uploadUserImage').addEventListener('change', function(e) {
|
||||
setFiles(page, e.target.files);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
@ -240,10 +242,10 @@
|
|||
|
||||
if (user.HasConfiguredEasyPassword) {
|
||||
$('#txtEasyPassword', page).val('').attr('placeholder', '******');
|
||||
$('#btnResetEasyPassword', page).show();
|
||||
$('#btnResetEasyPassword', page).removeClass('hide');
|
||||
} else {
|
||||
$('#txtEasyPassword', page).val('').attr('placeholder', '');
|
||||
$('#btnResetEasyPassword', page).hide();
|
||||
$('#btnResetEasyPassword', page).addClass('hide');
|
||||
}
|
||||
|
||||
page.querySelector('.chkEnableLocalEasyPassword').checked = user.Configuration.EnableLocalPassword;
|
||||
|
|
|
@ -1590,6 +1590,9 @@ var AppInfo = {};
|
|||
|
||||
AppInfo.supportsDownloading = !(AppInfo.isNativeApp && isIOS);
|
||||
|
||||
// This currently isn't working on android, unfortunately
|
||||
AppInfo.supportsFileInput = !(AppInfo.isNativeApp && isAndroid);
|
||||
|
||||
AppInfo.enableUserImage = true;
|
||||
AppInfo.hasPhysicalVolumeButtons = isCordova || isMobile;
|
||||
AppInfo.enableBackButton = isIOS && (window.navigator.standalone || AppInfo.isNativeApp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue