From beec6c0ff187eaaca7ce68d0055f79f596023db4 Mon Sep 17 00:00:00 2001 From: Vibha Sinha Date: Fri, 7 Apr 2017 22:09:58 -0700 Subject: [PATCH 1/4] #508 --- public/css/style.css | 7 +++++++ public/data/review.txt | 1 + public/data/tweets.txt | 12 ++++++++++++ public/js/demo.js | 21 ++++++++++++--------- views/index.ejs | 21 ++++++++++++--------- 5 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 public/data/review.txt create mode 100644 public/data/tweets.txt diff --git a/public/css/style.css b/public/css/style.css index 44808643..85f49961 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -2530,3 +2530,10 @@ pre[class^="language-"] > code[class^="language-"], pre[class^="language-"] > co float: left; margin-left: 0; margin-right: 1.69492%; } } + +.dim { + opacity: 0.4; + filter: alpha(opacity=40); /* msie */ +} + +.show { } diff --git a/public/data/review.txt b/public/data/review.txt new file mode 100644 index 00000000..c451367e --- /dev/null +++ b/public/data/review.txt @@ -0,0 +1 @@ +I was asked to sign a third party contract a week out from stay. If it wasn't an 8 person group that took a lot of wrangling I would have cancelled the booking straight away. Bathrooms - there are no stand alone bathrooms. Please consider this - you have to clear out the main bedroom to use that bathroom. Other option is you walk through a different bedroom to get to its en-suite. Signs all over the apartment - there are signs everywhere - some helpful - some telling you rules. Perhaps some people like this but It negatively affected our enjoyment of the accommodation. Stairs - lots of them - some had slightly bending wood which caused a minor injury. diff --git a/public/data/tweets.txt b/public/data/tweets.txt new file mode 100644 index 00000000..deebb72c --- /dev/null +++ b/public/data/tweets.txt @@ -0,0 +1,12 @@ +I hate these new features On #ThisPhone after the update +I hate #ThisPhoneCompany products, you'd have to torture me to get me to use #ThisPhone +The emojis in #ThisPhone are stupid +#ThisPhone is the worst phone I've ever had - ever +#ThisPhone is a useless, stupid waste of money +#ThisPhone stop cheating customers, lost all respect SHAME on u +I'm worried my #ThisPhone is going to overheat like my brother's did +#ThisPhoneCompany really let me down... my new phone won't even turn on +Loving the colors in my #ThisPhone pictures +Honestly I just love the look of the new #ThisPhone +Excellent #ThisPhone app delivers on nearly all fronts, with excellent audio, gapless playback, collaborative playlists, and features for runners. + diff --git a/public/js/demo.js b/public/js/demo.js index 42e5e9b6..3f86fd24 100755 --- a/public/js/demo.js +++ b/public/js/demo.js @@ -40,13 +40,13 @@ function ready() { // load all json data first $.when( $.ajax('/data/threshold_v0.1.1.json'), - $.ajax('/data/customer-call.txt'), - $.ajax('/data/corporate-announcement.txt'), + $.ajax('/data/tweets.txt'), + $.ajax('/data/review.txt'), $.ajax('/data/personal-email.txt')) - .done(function(thresholds, customerCall, corporateAnnouncement, personalEmail) { + .done(function(thresholds, tweets, review, personalEmail) { var sampleText = { - 'customer-call': customerCall[0], - 'corporate-announcement': corporateAnnouncement[0], + 'review': review[0], + 'tweets': tweets[0], 'email': personalEmail[0], 'own-text': '' }; @@ -141,6 +141,7 @@ function allReady(thresholds, sampleText) { score: app.percentagify(item.score, 'Emotion Tone'), tooltip: app.toneHash()[item.tone_name].tooltip, likeliness: v1 > v3 ? 'VERY LIKELY' : v1 > v2 ? 'LIKELY' : 'UNLIKELY', + visible: v1 > v3 ? 'show' : v1 > v2 ? 'show' : 'dim', thresholdLow: app.percentagify(app.thresholds().doc[item.tone_name][0]), thresholdHigh: app.percentagify(app.thresholds().doc[item.tone_name][1]) }; @@ -159,6 +160,7 @@ function allReady(thresholds, sampleText) { label: item.tone_name, score: app.percentagify(item.score, 'Language Tone'), tooltip: app.toneHash()[item.tone_name].tooltip, + visible: v1 > v3 ? 'show' : v1 > v2 ? 'show' : 'dim', likeliness: v1 > v3 ? 'VERY LIKELY' : v1 > v2 ? 'LIKELY' : 'UNLIKELY' }; } @@ -176,7 +178,8 @@ function allReady(thresholds, sampleText) { label: item.tone_name, score: app.percentagify(item.score, 'Social Tone'), tooltip: app.toneHash()[item.tone_name].tooltip, - likeliness: v1 > v3 ? 'VERY LIKELY' : v1 > v2 ? 'LIKELY' : 'UNLIKELY' + likeliness: v1 > v3 ? 'VERY LIKELY' : v1 > v2 ? 'LIKELY' : 'UNLIKELY', + visible: v1 > v3 ? 'show' : v1 > v2 ? 'show' : 'dim' }; } @@ -359,12 +362,12 @@ function allReady(thresholds, sampleText) { $emotionGraph.html(_.template(emotionBarGraph_template, { items: emotionTone, className: 'emotion' - })); + })); $writingGraph.html(_.template(barGraph_template, { items: writingTone, className: 'writing' - })); + })); $socialGraph.html(_.template(barGraph_template, { items: socialTone, @@ -453,7 +456,7 @@ function allReady(thresholds, sampleText) { $output.hide(); $error.hide(); scrollTo($input); - $('#input-customer-call').trigger('click'); + $('#input-tweets').trigger('click'); } /** diff --git a/views/index.ejs b/views/index.ejs index d31f9211..ba3617f8 100755 --- a/views/index.ejs +++ b/views/index.ejs @@ -89,12 +89,12 @@

Sample use cases

Choose an example to learn how you can adjust the tone of your content to change people's perceptions, or improve its effectiveness. Learn more.

- - + + + + - -
@@ -145,6 +145,7 @@
+
- - +-->
@@ -207,12 +206,14 @@ +
@@ -259,6 +260,7 @@
+