diff --git a/MMM-Jast.css b/MMM-Jast.css index 1b2c96a..eff0c58 100644 --- a/MMM-Jast.css +++ b/MMM-Jast.css @@ -1,9 +1,13 @@ @keyframes tickerh { 0% { - transform: translate(0, 0); + -webkit-transform: translateX(0); + transform: translateX(0); + will-change: transform; } 100% { - transform: translate(-100%, 0); + -webkit-transform: translateX(-100%); + transform: translateX(-100%); + will-change: transform; } } .jast-wrapper { diff --git a/MMM-Jast.js b/MMM-Jast.js index ce09cef..961cde0 100644 --- a/MMM-Jast.js +++ b/MMM-Jast.js @@ -1,6 +1,6 @@ /*! ***************************************************************************** mmm-jast - Version 2.9.1 + Version 2.9.2 A minimalistic stock ticker based on Yahoo's finance API for the MagicMirror² platform. Please submit bugs at https://github.com/jalibu/MMM-Jast/issues diff --git a/node_helper.js b/node_helper.js index 227c74f..e0565ab 100644 --- a/node_helper.js +++ b/node_helper.js @@ -1,6 +1,6 @@ /*! ***************************************************************************** mmm-jast - Version 2.9.1 + Version 2.9.2 A minimalistic stock ticker based on Yahoo's finance API for the MagicMirror² platform. Please submit bugs at https://github.com/jalibu/MMM-Jast/issues @@ -11,19 +11,4 @@ This file is auto-generated. Do not edit. ***************************************************************************** */ -"use strict";var e=require("node_helper"),r=require("logger"),t=require("yahoo-finance2");function a(e){return e&&e.__esModule?e:{default:e}}function n(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}var s=n(e),o=n(r),i=a(t); -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -function c(e,r,t,a){return new(t||(t=Promise))((function(n,s){function o(e){try{c(a.next(e))}catch(e){s(e)}}function i(e){try{c(a.throw(e))}catch(e){s(e)}}function c(e){var r;e.done?n(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(o,i)}c((a=a.apply(e,r||[])).next())}))}class u{static requestStocks(e){var r;return c(this,void 0,void 0,(function*(){const t=[],a=[];for(const r of e.stocks)a.push(i.default.quoteSummary(r.symbol,{modules:["price"]}));const n=yield Promise.all(a.map((e=>e.catch((e=>e)))));for(const[a,s]of n.entries())if(s instanceof Error)o.warn(`API request for ${e.stocks[a].symbol} failed:`,s.message);else if(s.price){const n={symbol:e.stocks[a].symbol,name:e.stocks[a].name,quantity:e.stocks[a].quantity,hidden:e.stocks[a].hidden,purchasePrice:e.stocks[a].purchasePrice};if("GBp"===s.price.currency&&(s.price.regularMarketPrice/=100,s.price.regularMarketChange/=100,s.price.currency="GBP"),e.maxChangeAge>0){const t=(new Date).getTime()-e.maxChangeAge;try{t>Date.parse(s.price.regularMarketTime)&&(s.price.regularMarketPreviousClose=null===(r=s.price)||void 0===r?void 0:r.regularMarketPrice,s.price.regularMarketChange=0,s.price.regularMarketChangePercent=0)}catch(e){o.warn("Could not parse lastChange date",e)}}t.push({price:s.price,meta:n})}else o.warn(`Response for ${e.stocks[a].symbol} does not satisfy expected payload.`);return t}))}}const l=["regularMarketChange","regularMarketChangePercent","regularMarketPrice","currency","longName","regularMarketPreviousClose"];module.exports=s.create({start(){o.log(`${this.name} helper method started...`)},socketNotificationReceived(e,r){return c(this,void 0,void 0,(function*(){if(e.includes("JAST_STOCKS_REQUEST")){const t=e.substring(20);let a=yield u.requestStocks(r);a=a.filter((e=>l.every((r=>!!Object.prototype.hasOwnProperty.call(e.price,r)||(o.warn(`Skipped symbol '${e.meta.symbol}' as it's response did not have required property '${r}'. This is usually the case when a symbol is misspelled`),!1)))));const n={lastUpdate:Date.now(),stocks:a};this.sendSocketNotification(`JAST_STOCKS_RESPONSE-${t}`,n)}else o.warn(`${e} is invalid notification`)}))}}); +"use strict";var e=require("node_helper"),r=require("logger"),t=require("yahoo-finance2");function s(e){return e&&e.__esModule?e:{default:e}}function n(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,s.get?s:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}var o=n(e),a=n(r),i=s(t);function c(e,r,t,s){return new(t||(t=Promise))((function(n,o){function a(e){try{c(s.next(e))}catch(e){o(e)}}function i(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var r;e.done?n(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(a,i)}c((s=s.apply(e,r||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class u{static requestStocks(e){var r;return c(this,void 0,void 0,(function*(){const t=[],s=[];for(const r of e.stocks)s.push(i.default.quoteSummary(r.symbol,{modules:["price"]}));const n=yield Promise.all(s.map((e=>e.catch((e=>e)))));for(const[s,o]of n.entries())if(o instanceof Error)a.warn(`API request for ${e.stocks[s].symbol} failed:`,o.message);else if(o.price){const n={symbol:e.stocks[s].symbol,name:e.stocks[s].name,quantity:e.stocks[s].quantity,hidden:e.stocks[s].hidden,purchasePrice:e.stocks[s].purchasePrice};if("GBp"===o.price.currency&&(o.price.regularMarketPrice/=100,o.price.regularMarketChange/=100,o.price.currency="GBP"),e.maxChangeAge>0){const t=(new Date).getTime()-e.maxChangeAge;try{t>Date.parse(o.price.regularMarketTime)&&(o.price.regularMarketPreviousClose=null===(r=o.price)||void 0===r?void 0:r.regularMarketPrice,o.price.regularMarketChange=0,o.price.regularMarketChangePercent=0)}catch(e){a.warn("Could not parse lastChange date",e)}}t.push({price:o.price,meta:n})}else a.warn(`Response for ${e.stocks[s].symbol} does not satisfy expected payload.`);return t}))}}const l=["regularMarketChange","regularMarketChangePercent","regularMarketPrice","currency","longName","regularMarketPreviousClose"];module.exports=o.create({start(){a.log(`${this.name} helper method started...`)},socketNotificationReceived(e,r){return c(this,void 0,void 0,(function*(){if(e.includes("JAST_STOCKS_REQUEST")){const t=e.substring(20);let s=yield u.requestStocks(r);s=s.filter((e=>l.every((r=>!!Object.prototype.hasOwnProperty.call(e.price,r)||(a.warn(`Skipped symbol '${e.meta.symbol}' as it's response did not have required property '${r}'. This is usually the case when a symbol is misspelled`),!1)))));const n={lastUpdate:Date.now(),stocks:s};this.sendSocketNotification(`JAST_STOCKS_RESPONSE-${t}`,n)}else a.warn(`${e} is invalid notification`)}))}}); diff --git a/package.json b/package.json index a79b6d5..252e085 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mmm-jast", - "version": "2.9.1", + "version": "2.9.2", "description": "A minimalistic stock ticker based on Yahoo's finance API for the MagicMirror² platform.", "main": "MMM-Jast.js", "repository": { diff --git a/templates/StockList.njk b/templates/StockList.njk index a95d62a..bd93e27 100755 --- a/templates/StockList.njk +++ b/templates/StockList.njk @@ -2,7 +2,7 @@ {% for stock in stocks %} {% if not stock.meta.hidden or config.showHiddenStocks %}
  • - {{ utils.getStockName(stock) }}: + {{ utils.getStockName(stock) }}: {% if utils.getStockChange(stock) > 0 %} {% set colorClass = "high" %} {% elif utils.getStockChange(stock) < 0 %} @@ -10,8 +10,8 @@ {% else %} {% set colorClass = "" %} {% endif %} - - {{ utils.getCurrentValueAsString(stock, config) }} + + {{ utils.getCurrentValueAsString(stock, config) }} {% if colorClass and (config.showChangeValue or config.showChangePercent) %} ({% if config.showChangeValue %}{% if colorClass == "high" %}+{%endif%}{{ utils.getStockChangeAsString(stock, config) }}{% endif %} @@ -27,7 +27,7 @@ {% else %} {% set colorClassPerformance = "" %} {% endif %} - + {% if colorClassPerformance and (config.showStockPerformanceValue or config.showStockPerformancePercent) %} ( @@ -37,8 +37,7 @@ ) {% endif %} - - +
  • {% endif %} {% endfor %}