From f00fc6ad15629484b3f7f8e857eed4b48762c1dd Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 16 May 2016 11:47:28 -0400 Subject: [PATCH] update viewcontainer-lite.js --- dashboard-ui/components/viewcontainer-lite.js | 33 +++++---------- dashboard-ui/devices/android/android.css | 4 +- dashboard-ui/scripts/site.js | 42 +------------------ 3 files changed, 13 insertions(+), 66 deletions(-) diff --git a/dashboard-ui/components/viewcontainer-lite.js b/dashboard-ui/components/viewcontainer-lite.js index dd70c1d2cb..e051efc3af 100644 --- a/dashboard-ui/components/viewcontainer-lite.js +++ b/dashboard-ui/components/viewcontainer-lite.js @@ -1,6 +1,7 @@ define(['browser'], function (browser) { var allPages = document.querySelectorAll('.mainAnimatedPage'); + var currentUrls = []; var pageContainerCount = allPages.length; var animationDuration = 500; var allowAnimation = true; @@ -98,6 +99,7 @@ define(['browser'], function (browser) { animate(animatable, previousAnimatable, options.transition, options.isBack).then(function () { selectedPageIndex = pageIndex; + currentUrls[pageIndex] = options.url; if (!options.cancel && previousAnimatable) { afterAnimate(allPages, pageIndex); } @@ -147,7 +149,7 @@ define(['browser'], function (browser) { function normalizeNewView(options) { if (options.view.indexOf('data-role="page"') == -1) { - var html = '
'; + var html = '
'; html += options.view; html += '
'; return html; @@ -158,7 +160,7 @@ define(['browser'], function (browser) { var elem = parseHtml(options.view, hasScript); elem.classList.add('page-view'); elem.setAttribute('data-type', options.type || ''); - elem.setAttribute('data-url', options.url); + return { elem: elem, hasScript: hasScript @@ -321,21 +323,13 @@ define(['browser'], function (browser) { function tryRestoreView(options) { var url = options.url; - var view = document.querySelector(".page-view[data-url='" + url + "']"); - var page = parentWithClass(view, 'mainAnimatedPage'); + var index = currentUrls.indexOf(url); - if (view) { + if (index != -1) { + var page = allPages[index]; + var view = page.querySelector(".page-view"); - var index = -1; - var pages = allPages; - for (var i = 0, length = pages.length; i < length; i++) { - if (pages[i] == page) { - index = i; - break; - } - } - - if (index != -1) { + if (view) { if (options.cancel) { return; @@ -377,14 +371,7 @@ define(['browser'], function (browser) { function reset() { - var views = document.querySelectorAll(".mainAnimatedPage.hide .page-view"); - - for (var i = 0, length = views.length; i < length; i++) { - - var view = views[i]; - triggerDestroy(view); - view.parentNode.removeChild(view); - } + currentUrls = []; } function parentWithClass(elem, className) { diff --git a/dashboard-ui/devices/android/android.css b/dashboard-ui/devices/android/android.css index e10e5c746a..39324cfaa4 100644 --- a/dashboard-ui/devices/android/android.css +++ b/dashboard-ui/devices/android/android.css @@ -10,9 +10,9 @@ font-weight: bold !important; } -/*.libraryViewNav { +.libraryViewNav { box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.2); -}*/ +} @media all and (min-width: 300px) { diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index 17bbe19a05..a0eebdad3f 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -1166,7 +1166,7 @@ var Dashboard = { // The native app can handle a little bit more than safari if (AppInfo.isNativeApp) { - quality -= 10; + quality -= 5; } else { @@ -1183,11 +1183,6 @@ var Dashboard = { options.enableImageEnhancers = false; } - - if (AppInfo.forcedImageFormat && options.type != 'Logo') { - options.format = AppInfo.forcedImageFormat; - options.backgroundColor = '#1c1c1c'; - } }, loadExternalPlayer: function () { @@ -1472,8 +1467,6 @@ var AppInfo = {}; AppInfo.enableDetailPageChapters = false; AppInfo.enableDetailsMenuImages = false; AppInfo.enableMovieHomeSuggestions = false; - - AppInfo.forcedImageFormat = 'jpg'; } } @@ -1642,39 +1635,6 @@ var AppInfo = {}; }); } - function initFastClick() { - - require(["fastclick"], function (FastClick) { - - FastClick.attach(document.body, { - tapDelay: 0 - }); - - function parentWithClass(elem, className) { - - while (!elem.classList || !elem.classList.contains(className)) { - elem = elem.parentNode; - - if (!elem) { - return null; - } - } - - return elem; - } - - // Have to work around this issue of fast click breaking the panel dismiss - document.body.addEventListener('touchstart', function (e) { - - var tgt = parentWithClass(e.target, 'ui-panel-dismiss'); - if (tgt) { - $(tgt).click(); - } - }); - }); - - } - function setDocumentClasses(browser) { var elem = document.documentElement;