From 9b6a17e0a049693ee698371368458c1c3eaad70e Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 29 Feb 2016 11:23:30 -0500 Subject: [PATCH] update components --- .../emby-webcomponents/.bower.json | 8 +- .../actionsheet/actionsheet.js | 11 ++ .../emby-webcomponents/scrollhelper.js | 102 ++++++++++++++++++ .../bower_components/iron-icon/.bower.json | 6 +- .../iron-selector/.bower.json | 4 +- dashboard-ui/connectlogin.html | 2 +- dashboard-ui/scripts/connectlogin.js | 2 + dashboard-ui/scripts/site.js | 1 + 8 files changed, 126 insertions(+), 10 deletions(-) create mode 100644 dashboard-ui/bower_components/emby-webcomponents/scrollhelper.js diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json index 93684d3c32..d7ac339cc0 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json +++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json @@ -15,12 +15,12 @@ }, "devDependencies": {}, "ignore": [], - "version": "1.1.6", - "_release": "1.1.6", + "version": "1.1.10", + "_release": "1.1.10", "_resolution": { "type": "version", - "tag": "1.1.6", - "commit": "155d278afe013c0ad06f64616c9b23680cbc545c" + "tag": "1.1.10", + "commit": "80b28a8a69cb1ff8269b1443b7982be7c0c5bc8a" }, "_source": "git://github.com/MediaBrowser/emby-webcomponents.git", "_target": "~1.1.5", diff --git a/dashboard-ui/bower_components/emby-webcomponents/actionsheet/actionsheet.js b/dashboard-ui/bower_components/emby-webcomponents/actionsheet/actionsheet.js index 87d8d58216..5ebf6a4976 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/actionsheet/actionsheet.js +++ b/dashboard-ui/bower_components/emby-webcomponents/actionsheet/actionsheet.js @@ -49,6 +49,13 @@ return pos; } + function addCenterFocus(dlg) { + + require(['scrollHelper'], function (scrollHelper) { + scrollHelper.centerFocus.on(dlg.querySelector('.actionSheetScroller'), false); + }); + } + function show(options) { // items @@ -154,6 +161,10 @@ dlg.style.top = pos.top + 'px'; } + if (layoutManager.tv) { + addCenterFocus(dlg); + } + document.body.appendChild(dlg); // Seeing an issue in some non-chrome browsers where this is requiring a double click diff --git a/dashboard-ui/bower_components/emby-webcomponents/scrollhelper.js b/dashboard-ui/bower_components/emby-webcomponents/scrollhelper.js new file mode 100644 index 0000000000..cc6919c220 --- /dev/null +++ b/dashboard-ui/bower_components/emby-webcomponents/scrollhelper.js @@ -0,0 +1,102 @@ +define(['focusManager'], function (focusManager) { + + function getOffset(elem) { + + var doc = document; + var box = { top: 0, left: 0 }; + + if (!doc) { + return box; + } + + var docElem = doc.documentElement; + + // Support: BlackBerry 5, iOS 3 (original iPhone) + // If we don't have gBCR, just use 0,0 rather than error + if (elem.getBoundingClientRect) { + box = elem.getBoundingClientRect(); + } + var win = doc.defaultView; + return { + top: box.top + win.pageYOffset - docElem.clientTop, + left: box.left + win.pageXOffset - docElem.clientLeft + }; + } + + function getPosition(scrollContainer, item, horizontal) { + var slideeOffset = getOffset(scrollContainer); + var itemOffset = getOffset(item); + + var offset = horizontal ? itemOffset.left - slideeOffset.left : itemOffset.top - slideeOffset.top; + var size = item[horizontal ? 'offsetWidth' : 'offsetHeight']; + + if (horizontal) { + offset += scrollContainer.scrollLeft; + } else { + offset += scrollContainer.scrollTop; + } + + var frameSize = horizontal ? scrollContainer.offsetWidth : scrollContainer.offsetHeight; + + return { + start: offset, + center: (offset - (frameSize / 2) + (size / 2)), + end: offset - frameSize + size, + size: size + }; + } + + function toCenter(container, elem, horizontal) { + var pos = getPosition(container, elem, horizontal); + + if (container.scrollTo) { + if (horizontal) { + container.scrollTo(pos.center, 0); + } else { + container.scrollTo(0, pos.center); + } + } else { + if (horizontal) { + container.scrollLeft = Math.round(pos.center); + } else { + container.scrollTop = Math.round(pos.center); + } + } + } + + function centerOnFocus(e, scrollSlider, horizontal) { + var focused = focusManager.focusableParent(e.target); + + if (focused) { + toCenter(scrollSlider, focused, horizontal); + } + } + + function centerOnFocusHorizontal(e) { + centerOnFocus(e, this, true); + } + function centerOnFocusVertical(e) { + centerOnFocus(e, this, false); + } + + return { + getPosition: getPosition, + centerFocus: { + on: function (element, horizontal) { + if (horizontal) { + element.addEventListener('focus', centerOnFocusHorizontal, true); + } else { + element.addEventListener('focus', centerOnFocusVertical, true); + } + }, + off: function (element, horizontal) { + if (horizontal) { + element.removeEventListener('focus', centerOnFocusHorizontal, true); + } else { + element.removeEventListener('focus', centerOnFocusVertical, true); + } + } + }, + toCenter: toCenter + }; +}); \ No newline at end of file diff --git a/dashboard-ui/bower_components/iron-icon/.bower.json b/dashboard-ui/bower_components/iron-icon/.bower.json index 1dd6bd32f0..75ac273a15 100644 --- a/dashboard-ui/bower_components/iron-icon/.bower.json +++ b/dashboard-ui/bower_components/iron-icon/.bower.json @@ -31,14 +31,14 @@ "web-component-tester": "*", "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, - "homepage": "https://github.com/polymerelements/iron-icon", + "homepage": "https://github.com/PolymerElements/iron-icon", "_release": "1.0.7", "_resolution": { "type": "version", "tag": "v1.0.7", "commit": "6f4d152dc3998a6cc12a5a585a654f893dc99381" }, - "_source": "git://github.com/polymerelements/iron-icon.git", + "_source": "git://github.com/PolymerElements/iron-icon.git", "_target": "^1.0.0", - "_originalSource": "polymerelements/iron-icon" + "_originalSource": "PolymerElements/iron-icon" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/iron-selector/.bower.json b/dashboard-ui/bower_components/iron-selector/.bower.json index 11e925acef..fedc85052e 100644 --- a/dashboard-ui/bower_components/iron-selector/.bower.json +++ b/dashboard-ui/bower_components/iron-selector/.bower.json @@ -36,7 +36,7 @@ "tag": "v1.2.4", "commit": "1ee4e2e11a9e5118320987d93fc2c03ae9a489f4" }, - "_source": "git://github.com/polymerelements/iron-selector.git", + "_source": "git://github.com/PolymerElements/iron-selector.git", "_target": "^1.0.0", - "_originalSource": "polymerelements/iron-selector" + "_originalSource": "PolymerElements/iron-selector" } \ No newline at end of file diff --git a/dashboard-ui/connectlogin.html b/dashboard-ui/connectlogin.html index b937cb3882..b6a364c07b 100644 --- a/dashboard-ui/connectlogin.html +++ b/dashboard-ui/connectlogin.html @@ -43,7 +43,7 @@
-


Try the new Emby Theater at tv.emby.media, a remote-friendly app designed for your TV or large screen monitor.
+


Try the new Emby Theater at tv.emby.media, a remote-friendly app designed for your TV or large screen monitor.