diff --git a/MMM-RottenTomatoes.js b/MMM-RottenTomatoes.js index 0700564..53d91e9 100644 --- a/MMM-RottenTomatoes.js +++ b/MMM-RottenTomatoes.js @@ -25,6 +25,7 @@ Module.register("MMM-RottenTomatoes", { limitComingSoon: 3, boxOfficeAfter: true, mergeOpeningAndComingSoon: true, + showTomatoImages: true, }, // the start function start: function() { @@ -103,7 +104,7 @@ Module.register("MMM-RottenTomatoes", { return wrapper; } var titleSize = 'xsmall'; - var movieSize = 'xsmall'; + var movieSize = 'small'; var wrapper = document.createElement("table"); // do opening this week var allOTWandCSRows = [ ]; @@ -122,8 +123,22 @@ Module.register("MMM-RottenTomatoes", { (cIndex < otwData.length) && (cIndex < this.config.limitOpeningThisWeek); cIndex++) { var cOTW = otwData[cIndex]; - var otwRowTR = document.createElement("tr"); + var otwRowTR = document.createElement("tr"); + + // This section shows the either rotten or fresh rating based on percentage otwRowTR.className = movieSize; + if (this.config.showTomatoImages == true) { + var otwRowTomato = document.createElement("td"); + var otwmoviepercent = parseFloat(this.cleanScore(cOTW.meter)) / 100.0; + if(otwmoviepercent < .75) + { + otwRowTomato.innerHTML = '' + "  "; + }else if (otwmoviepercent >= .75) { + otwRowTomato.innerHTML = '' + "  "; + } + otwRowTR.appendChild(otwRowTomato); + } + var otwRowMeter = document.createElement("td"); otwRowMeter.innerHTML = this.cleanScore(cOTW.meter) + "  "; otwRowTR.appendChild(otwRowMeter); @@ -154,6 +169,20 @@ Module.register("MMM-RottenTomatoes", { var ccs = csData[cIndex]; var csRowTR = document.createElement("tr"); csRowTR.className = movieSize; + + // This section shows the either rotten or fresh rating based on percentage + if (this.config.showTomatoImages == true) { + var csRowTomato = document.createElement("td"); + var moviepercent = parseFloat(this.cleanScore(ccs.meter)) / 100.0; + if(moviepercent < .60) + { + csRowTomato.innerHTML = '' + "  "; + }else if (moviepercent >= .60) { + csRowTomato.innerHTML = '' + "  "; + } + csRowTR.appendChild(csRowTomato); + } + var csRowMeter = document.createElement("td"); csRowMeter.innerHTML = this.cleanScore(ccs.meter) + "  "; csRowTR.appendChild(csRowMeter); diff --git a/README.md b/README.md index 58747ec..59e70c7 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,14 @@ The following properties can be configured:
Default value: true
This value is OPTIONAL + + + showTomatoImages + Boolean value, Whether or not to display rotten tomatoes fresh/rotten images next to the percentages.
+
Example: false +
Default value: true +
This value is OPTIONAL + diff --git a/icons/fresh-16.png b/icons/fresh-16.png new file mode 100644 index 0000000..da35bf9 Binary files /dev/null and b/icons/fresh-16.png differ diff --git a/icons/splat-16.png b/icons/splat-16.png new file mode 100644 index 0000000..0595d49 Binary files /dev/null and b/icons/splat-16.png differ