From 7e7ff80468f0634ffdaf4d1c6fda93af3b2c374b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 25 Apr 2016 14:02:33 -0400 Subject: [PATCH 1/3] update selection checkboxes --- dashboard-ui/scripts/librarylist.js | 57 +++++++++++++---------------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/dashboard-ui/scripts/librarylist.js b/dashboard-ui/scripts/librarylist.js index dcf354296e..556af2ec62 100644 --- a/dashboard-ui/scripts/librarylist.js +++ b/dashboard-ui/scripts/librarylist.js @@ -671,7 +671,7 @@ if (itemSelectionPanel) { return onItemSelectionPanelClick(e, itemSelectionPanel); } - if (card.classList.contains('groupedCard')) { + else if (card.classList.contains('groupedCard')) { return onGroupedCardClick(e, card); } } @@ -891,7 +891,6 @@ element.classList.add('hasTapHold'); manager.on('press', onTapHold); - manager.on('pressup', onTapHoldUp); }); showTapHoldHelp(element); @@ -952,23 +951,6 @@ 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) { // toggle the checkbox, if it wasn't clicked on @@ -976,9 +958,14 @@ var chkItemSelect = itemSelectionPanel.querySelector('.chkItemSelect'); if (chkItemSelect) { - var newValue = !chkItemSelect.checked; - chkItemSelect.checked = newValue; - updateItemSelection(chkItemSelect, newValue); + + if (chkItemSelect.classList.contains('checkedInitial')) { + chkItemSelect.classList.remove('checkedInitial'); + } else { + var newValue = !chkItemSelect.checked; + chkItemSelect.checked = newValue; + updateItemSelection(chkItemSelect, newValue); + } } } @@ -991,7 +978,7 @@ updateItemSelection(this, this.checked); } - function showSelection(item) { + function showSelection(item, isChecked) { var itemSelectionPanel = item.querySelector('.itemSelectionPanel'); @@ -1002,12 +989,16 @@ item.querySelector('.cardContent').appendChild(itemSelectionPanel); - var chkItemSelect = document.createElement('paper-checkbox'); - chkItemSelect.classList.add('chkItemSelect'); - - $(chkItemSelect).on('change', onSelectionChange); - - itemSelectionPanel.appendChild(chkItemSelect); + var cssClass = 'chkItemSelect'; + if (isChecked && !browserInfo.firefox) { + // In firefox, the initial tap hold doesnt' get treated as a click + // In other browsers it does, so we need to make sure that initial click is ignored + cssClass += ' checkedInitial'; + } + var checkedAttribute = isChecked ? ' checked' : ''; + itemSelectionPanel.innerHTML = ''; + var chkItemSelect = itemSelectionPanel.querySelector('paper-checkbox'); + chkItemSelect.addEventListener('change', onSelectionChange); } } @@ -1059,7 +1050,10 @@ { transform: 'translate3d(-10px, 0, 0)', offset: 0.9 }, { transform: 'translate3d(0, 0, 0)', offset: 1 }]; var timing = { duration: 900, iterations: iterations }; - return elem.animate(keyframes, timing); + + if (elem.animate) { + elem.animate(keyframes, timing); + } } function showSelections(initialCard) { @@ -1067,11 +1061,10 @@ require(['paper-checkbox'], function () { var cards = document.querySelectorAll('.card'); for (var i = 0, length = cards.length; i < length; i++) { - showSelection(cards[i]); + showSelection(cards[i], initialCard == cards[i]); } showSelectionCommands(); - initialCard.querySelector('.chkItemSelect').checked = true; updateItemSelection(initialCard, true); }); } From 837993927913463265b5500aa345fe66bd4415c4 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 25 Apr 2016 14:32:57 -0400 Subject: [PATCH 2/3] remove log line --- dashboard-ui/scripts/librarybrowser.js | 1 - 1 file changed, 1 deletion(-) diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 9be0e43ff0..ab6081351a 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -2163,7 +2163,6 @@ item['data-' + att.name] = att.value; } } - console.log(item['data-commands']); var defaultAction = options.defaultAction; if (defaultAction == 'play' || defaultAction == 'playallfromhere') { From 0bdb63bcff8fbffb2c44f3206334fd104002c178 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 25 Apr 2016 14:33:17 -0400 Subject: [PATCH 3/3] update lazy images --- .../emby-lazyload-image/lazyload-image.html | 82 +++---------------- .../bower_components/iron-icon/.bower.json | 6 +- .../components/ironcardlist/ironcardlist.js | 2 +- .../ironcardlist/ironcardlist.template.html | 2 +- dashboard-ui/css/librarybrowser.css | 2 +- dashboard-ui/scripts/episodes.js | 5 +- dashboard-ui/scripts/site.js | 10 +-- dashboard-ui/scripts/tvshows.js | 11 ++- 8 files changed, 34 insertions(+), 86 deletions(-) diff --git a/dashboard-ui/bower_components/emby-lazyload-image/lazyload-image.html b/dashboard-ui/bower_components/emby-lazyload-image/lazyload-image.html index 2fedd03977..ed420476b6 100644 --- a/dashboard-ui/bower_components/emby-lazyload-image/lazyload-image.html +++ b/dashboard-ui/bower_components/emby-lazyload-image/lazyload-image.html @@ -1,8 +1,8 @@