From 67bc4c227e3b431885fe51f30191fa2d6bd8f973 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 24 Apr 2016 19:27:47 -0400 Subject: [PATCH] update lazy loading --- dashboard-ui/components/ironcardlist.js | 37 ------------------- .../components/ironcardlist/ironcardlist.js | 32 ++++++++++++++++ .../ironcardlist/ironcardlist.template.html | 18 +++++++++ .../components/servertestermessage.js | 2 +- dashboard-ui/scripts/site.js | 2 +- 5 files changed, 52 insertions(+), 39 deletions(-) delete mode 100644 dashboard-ui/components/ironcardlist.js create mode 100644 dashboard-ui/components/ironcardlist/ironcardlist.js create mode 100644 dashboard-ui/components/ironcardlist/ironcardlist.template.html diff --git a/dashboard-ui/components/ironcardlist.js b/dashboard-ui/components/ironcardlist.js deleted file mode 100644 index dab3e594b6..0000000000 --- a/dashboard-ui/components/ironcardlist.js +++ /dev/null @@ -1,37 +0,0 @@ -define(['layoutManager', 'iron-list', 'lazyload-image'], function (layoutManager) { - - function getTemplate(scrollTarget) { - - var html = ''; - - var maxPhysical = 80; - - // is="lazyload-image" - - html += ''; - - return Promise.resolve(html); - } - - return { - getTemplate: getTemplate - }; - -}); \ No newline at end of file diff --git a/dashboard-ui/components/ironcardlist/ironcardlist.js b/dashboard-ui/components/ironcardlist/ironcardlist.js new file mode 100644 index 0000000000..84486662f3 --- /dev/null +++ b/dashboard-ui/components/ironcardlist/ironcardlist.js @@ -0,0 +1,32 @@ +define(['iron-list', 'lazyload-image'], function () { + + function getTemplate(scrollTarget) { + + var maxPhysical = 80; + + // is="lazyload-image" + + return new Promise(function (resolve, reject) { + + var xhr = new XMLHttpRequest(); + xhr.open('GET', 'components/ironcardlist/ironcardlist.template.html', true); + + xhr.onload = function (e) { + + var html = this.response; + + html = html.replace('${maxphysical}', maxPhysical); + html = html.replace('${scrolltarget}', scrollTarget); + + resolve(html); + } + + xhr.send(); + }); + } + + return { + getTemplate: getTemplate + }; + +}); \ No newline at end of file diff --git a/dashboard-ui/components/ironcardlist/ironcardlist.template.html b/dashboard-ui/components/ironcardlist/ironcardlist.template.html new file mode 100644 index 0000000000..46edb0cf16 --- /dev/null +++ b/dashboard-ui/components/ironcardlist/ironcardlist.template.html @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/dashboard-ui/components/servertestermessage.js b/dashboard-ui/components/servertestermessage.js index d38cc61615..e99f9cb137 100644 --- a/dashboard-ui/components/servertestermessage.js +++ b/dashboard-ui/components/servertestermessage.js @@ -1,4 +1,4 @@ -define(['appSettings'], function (appSettings) { +define(['appSettings', 'paper-button'], function (appSettings) { function getReleases() { diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index 1c6040ccce..dd1ff4ad2a 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -1606,7 +1606,7 @@ var AppInfo = {}; var paths = { velocity: bowerPath + "/velocity/velocity.min", tvguide: 'components/tvguide/tvguide', - ironCardList: 'components/ironcardlist', + ironCardList: 'components/ironcardlist/ironcardlist', scrollThreshold: 'components/scrollthreshold', directorybrowser: 'components/directorybrowser/directorybrowser', collectioneditor: 'components/collectioneditor/collectioneditor',