From 6790608346722bda0ced3a977ee570e7f4e73e68 Mon Sep 17 00:00:00 2001 From: Git Date: Wed, 10 Apr 2013 08:00:43 +0000 Subject: [PATCH] Empty commit --- static/functions/lastfm.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/static/functions/lastfm.js b/static/functions/lastfm.js index 3a4f24b6..ea7f1dea 100644 --- a/static/functions/lastfm.js +++ b/static/functions/lastfm.js @@ -153,18 +153,23 @@ tasteometerHtml += '
  • Compatibility: '; var compatibility = Math.round(j['score'] * 100); var background; - if (compatibility < 50){ - background = 'rgb(255, '+Math.floor(255*compatibility/50)+', 0)' - } else { - background = 'rgb('+Math.floor((1-(compatibility-50)/50)*255)+', 255, 0)' - } - tasteometerHtml += compatibility + '%\r\ + if (compatibility < 0 || compatibility > 100) { + compatibility = "Unknown"; + tasteometerHtml += compatibility; + } else { + if (compatibility < 50){ + background = 'rgb(255, '+Math.floor(255*compatibility/50)+', 0)' + } else { + background = 'rgb('+Math.floor((1-(compatibility-50)/50)*255)+', 255, 0)' + } + tasteometerHtml += compatibility + '%\r\
  • \r\
    \n\
    \n\
    \r\
    \r\
  • '; + } // Only print shared artists if there are any if (j['artists']['matches'] != 0){ sharedArtistsHtml += '
  • Shared artists: