├── .gitignore ├── README.md ├── app ├── auth.js ├── logger.js ├── mysqlquery.js ├── recommend.js └── tone.js ├── backup.sql ├── config.json ├── create_db.sql ├── data ├── data.json ├── fifth.txt ├── first.txt ├── fourth.txt ├── second.txt ├── seventh.txt ├── sixth.txt └── third.txt ├── favicon.ico ├── index.js ├── package.json ├── public ├── animate.css ├── css │ ├── materialize.css │ └── materialize.min.css ├── favicon.ico ├── fonts │ └── roboto │ │ ├── Roboto-Bold.eot │ │ ├── Roboto-Bold.ttf │ │ ├── Roboto-Bold.woff │ │ ├── Roboto-Bold.woff2 │ │ ├── Roboto-Light.eot │ │ ├── Roboto-Light.ttf │ │ ├── Roboto-Light.woff │ │ ├── Roboto-Light.woff2 │ │ ├── Roboto-Medium.eot │ │ ├── Roboto-Medium.ttf │ │ ├── Roboto-Medium.woff │ │ ├── Roboto-Medium.woff2 │ │ ├── Roboto-Regular.eot │ │ ├── Roboto-Regular.ttf │ │ ├── Roboto-Regular.woff │ │ ├── Roboto-Regular.woff2 │ │ ├── Roboto-Thin.eot │ │ ├── Roboto-Thin.ttf │ │ ├── Roboto-Thin.woff │ │ └── Roboto-Thin.woff2 ├── homescreen.png ├── index-cloud.css ├── index.css ├── index.html.orig ├── index.js ├── js │ ├── materialize.js │ └── materialize.min.js ├── logo.png ├── main.html ├── mic.js ├── result.css ├── result.html └── result.js ├── response.json ├── server.js ├── test.js └── watson-cred-2.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MoodMonk : Your Emotion Partner 2 | MoodMonk is your daily journal which analyses your mood from your speech and displays appropriate analytics, along with plots of your stress levels. 3 | 4 | ![Screenshot: Home Screen](https://raw.githubusercontent.com/himanshub16/moodmonk/master/public/homescreen.png) 5 | 6 | ## Demo 7 | * [English Version](https://drive.google.com/file/d/0B0Q8qfGisPMeOGtzMVdzVDloaDA/view?usp=sharing) 8 | * [Hindi Version](https://drive.google.com/open?id=0B0Q8qfGisPMeZTZQc2tGYjVUUFk) 9 | 10 | ## [Presentation Pitch](https://drive.google.com/open?id=0B0Q8qfGisPMeZERUYTMxaWRLSkk) 11 | 12 | ### Pre-requisites 13 | * Ubuntu 16.04+ 14 | * nodejs/npm [Find out to install](https://nodejs.org/en/download/package-manager/). 15 | * mysql [How to install](https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-16-04). 16 | 17 | ### Usage 18 | * Update the config.json file and fill required configuration. 19 | * Install dependencies. `npm install`(inside project directory). 20 | * Start using by `node server.js`. 21 | 22 | ``` 23 | npm install 24 | nodejs server.js 25 | or 26 | node server.js 27 | ``` 28 | -------------------------------------------------------------------------------- /app/auth.js: -------------------------------------------------------------------------------- 1 | var config = require(__dirname+"/../config.json"); 2 | 3 | var mysql = require('mysql'); 4 | var conn = mysql.createConnection({ 5 | host: config.mysqlHost, 6 | database: 'moodmonk', 7 | user: config.mysqlUser, 8 | password: config.mysqlPassword 9 | }); 10 | 11 | function login(userId, password, callback) { 12 | conn.query( 13 | "select * from `User` where `userid` = ? and `password` = ?", 14 | [ userId, password ], 15 | function(err, res, fields) { 16 | if (err) throw err; 17 | if (res.length === 0) callback(false); 18 | if (res.length === 1) callback(true); 19 | } 20 | ); 21 | } 22 | 23 | function signup(userid, password, callback) { 24 | conn.query( 25 | "insert into `User` SET ?", 26 | { "userid": userid, "password": password }, 27 | function(err, res, fields) { 28 | if (err !== null) { 29 | if (err.code === "ER_DUP_ENTRY") callback(false); 30 | } 31 | else callback(true); 32 | } 33 | ); 34 | } 35 | 36 | module.exports = { login, signup }; -------------------------------------------------------------------------------- /app/logger.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | // const anondataFile = '../data/anonymous.json'; 3 | // const dataFileName = '../data/data.json'; 4 | const dataFileName = __dirname+"/../data/data.json"; 5 | 6 | var data = require(dataFileName); 7 | var db = require("./mysqlquery"); 8 | var fs = require("fs"); 9 | 10 | function getDateKey() { 11 | let today = new Date(); 12 | let dd = today.getDate(); 13 | let mm = today.getMonth()+1; //January is 0! 14 | let yyyy = today.getFullYear(); 15 | return mm+'-'+dd+'-'+yyyy; 16 | } 17 | 18 | // function log(json) { 19 | // let key = getDateKey(); 20 | // if (!data.hasOwnProperty(key)) { 21 | // data[key] = json; 22 | // console.log(data); 23 | // fs.writeFile(dataFileName, JSON.stringify(data), "utf8", () => { 24 | // console.log("data updated"); 25 | // }); 26 | // } else { 27 | // incrementDay(key, json); 28 | // } 29 | // } 30 | 31 | function log(userid, json) { 32 | db.updateDB(userid, json); 33 | } 34 | 35 | // function incrementDay(key, json) { 36 | // /* assumed that this function is invoked only when 37 | // an object for same day exist 38 | // */ 39 | // let toneCategories = json.document_tone.tone_categories; 40 | // // console.log(JSON.stringify(data)); 41 | // for (let i = 0; i < toneCategories.length; i++) { 42 | // for (let j = 0; j < toneCategories[i].tones.length; j++) { 43 | // data[key].document_tone.tone_categories[i].tones[j].score += 44 | // json.document_tone.tone_categories[i].tones[j].score; 45 | // } 46 | // } 47 | // // console.log(JSON.stringify(data)); 48 | // fs.writeFile(dataFileName, JSON.stringify(data), "utf8", () => { 49 | // console.log('data updated by incrementing'); 50 | // }); 51 | // } 52 | 53 | function dominantEmotion(json){ 54 | let max = 0.0; 55 | let dominant_emotion = ''; 56 | let emotions =json["document_tone"]["tone_categories"][0]["tones"]; 57 | for (let emotion in emotions){ 58 | if (emotions[emotion].score > max){ 59 | max = emotions[emotion].score; 60 | dominant_emotion = emotions[emotion].tone_id; 61 | } 62 | } 63 | return dominant_emotion; 64 | } 65 | 66 | function getDataByDate(userid, date, callback) { 67 | db.retrieveData(userid, date, function(json) { 68 | let retvalue = { 69 | "emotion_tone": { 70 | "anger": json.emotion_tone.tones[0].score, 71 | "disgust": json.emotion_tone.tones[1].score, 72 | "fear": json.emotion_tone.tones[2].score, 73 | "sadness": json.emotion_tone.tones[3].score, 74 | "joy": json.emotion_tone.tones[4].score 75 | }, 76 | "language_tone": { 77 | "analytical": json.language_tone.tones[0].score, 78 | "confident": json.language_tone.tones[1].score, 79 | "tentative": json.language_tone.tones[2].score 80 | }, 81 | "social_tone": { 82 | "openness": json.social_tone.tones[0].score, 83 | "conscientiousness": json.social_tone.tones[1].score, 84 | "extraversion": json.social_tone.tones[2].score, 85 | "agreableness": json.social_tone.tones[3].score, 86 | "emotional_range": json.social_tone.tones[4].score 87 | } 88 | }; 89 | callback(retvalue); 90 | }); 91 | } 92 | 93 | Date.prototype.addDays = function(days) { 94 | var dat = new Date(this.valueOf()); 95 | dat.setDate(dat.getDate() + days); 96 | return dat; 97 | }; 98 | 99 | function getDates(startDate, stopDate) { 100 | let dateArray = new Array(); 101 | let currentDate = startDate; 102 | while (currentDate <= stopDate) { 103 | dateArray.push(currentDate); 104 | currentDate = currentDate.addDays(1); 105 | } 106 | return dateArray; 107 | } 108 | 109 | function getDataBetweenDates(userid, from, to, callback) { 110 | let currentJson = null; 111 | 112 | let responseJson = {}; 113 | let dateArray = getDates(new Date(from), new Date(to)); 114 | let completed = dateArray.length; 115 | let dateKeys = []; 116 | for (let i = 0; i < dateArray.length; i++) 117 | dateKeys.push(dateArray[i].getMonth()+1+'-'+dateArray[i].getDate()+'-'+dateArray[i].getFullYear()); 118 | 119 | for (let i = 0; i < dateKeys.length; i++) { 120 | getDataByDate(userid, dateKeys[i], function(currentJson) { 121 | let myI = i; 122 | responseJson[dateKeys[myI]] = currentJson; 123 | completed--; 124 | }); 125 | } 126 | let self_id = setInterval(function() { 127 | if (completed == 0) { 128 | // console.log("getDateBetweenDates: sending ", responseJson); 129 | callback(responseJson); 130 | clearInterval(self_id); 131 | } 132 | }, 100); 133 | return responseJson; 134 | } 135 | 136 | 137 | function analyzer(data){ 138 | let emotions = ['anger', 'disgust', 'fear', 'sadness', 'joy']; 139 | for (let i in data){ 140 | } 141 | } 142 | 143 | var logger = { 144 | 'analyzer': analyzer, 145 | 'dominantEmotion': dominantEmotion, 146 | 'log': log, 147 | 'getByDate': getDataByDate, 148 | 'getBetweenDates': getDataBetweenDates 149 | }; 150 | 151 | module.exports = { logger }; 152 | -------------------------------------------------------------------------------- /app/mysqlquery.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var defaultJson = require(__dirname+'/../response.json'); 3 | 4 | var config = require(__dirname+"/../config.json"); 5 | 6 | var mysql = require('mysql'); 7 | var connection = mysql.createConnection({ 8 | host: config.mysqlHost, 9 | user: config.mysqlUser, 10 | password: config.mysqlPassword, 11 | database: 'moodmonk' 12 | }); 13 | 14 | connection.connect(function (err) { 15 | if (err) { 16 | console.error('error connecting: ' + err.stack); 17 | return; 18 | } 19 | 20 | console.log('connected as id ' + connection.threadId); 21 | }); 22 | 23 | var emotionTemplate = { 24 | "tones": [ 25 | { 26 | "score": 0.00, 27 | "tone_id": "anger", 28 | "tone_name": "Anger" 29 | }, 30 | { 31 | "score": 0.00, 32 | "tone_id": "disgust", 33 | "tone_name": "Disgust" 34 | }, 35 | { 36 | "score": 0.00, 37 | "tone_id": "fear", 38 | "tone_name": "Fear" 39 | }, 40 | { 41 | "score": 0.00, 42 | "tone_id": "joy", 43 | "tone_name": "Joy" 44 | }, 45 | { 46 | "score": 0.00, 47 | "tone_id": "sadness", 48 | "tone_name": "Sadness" 49 | } 50 | ], 51 | "category_id": "emotion_tone", 52 | "category_name": "Emotion Tone" 53 | }; 54 | 55 | var languageTemplate = { 56 | "tones": [ 57 | { 58 | "score": 0.00, 59 | "tone_id": "analytical", 60 | "tone_name": "Analytical" 61 | }, 62 | { 63 | "score": 0.00, 64 | "tone_id": "confident", 65 | "tone_name": "Confident" 66 | }, 67 | { 68 | "score": 0.00, 69 | "tone_id": "tentative", 70 | "tone_name": "Tentative" 71 | } 72 | ], 73 | "category_id": "language_tone", 74 | "category_name": "Language Tone" 75 | }; 76 | 77 | var socialTemplate = { 78 | "tones": [ 79 | { 80 | "score": 0.00, 81 | "tone_id": "openness_big5", 82 | "tone_name": "Openness" 83 | }, 84 | { 85 | "score": 0.00, 86 | "tone_id": "conscientiousness_big5", 87 | "tone_name": "Conscientiousness" 88 | }, 89 | { 90 | "score": 0.00, 91 | "tone_id": "extraversion_big5", 92 | "tone_name": "Extraversion" 93 | }, 94 | { 95 | "score": 0.00, 96 | "tone_id": "agreeableness_big5", 97 | "tone_name": "Agreeableness" 98 | }, 99 | { 100 | "score": 0.00, 101 | "tone_id": "emotional_range_big5", 102 | "tone_name": "Emotional Range" 103 | } 104 | ], 105 | "category_id": "social_tone", 106 | "category_name": "Social Tone" 107 | }; 108 | 109 | function clone(obj) { 110 | var copy; 111 | 112 | // Handle the 3 simple types, and null or undefined 113 | if (null == obj || "object" != typeof obj) return obj; 114 | 115 | // Handle Date 116 | if (obj instanceof Date) { 117 | copy = new Date(); 118 | copy.setTime(obj.getTime()); 119 | return copy; 120 | } 121 | 122 | // Handle Array 123 | if (obj instanceof Array) { 124 | copy = []; 125 | for (var i = 0, len = obj.length; i < len; i++) { 126 | copy[i] = clone(obj[i]); 127 | } 128 | return copy; 129 | } 130 | 131 | // Handle Object 132 | if (obj instanceof Object) { 133 | copy = {}; 134 | for (var attr in obj) { 135 | if (obj.hasOwnProperty(attr)) copy[attr] = clone(obj[attr]); 136 | } 137 | return copy; 138 | } 139 | 140 | throw new Error("Unable to copy obj! Its type isn't supported."); 141 | } 142 | 143 | function setEmotionTone(jsonobject, callback) { 144 | connection.query('INSERT INTO emotion_tone SET ?', jsonobject ,function (err, rows, fields) { 145 | if (err) { 146 | console.log("setEmotionTone : ", err); 147 | callback(false); 148 | } 149 | console.log('Inserted in EmotionTone Table'); 150 | callback(true); 151 | }); 152 | }; 153 | 154 | function setLanguageTone(jsonobject, callback) { 155 | connection.query('INSERT INTO language_tone SET ?', jsonobject ,function (err, rows, fields) { 156 | if (err) { 157 | console.log("setLanguageTone : ", err); 158 | callback(false); 159 | } 160 | console.log('Inserted in LanguageTone Table'); 161 | callback(true); 162 | }); 163 | }; 164 | 165 | function setSocialTone(jsonobject, callback) { 166 | connection.query('INSERT INTO social_tone SET ?', jsonobject ,function (err, rows, fields) { 167 | if (err) { 168 | console.log("setSocialTone : ", err); 169 | callback(false); 170 | } 171 | console.log('Inserted in SocialTone Table'); 172 | callback(true); 173 | }); 174 | }; 175 | 176 | 177 | function getEmotionTone(Userid, Date, callback) { 178 | connection.query('SELECT * FROM emotion_tone WHERE userid = ? AND date = ?', [ Userid, Date] ,function (err, rows, fields) { 179 | if (err) 180 | callback(defaultJson.document_tone.tone_categories[0]); 181 | let x = clone(emotionTemplate); 182 | for (let i = 0; i < rows.length; i++) { 183 | x.tones[0].score += rows[i].anger; 184 | x.tones[1].score += rows[i].disgust; 185 | x.tones[2].score += rows[i].fear; 186 | x.tones[3].score += rows[i].joy; 187 | x.tones[4].score += rows[i].sadness; 188 | } 189 | // console.log(x); 190 | console.log("getEmotionTone : sending emotion tone"); 191 | callback(x); 192 | }); 193 | }; 194 | 195 | function getLanguageTone(Userid, Date, callback) { 196 | connection.query('SELECT * FROM language_tone WHERE userid = ? AND date = ?', [ Userid, Date] ,function (err, rows, fields) { 197 | if (err) 198 | callback(defaultJson.document_tone.tone_categories[0]); 199 | let x = clone(languageTemplate); 200 | for (let i = 0; i < rows.length; i++) { 201 | x.tones[0].score += rows[i].analytical; 202 | x.tones[1].score += rows[i].confident; 203 | x.tones[2].score += rows[i].tentative; 204 | } 205 | // console.log(x); 206 | console.log("getLanguageTone : sending language tone"); 207 | callback(x); 208 | }); 209 | }; 210 | 211 | function getSocialTone(Userid, Date, callback) { 212 | connection.query('SELECT * FROM social_tone WHERE userid = ? AND date = ?', [ Userid, Date] ,function (err, rows, fields) { 213 | if (err) 214 | callback(defaultJson.document_tone.tone_categories[0]); 215 | let x = clone(socialTemplate); 216 | for (let i = 0; i < rows.length; i++) { 217 | x.tones[0].score += rows[i].openness_big5; 218 | x.tones[1].score += rows[i].conscientiousness_big5; 219 | x.tones[2].score += rows[i].extraversion_big5; 220 | x.tones[3].score += rows[i].agreeableness_big5; 221 | x.tones[4].score += rows[i].emotional_range_big5; 222 | } 223 | // console.log(x); 224 | console.log("getSocialTone : sending Social tone"); 225 | callback(x); 226 | }); 227 | }; 228 | 229 | function stopApp() { 230 | connection.end(); 231 | } 232 | 233 | function updateDB(userid, json) { 234 | let emotion_obj = null, lang_obj = null, social_obj = null; 235 | 236 | emotion_obj = {}; 237 | emotion_obj.userid = userid; 238 | emotion_obj.date = new Date().toISOString().slice(0, 10).replace('T', ' '); 239 | emotion_obj.anger = json.document_tone.tone_categories[0].tones[0].score; 240 | emotion_obj.disgust = json.document_tone.tone_categories[0].tones[1].score; 241 | emotion_obj.fear = json.document_tone.tone_categories[0].tones[2].score; 242 | emotion_obj.joy = json.document_tone.tone_categories[0].tones[3].score; 243 | emotion_obj.sadness = json.document_tone.tone_categories[0].tones[4].score; 244 | 245 | lang_obj = {}; 246 | lang_obj.userid = userid; 247 | lang_obj.date = new Date().toISOString().slice(0, 10).replace('T', ' '); 248 | lang_obj.analytical = json.document_tone.tone_categories[1].tones[0].score; 249 | lang_obj.confident = json.document_tone.tone_categories[1].tones[1].score; 250 | lang_obj.tentative = json.document_tone.tone_categories[1].tones[2].score; 251 | 252 | social_obj = {}; 253 | social_obj.userid = userid; 254 | social_obj.date = new Date().toISOString().slice(0, 10).replace('T', ' '); 255 | social_obj.openness_big5 = json.document_tone.tone_categories[2].tones[0].score; 256 | social_obj.conscientiousness_big5 = json.document_tone.tone_categories[2].tones[1].score; 257 | social_obj.extraversion_big5 = json.document_tone.tone_categories[2].tones[2].score; 258 | social_obj.agreeableness_big5 = json.document_tone.tone_categories[2].tones[3].score; 259 | social_obj.emotional_range_big5 = json.document_tone.tone_categories[2].tones[4].score; 260 | 261 | setEmotionTone(emotion_obj, (status) => { 262 | console.log("Emotion tone set : " + status); 263 | }); 264 | 265 | setLanguageTone(lang_obj, (status) => { 266 | console.log("Language tone set : " + status); 267 | }); 268 | 269 | setSocialTone(social_obj, (status) => { 270 | console.log("Social Tone set : " + status); 271 | }); 272 | } 273 | 274 | function retrieveData(userid, date, callback) { 275 | let pending = 3; 276 | let toneData = { 277 | emotion_tone: null, 278 | social_tone: null, 279 | language_tone: null 280 | }; 281 | 282 | // fixing date format 283 | let tmpDate = new Date(date); 284 | date = tmpDate.getFullYear() + '-' + (tmpDate.getMonth()+1) + '-' + tmpDate.getDate(); 285 | console.log("retrieveData : ", userid, date); 286 | 287 | getSocialTone(userid, date, function(retData) { 288 | console.log("received social tone"); 289 | toneData.social_tone = retData; 290 | pending -= 1; 291 | }); 292 | getLanguageTone(userid, date, function(retData) { 293 | console.log("received language tone"); 294 | toneData.language_tone = retData; 295 | pending -= 1; 296 | }); 297 | getEmotionTone(userid, date, function(retData) { 298 | console.log("received emotion tone"); 299 | toneData.emotion_tone = retData; 300 | pending -= 1; 301 | }); 302 | 303 | let self_id = setInterval(function() { 304 | if (pending == 0) { 305 | console.log('sending tonedata'); 306 | callback(toneData); 307 | clearInterval(self_id); 308 | } 309 | }, 500); 310 | } 311 | 312 | module.exports = { 313 | updateDB, 314 | retrieveData, 315 | stopApp, 316 | getEmotionTone, 317 | getLanguageTone, 318 | getSocialTone 319 | }; 320 | 321 | // module.exports = { 322 | // getEmotionTone, 323 | // getLanguageTone, 324 | // getSocialTone, 325 | // setEmotionTone, 326 | // setLanguageTone, 327 | // setSocialTone, 328 | // stopApp 329 | // }; 330 | -------------------------------------------------------------------------------- /app/recommend.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var request = require('request'); 3 | var http_proxy = require(__dirname+"/../config.json").http_proxy; 4 | var youtube_auth = require(__dirname+"/../config.json").youtube_auth; 5 | var r = request.defaults({ 'proxy': http_proxy }); 6 | 7 | var google = require('googleapis'); 8 | google.options({ proxy: http_proxy }); 9 | 10 | var youtube = google.youtube({ version: 'v3', auth: youtube_auth }); 11 | 12 | function getQuotes(emotion, callback) { 13 | //retrieving quotes 14 | let feel = ''; 15 | if (emotion == "anger") { feel = "love"; } 16 | else if (emotion == "disgust") { feel = "art"; } 17 | else if (emotion == "fear") { feel = "management"; } 18 | else if (emotion == "joy") { feel = "life"; } 19 | else if (emotion == "sadness") { feel = "funny"; } 20 | console.log('getting quotes'); 21 | r('http://quotes.rest/qod.json?category=' + feel, function (error, response, body) { 22 | let json = JSON.parse(body); 23 | let quote = json.contents.quotes[0].quote; // quote 24 | callback(quote); 25 | }); 26 | } 27 | 28 | function getVideo(emotion, callback) { 29 | //retrieving videos 30 | console.log('getting videos'); 31 | let feel = ''; 32 | if (emotion == "anger") { feel = "love"; } 33 | else if (emotion == "disgust") { feel = "art"; } 34 | else if (emotion == "fear") { feel = "management"; } 35 | else if (emotion == "joy") { feel = "life"; } 36 | else if (emotion == "sadness") { feel = "funny"; } 37 | var results = youtube.search.list({ part: 'id,snippet', q: feel, maxResults: 25 }); 38 | let x = results.url.href; 39 | request({ url: x, json: true, proxy: http_proxy }, function (err, localres, json) { 40 | if (err) { 41 | throw err; 42 | } 43 | let vid = "https://www.youtube.com/watch?v=" + json.items[0].id.videoId; 44 | callback(vid); 45 | }); 46 | } 47 | 48 | function getActivities(emotion, callback) { 49 | //retrieving activities 50 | console.log('getting activities'); 51 | let act = '', feel = ''; 52 | if (emotion == "anger") { feel = "love"; } 53 | else if (emotion == "disgust") { feel = "art"; } 54 | else if (emotion == "fear") { feel = "management"; } 55 | else if (emotion == "joy") { feel = "life"; } 56 | else if (emotion == "sadness") { feel = "funny"; } 57 | switch (emotion) { 58 | case 'anger': 59 | act = "Go for a jog"; 60 | break; 61 | case 'disgust': 62 | act = "Paint a picture"; 63 | break; 64 | case 'fear': 65 | act = "Meditate"; 66 | break; 67 | case 'joy': 68 | act = "Serve the needy"; 69 | break; 70 | case 'sadness': 71 | act = "Dance Dance Dance"; 72 | break; 73 | default: 74 | act = "asdsad"; 75 | } 76 | callback(act); 77 | } 78 | 79 | function test(expr, callback) { 80 | console.log('got ' + expr); 81 | callback(expr); 82 | } 83 | 84 | module.exports = { getVideo, getActivities, getQuotes, test, http_proxy }; 85 | -------------------------------------------------------------------------------- /app/tone.js: -------------------------------------------------------------------------------- 1 | var request = require('request'); 2 | var http_proxy = require(__dirname+'/../config.json').http_proxy; 3 | var watson_username = require(__dirname+'/../config.json').watson_username; 4 | var watson_password = require(__dirname+'/../config.json').watson_password; 5 | var r = request.defaults({'proxy': http_proxy}); 6 | 7 | var headers = { 8 | 'Content-Type': 'application/json' 9 | }; 10 | 11 | var dataString = '{"text": "A word is dead when it is said, some say. Emily Dickinson"}'; 12 | 13 | var options = { 14 | url: 'https://gateway.watsonplatform.net/tone-analyzer/api/v3/tone?version=2016-05-19', 15 | method: 'POST', 16 | headers: headers, 17 | body: dataString, 18 | auth: { 19 | "username": watson_username, 20 | "pass": watson_password 21 | } 22 | }; 23 | 24 | var tone = function(text, mycallback) { 25 | options.body = '{"text": "' + text + '"}'; 26 | r(options, function(error, response, body) { 27 | if (!error && response.statusCode == 200) { 28 | console.log('requests successful'); 29 | mycallback(JSON.parse(response.toJSON().body)); 30 | } else { 31 | console.log('response failed'); 32 | } 33 | }); 34 | }; 35 | 36 | 37 | module.exports = { tone }; 38 | -------------------------------------------------------------------------------- /backup.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 5.7.17, for Linux (x86_64) 2 | -- 3 | -- Host: localhost Database: moodmonk 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.17-0ubuntu1 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!40101 SET NAMES utf8 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `User` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `User`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!40101 SET character_set_client = utf8 */; 25 | CREATE TABLE `User` ( 26 | `userid` varchar(255) NOT NULL, 27 | `password` varchar(255) NOT NULL, 28 | PRIMARY KEY (`userid`) 29 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 30 | /*!40101 SET character_set_client = @saved_cs_client */; 31 | 32 | -- 33 | -- Dumping data for table `User` 34 | -- 35 | 36 | LOCK TABLES `User` WRITE; 37 | /*!40000 ALTER TABLE `User` DISABLE KEYS */; 38 | INSERT INTO `User` VALUES ('lama','password'),('monk','password'); 39 | /*!40000 ALTER TABLE `User` ENABLE KEYS */; 40 | UNLOCK TABLES; 41 | 42 | -- 43 | -- Table structure for table `emotion_tone` 44 | -- 45 | 46 | DROP TABLE IF EXISTS `emotion_tone`; 47 | /*!40101 SET @saved_cs_client = @@character_set_client */; 48 | /*!40101 SET character_set_client = utf8 */; 49 | CREATE TABLE `emotion_tone` ( 50 | `index` int(11) NOT NULL AUTO_INCREMENT, 51 | `userid` varchar(255) NOT NULL, 52 | `date` date NOT NULL, 53 | `anger` decimal(11,10) NOT NULL, 54 | `disgust` decimal(11,10) NOT NULL, 55 | `fear` decimal(11,10) NOT NULL, 56 | `joy` decimal(11,10) NOT NULL, 57 | `sadness` decimal(11,10) NOT NULL, 58 | PRIMARY KEY (`index`,`userid`,`date`) 59 | ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1; 60 | /*!40101 SET character_set_client = @saved_cs_client */; 61 | 62 | -- 63 | -- Dumping data for table `emotion_tone` 64 | -- 65 | 66 | LOCK TABLES `emotion_tone` WRITE; 67 | /*!40000 ALTER TABLE `emotion_tone` DISABLE KEYS */; 68 | INSERT INTO `emotion_tone` VALUES (1,'lama','2017-04-24',0.2054830000,0.6206680000,0.1868390000,0.0016190000,0.1889730000),(2,'lama','2017-04-25',0.1732560000,0.1935580000,0.5020340000,0.1306860000,0.4830350000),(3,'lama','2017-04-26',0.1715420000,0.0831640000,0.1779460000,0.5025510000,0.2750720000),(4,'lama','2017-04-23',0.1928390000,0.3322470000,0.1074930000,0.0408040000,0.4385650000),(5,'lama','2017-04-22',0.2447430000,0.1115430000,0.0744220000,0.0554590000,0.5755500000),(6,'lama','2017-04-21',0.1000400000,0.6467210000,0.6260630000,0.5795900000,0.1911860000),(7,'lama','2017-04-20',0.0120150000,0.0045120000,0.0666930000,0.6039750000,0.1531160000); 69 | /*!40000 ALTER TABLE `emotion_tone` ENABLE KEYS */; 70 | UNLOCK TABLES; 71 | 72 | -- 73 | -- Table structure for table `language_tone` 74 | -- 75 | 76 | DROP TABLE IF EXISTS `language_tone`; 77 | /*!40101 SET @saved_cs_client = @@character_set_client */; 78 | /*!40101 SET character_set_client = utf8 */; 79 | CREATE TABLE `language_tone` ( 80 | `index` int(11) NOT NULL AUTO_INCREMENT, 81 | `userid` varchar(255) NOT NULL, 82 | `date` date NOT NULL, 83 | `analytical` decimal(11,10) NOT NULL, 84 | `confident` decimal(11,10) NOT NULL, 85 | `tentative` decimal(11,10) NOT NULL, 86 | PRIMARY KEY (`index`,`userid`,`date`) 87 | ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1; 88 | /*!40101 SET character_set_client = @saved_cs_client */; 89 | 90 | -- 91 | -- Dumping data for table `language_tone` 92 | -- 93 | 94 | LOCK TABLES `language_tone` WRITE; 95 | /*!40000 ALTER TABLE `language_tone` DISABLE KEYS */; 96 | INSERT INTO `language_tone` VALUES (1,'lama','2017-04-24',0.0000000000,0.6633000000,0.0000000000),(2,'lama','2017-04-25',0.4941710000,0.0000000000,0.9682440000),(3,'lama','2017-04-26',0.6938150000,0.5001920000,0.0000000000),(4,'lama','2017-04-23',0.0000000000,0.0000000000,0.1822820000),(5,'lama','2017-04-22',0.8626210000,0.7958080000,0.0000000000),(6,'lama','2017-04-21',0.7097360000,0.0000000000,0.9223210000),(7,'lama','2017-04-20',0.4819080000,0.0000000000,0.6239540000); 97 | /*!40000 ALTER TABLE `language_tone` ENABLE KEYS */; 98 | UNLOCK TABLES; 99 | 100 | -- 101 | -- Table structure for table `social_tone` 102 | -- 103 | 104 | DROP TABLE IF EXISTS `social_tone`; 105 | /*!40101 SET @saved_cs_client = @@character_set_client */; 106 | /*!40101 SET character_set_client = utf8 */; 107 | CREATE TABLE `social_tone` ( 108 | `index` int(11) NOT NULL AUTO_INCREMENT, 109 | `userid` varchar(255) NOT NULL, 110 | `date` date NOT NULL, 111 | `openness_big5` decimal(11,10) NOT NULL, 112 | `conscientiousness_big5` decimal(11,10) NOT NULL, 113 | `extraversion_big5` decimal(11,10) NOT NULL, 114 | `agreeableness_big5` decimal(11,10) NOT NULL, 115 | `emotional_range_big5` decimal(11,10) NOT NULL, 116 | PRIMARY KEY (`index`,`userid`,`date`) 117 | ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1; 118 | /*!40101 SET character_set_client = @saved_cs_client */; 119 | 120 | -- 121 | -- Dumping data for table `social_tone` 122 | -- 123 | 124 | LOCK TABLES `social_tone` WRITE; 125 | /*!40000 ALTER TABLE `social_tone` DISABLE KEYS */; 126 | INSERT INTO `social_tone` VALUES (1,'lama','2017-04-24',0.6031710000,0.0824390000,0.4223100000,0.1593820000,0.1340450000),(2,'lama','2017-04-25',0.9049060000,0.4270040000,0.3798720000,0.2129700000,0.4231630000),(3,'lama','2017-04-26',0.3327770000,0.6506710000,0.5036150000,0.8642130000,0.4617350000),(4,'lama','2017-04-23',0.7561010000,0.7847790000,0.5989890000,0.5971540000,0.6497750000),(5,'lama','2017-04-22',0.0974950000,0.7224310000,0.2475080000,0.4335360000,0.7135700000),(6,'lama','2017-04-21',0.6966720000,0.6405930000,0.3801120000,0.5012590000,0.3117410000),(7,'lama','2017-04-20',0.5604660000,0.5265110000,0.7853100000,0.9863530000,0.3305150000); 127 | /*!40000 ALTER TABLE `social_tone` ENABLE KEYS */; 128 | UNLOCK TABLES; 129 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 130 | 131 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 132 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 133 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 134 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 135 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 136 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 137 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 138 | 139 | -- Dump completed on 2017-04-26 19:54:53 140 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "mysqlHost": "localhost", 3 | "mysqlUser": "root", 4 | "mysqlPassword": "password", 5 | "http_proxy": "http://172.31.1.4:8080/", 6 | "watson_username": "61cfe4bf-f799-479c-b2a2-54e7085cadfd", 7 | "watson_password": "LmGeondUno35", 8 | "youtube_auth" : "AIzaSyAoN1RLSoqgf7ujPK-2cfT8pz4qQR1_tvg" 9 | } -------------------------------------------------------------------------------- /create_db.sql: -------------------------------------------------------------------------------- 1 | use moodmonk; 2 | 3 | drop table if exists User; 4 | create table User ( 5 | `userid` varchar(255) not null, 6 | `password` varchar(255) not null, 7 | primary key (`userid`) 8 | ); 9 | 10 | drop table if exists emotion_tone; 11 | create table emotion_tone ( 12 | `index` int auto_increment, 13 | `userid` varchar(255) not null, 14 | `date` date not null, 15 | `anger` decimal(11, 10) not null, 16 | `disgust` decimal(11, 10) not null, 17 | `fear` decimal(11, 10) not null, 18 | `joy` decimal(11, 10) not null, 19 | `sadness` decimal(11, 10) not null, 20 | primary key (`index`, `userid`, `date`) 21 | ); 22 | 23 | drop table if exists language_tone; 24 | create table language_tone ( 25 | `index` int auto_increment, 26 | `userid` varchar(255) not null, 27 | `date` date not null, 28 | `analytical` decimal(11, 10) not null, 29 | `confident` decimal(11, 10) not null, 30 | `tentative` decimal(11, 10) not null, 31 | primary key (`index`, `userid`, `date`) 32 | ); 33 | 34 | drop table if exists social_tone; 35 | create table social_tone ( 36 | `index` int auto_increment, 37 | `userid` varchar(255) not null, 38 | `date` date not null, 39 | `openness_big5` decimal(11, 10) not null, 40 | `conscientiousness_big5` decimal(11, 10) not null, 41 | `extraversion_big5` decimal(11, 10) not null, 42 | `agreeableness_big5` decimal(11, 10) not null, 43 | `emotional_range_big5` decimal(11, 10) not null, 44 | primary key (`index`, `userid`, `date`) 45 | ); 46 | -------------------------------------------------------------------------------- /data/data.json: -------------------------------------------------------------------------------- 1 | {"3-18-2017":{"document_tone":{"tone_categories":[{"tones":[{"score":0.012015,"tone_id":"anger","tone_name":"Anger"},{"score":0.004512,"tone_id":"disgust","tone_name":"Disgust"},{"score":0.066693,"tone_id":"fear","tone_name":"Fear"},{"score":0.603975,"tone_id":"joy","tone_name":"Joy"},{"score":0.153116,"tone_id":"sadness","tone_name":"Sadness"}],"category_id":"emotion_tone","category_name":"Emotion Tone"},{"tones":[{"score":0.481908,"tone_id":"analytical","tone_name":"Analytical"},{"score":0,"tone_id":"confident","tone_name":"Confident"},{"score":0.623954,"tone_id":"tentative","tone_name":"Tentative"}],"category_id":"language_tone","category_name":"Language Tone"},{"tones":[{"score":0.560466,"tone_id":"openness_big5","tone_name":"Openness"},{"score":0.526511,"tone_id":"conscientiousness_big5","tone_name":"Conscientiousness"},{"score":0.78531,"tone_id":"extraversion_big5","tone_name":"Extraversion"},{"score":0.986353,"tone_id":"agreeableness_big5","tone_name":"Agreeableness"},{"score":0.330515,"tone_id":"emotional_range_big5","tone_name":"Emotional Range"}],"category_id":"social_tone","category_name":"Social Tone"}]}},"3-19-2017":{"document_tone":{"tone_categories":[{"tones":[{"score":0.10004,"tone_id":"anger","tone_name":"Anger"},{"score":0.646721,"tone_id":"disgust","tone_name":"Disgust"},{"score":0.626063,"tone_id":"fear","tone_name":"Fear"},{"score":0.57959,"tone_id":"joy","tone_name":"Joy"},{"score":0.191186,"tone_id":"sadness","tone_name":"Sadness"}],"category_id":"emotion_tone","category_name":"Emotion Tone"},{"tones":[{"score":0.709736,"tone_id":"analytical","tone_name":"Analytical"},{"score":0,"tone_id":"confident","tone_name":"Confident"},{"score":0.922321,"tone_id":"tentative","tone_name":"Tentative"}],"category_id":"language_tone","category_name":"Language Tone"},{"tones":[{"score":0.696672,"tone_id":"openness_big5","tone_name":"Openness"},{"score":0.640593,"tone_id":"conscientiousness_big5","tone_name":"Conscientiousness"},{"score":0.380112,"tone_id":"extraversion_big5","tone_name":"Extraversion"},{"score":0.501259,"tone_id":"agreeableness_big5","tone_name":"Agreeableness"},{"score":0.311741,"tone_id":"emotional_range_big5","tone_name":"Emotional Range"}],"category_id":"social_tone","category_name":"Social Tone"}]}},"3-20-2017":{"document_tone":{"tone_categories":[{"tones":[{"score":0.244743,"tone_id":"anger","tone_name":"Anger"},{"score":0.111543,"tone_id":"disgust","tone_name":"Disgust"},{"score":0.074422,"tone_id":"fear","tone_name":"Fear"},{"score":0.055459,"tone_id":"joy","tone_name":"Joy"},{"score":0.57555,"tone_id":"sadness","tone_name":"Sadness"}],"category_id":"emotion_tone","category_name":"Emotion Tone"},{"tones":[{"score":0.862621,"tone_id":"analytical","tone_name":"Analytical"},{"score":0.795808,"tone_id":"confident","tone_name":"Confident"},{"score":0,"tone_id":"tentative","tone_name":"Tentative"}],"category_id":"language_tone","category_name":"Language Tone"},{"tones":[{"score":0.097495,"tone_id":"openness_big5","tone_name":"Openness"},{"score":0.722431,"tone_id":"conscientiousness_big5","tone_name":"Conscientiousness"},{"score":0.247508,"tone_id":"extraversion_big5","tone_name":"Extraversion"},{"score":0.433536,"tone_id":"agreeableness_big5","tone_name":"Agreeableness"},{"score":0.71357,"tone_id":"emotional_range_big5","tone_name":"Emotional Range"}],"category_id":"social_tone","category_name":"Social Tone"}]}},"3-21-2017":{"document_tone":{"tone_categories":[{"tones":[{"score":0.192839,"tone_id":"anger","tone_name":"Anger"},{"score":0.332247,"tone_id":"disgust","tone_name":"Disgust"},{"score":0.107493,"tone_id":"fear","tone_name":"Fear"},{"score":0.040804,"tone_id":"joy","tone_name":"Joy"},{"score":0.438565,"tone_id":"sadness","tone_name":"Sadness"}],"category_id":"emotion_tone","category_name":"Emotion Tone"},{"tones":[{"score":0,"tone_id":"analytical","tone_name":"Analytical"},{"score":0,"tone_id":"confident","tone_name":"Confident"},{"score":0.182282,"tone_id":"tentative","tone_name":"Tentative"}],"category_id":"language_tone","category_name":"Language Tone"},{"tones":[{"score":0.756101,"tone_id":"openness_big5","tone_name":"Openness"},{"score":0.784779,"tone_id":"conscientiousness_big5","tone_name":"Conscientiousness"},{"score":0.598989,"tone_id":"extraversion_big5","tone_name":"Extraversion"},{"score":0.597154,"tone_id":"agreeableness_big5","tone_name":"Agreeableness"},{"score":0.649775,"tone_id":"emotional_range_big5","tone_name":"Emotional Range"}],"category_id":"social_tone","category_name":"Social Tone"}]}},"3-22-2017":{"document_tone":{"tone_categories":[{"tones":[{"score":0.205483,"tone_id":"anger","tone_name":"Anger"},{"score":0.620668,"tone_id":"disgust","tone_name":"Disgust"},{"score":0.186839,"tone_id":"fear","tone_name":"Fear"},{"score":0.001619,"tone_id":"joy","tone_name":"Joy"},{"score":0.188973,"tone_id":"sadness","tone_name":"Sadness"}],"category_id":"emotion_tone","category_name":"Emotion Tone"},{"tones":[{"score":0,"tone_id":"analytical","tone_name":"Analytical"},{"score":0.6633,"tone_id":"confident","tone_name":"Confident"},{"score":0,"tone_id":"tentative","tone_name":"Tentative"}],"category_id":"language_tone","category_name":"Language Tone"},{"tones":[{"score":0.603171,"tone_id":"openness_big5","tone_name":"Openness"},{"score":0.082439,"tone_id":"conscientiousness_big5","tone_name":"Conscientiousness"},{"score":0.42231,"tone_id":"extraversion_big5","tone_name":"Extraversion"},{"score":0.159382,"tone_id":"agreeableness_big5","tone_name":"Agreeableness"},{"score":0.134045,"tone_id":"emotional_range_big5","tone_name":"Emotional Range"}],"category_id":"social_tone","category_name":"Social Tone"}]}},"3-23-2017":{"document_tone":{"tone_categories":[{"tones":[{"score":0.173256,"tone_id":"anger","tone_name":"Anger"},{"score":0.193558,"tone_id":"disgust","tone_name":"Disgust"},{"score":0.502034,"tone_id":"fear","tone_name":"Fear"},{"score":0.130686,"tone_id":"joy","tone_name":"Joy"},{"score":0.483035,"tone_id":"sadness","tone_name":"Sadness"}],"category_id":"emotion_tone","category_name":"Emotion Tone"},{"tones":[{"score":0.494171,"tone_id":"analytical","tone_name":"Analytical"},{"score":0,"tone_id":"confident","tone_name":"Confident"},{"score":0.968244,"tone_id":"tentative","tone_name":"Tentative"}],"category_id":"language_tone","category_name":"Language Tone"},{"tones":[{"score":0.904906,"tone_id":"openness_big5","tone_name":"Openness"},{"score":0.427004,"tone_id":"conscientiousness_big5","tone_name":"Conscientiousness"},{"score":0.379872,"tone_id":"extraversion_big5","tone_name":"Extraversion"},{"score":0.21297,"tone_id":"agreeableness_big5","tone_name":"Agreeableness"},{"score":0.423163,"tone_id":"emotional_range_big5","tone_name":"Emotional Range"}],"category_id":"social_tone","category_name":"Social Tone"}]}},"3-24-2017":{"document_tone":{"tone_categories":[{"tones":[{"score":0.171542,"tone_id":"anger","tone_name":"Anger"},{"score":0.083164,"tone_id":"disgust","tone_name":"Disgust"},{"score":0.177946,"tone_id":"fear","tone_name":"Fear"},{"score":0.502551,"tone_id":"joy","tone_name":"Joy"},{"score":0.275072,"tone_id":"sadness","tone_name":"Sadness"}],"category_id":"emotion_tone","category_name":"Emotion Tone"},{"tones":[{"score":0.693815,"tone_id":"analytical","tone_name":"Analytical"},{"score":0.500192,"tone_id":"confident","tone_name":"Confident"},{"score":0,"tone_id":"tentative","tone_name":"Tentative"}],"category_id":"language_tone","category_name":"Language Tone"},{"tones":[{"score":0.332777,"tone_id":"openness_big5","tone_name":"Openness"},{"score":0.650671,"tone_id":"conscientiousness_big5","tone_name":"Conscientiousness"},{"score":0.503615,"tone_id":"extraversion_big5","tone_name":"Extraversion"},{"score":0.864213,"tone_id":"agreeableness_big5","tone_name":"Agreeableness"},{"score":0.461735,"tone_id":"emotional_range_big5","tone_name":"Emotional Range"}],"category_id":"social_tone","category_name":"Social Tone"}]}},"3-25-2017":{"document_tone":{"tone_categories":[{"tones":[{"score":2.047291,"tone_id":"anger","tone_name":"Anger"},{"score":1.029664,"tone_id":"disgust","tone_name":"Disgust"},{"score":1.0748199999999999,"tone_id":"fear","tone_name":"Fear"},{"score":0.814794,"tone_id":"joy","tone_name":"Joy"},{"score":2.1864000000000003,"tone_id":"sadness","tone_name":"Sadness"}],"category_id":"emotion_tone","category_name":"Emotion Tone"},{"tones":[{"score":0.620279,"tone_id":"analytical","tone_name":"Analytical"},{"score":0,"tone_id":"confident","tone_name":"Confident"},{"score":0.88939,"tone_id":"tentative","tone_name":"Tentative"}],"category_id":"language_tone","category_name":"Language Tone"},{"tones":[{"score":2.39195,"tone_id":"openness_big5","tone_name":"Openness"},{"score":2.5871420000000005,"tone_id":"conscientiousness_big5","tone_name":"Conscientiousness"},{"score":3.794085,"tone_id":"extraversion_big5","tone_name":"Extraversion"},{"score":4.463244,"tone_id":"agreeableness_big5","tone_name":"Agreeableness"},{"score":2.717406,"tone_id":"emotional_range_big5","tone_name":"Emotional Range"}],"category_id":"social_tone","category_name":"Social Tone"}]}}} -------------------------------------------------------------------------------- /data/fifth.txt: -------------------------------------------------------------------------------- 1 | Our many Jewish friends and acquaintances are being taken away in droves. The Gestapo is treating them very roughly and transporting them in cattle cars to Westerbork, the big camp in Drenthe to which they're sending all the Jews....If it's that bad in Holland, what must it be like in those faraway and uncivilized places where the Germans are sending them? We assume that most of them are being murdered. The English radio says they're being gassed. 2 | 3 | { 4 | "document_tone": { 5 | "tone_categories": [ 6 | { 7 | "tones": [ 8 | { 9 | "score": 0.205483, 10 | "tone_id": "anger", 11 | "tone_name": "Anger" 12 | }, 13 | { 14 | "score": 0.620668, 15 | "tone_id": "disgust", 16 | "tone_name": "Disgust" 17 | }, 18 | { 19 | "score": 0.186839, 20 | "tone_id": "fear", 21 | "tone_name": "Fear" 22 | }, 23 | { 24 | "score": 0.001619, 25 | "tone_id": "joy", 26 | "tone_name": "Joy" 27 | }, 28 | { 29 | "score": 0.188973, 30 | "tone_id": "sadness", 31 | "tone_name": "Sadness" 32 | } 33 | ], 34 | "category_id": "emotion_tone", 35 | "category_name": "Emotion Tone" 36 | }, 37 | { 38 | "tones": [ 39 | { 40 | "score": 0, 41 | "tone_id": "analytical", 42 | "tone_name": "Analytical" 43 | }, 44 | { 45 | "score": 0.6633, 46 | "tone_id": "confident", 47 | "tone_name": "Confident" 48 | }, 49 | { 50 | "score": 0, 51 | "tone_id": "tentative", 52 | "tone_name": "Tentative" 53 | } 54 | ], 55 | "category_id": "language_tone", 56 | "category_name": "Language Tone" 57 | }, 58 | { 59 | "tones": [ 60 | { 61 | "score": 0.603171, 62 | "tone_id": "openness_big5", 63 | "tone_name": "Openness" 64 | }, 65 | { 66 | "score": 0.082439, 67 | "tone_id": "conscientiousness_big5", 68 | "tone_name": "Conscientiousness" 69 | }, 70 | { 71 | "score": 0.42231, 72 | "tone_id": "extraversion_big5", 73 | "tone_name": "Extraversion" 74 | }, 75 | { 76 | "score": 0.159382, 77 | "tone_id": "agreeableness_big5", 78 | "tone_name": "Agreeableness" 79 | }, 80 | { 81 | "score": 0.134045, 82 | "tone_id": "emotional_range_big5", 83 | "tone_name": "Emotional Range" 84 | } 85 | ], 86 | "category_id": "social_tone", 87 | "category_name": "Social Tone" 88 | } 89 | ] 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /data/first.txt: -------------------------------------------------------------------------------- 1 | Today, I had an enjoyable day. My work went fine. I also met great people, who were very friendly and helping. They had a great sense of marketing skills. I talked to one of them who was compelling, and made me realise the true need of marketing to make great products. 2 | 3 | { 4 | "document_tone": { 5 | "tone_categories": [ 6 | { 7 | "tones": [ 8 | { 9 | "score": 0.012015, 10 | "tone_id": "anger", 11 | "tone_name": "Anger" 12 | }, 13 | { 14 | "score": 0.004512, 15 | "tone_id": "disgust", 16 | "tone_name": "Disgust" 17 | }, 18 | { 19 | "score": 0.066693, 20 | "tone_id": "fear", 21 | "tone_name": "Fear" 22 | }, 23 | { 24 | "score": 0.603975, 25 | "tone_id": "joy", 26 | "tone_name": "Joy" 27 | }, 28 | { 29 | "score": 0.153116, 30 | "tone_id": "sadness", 31 | "tone_name": "Sadness" 32 | } 33 | ], 34 | "category_id": "emotion_tone", 35 | "category_name": "Emotion Tone" 36 | }, 37 | { 38 | "tones": [ 39 | { 40 | "score": 0.481908, 41 | "tone_id": "analytical", 42 | "tone_name": "Analytical" 43 | }, 44 | { 45 | "score": 0, 46 | "tone_id": "confident", 47 | "tone_name": "Confident" 48 | }, 49 | { 50 | "score": 0.623954, 51 | "tone_id": "tentative", 52 | "tone_name": "Tentative" 53 | } 54 | ], 55 | "category_id": "language_tone", 56 | "category_name": "Language Tone" 57 | }, 58 | { 59 | "tones": [ 60 | { 61 | "score": 0.560466, 62 | "tone_id": "openness_big5", 63 | "tone_name": "Openness" 64 | }, 65 | { 66 | "score": 0.526511, 67 | "tone_id": "conscientiousness_big5", 68 | "tone_name": "Conscientiousness" 69 | }, 70 | { 71 | "score": 0.78531, 72 | "tone_id": "extraversion_big5", 73 | "tone_name": "Extraversion" 74 | }, 75 | { 76 | "score": 0.986353, 77 | "tone_id": "agreeableness_big5", 78 | "tone_name": "Agreeableness" 79 | }, 80 | { 81 | "score": 0.330515, 82 | "tone_id": "emotional_range_big5", 83 | "tone_name": "Emotional Range" 84 | } 85 | ], 86 | "category_id": "social_tone", 87 | "category_name": "Social Tone" 88 | } 89 | ] 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /data/fourth.txt: -------------------------------------------------------------------------------- 1 | The process of getting an American visa, strenuous at the best of times, is likely to get more painstaking following fresh directives from the Trump administration to its consular officials worldwide to identify ''populations warranting increased scrutiny'' for enhanced vetting. In a series of four cables sent out by Secretary of State, Rex Tillerson, US missions across the world have been instructed to convene working groups of law enforcement and intelligence officials to ''develop a list of criteria'' to identify such groups. 2 | 3 | { 4 | "document_tone": { 5 | "tone_categories": [ 6 | { 7 | "tones": [ 8 | { 9 | "score": 0.192839, 10 | "tone_id": "anger", 11 | "tone_name": "Anger" 12 | }, 13 | { 14 | "score": 0.332247, 15 | "tone_id": "disgust", 16 | "tone_name": "Disgust" 17 | }, 18 | { 19 | "score": 0.107493, 20 | "tone_id": "fear", 21 | "tone_name": "Fear" 22 | }, 23 | { 24 | "score": 0.040804, 25 | "tone_id": "joy", 26 | "tone_name": "Joy" 27 | }, 28 | { 29 | "score": 0.438565, 30 | "tone_id": "sadness", 31 | "tone_name": "Sadness" 32 | } 33 | ], 34 | "category_id": "emotion_tone", 35 | "category_name": "Emotion Tone" 36 | }, 37 | { 38 | "tones": [ 39 | { 40 | "score": 0, 41 | "tone_id": "analytical", 42 | "tone_name": "Analytical" 43 | }, 44 | { 45 | "score": 0, 46 | "tone_id": "confident", 47 | "tone_name": "Confident" 48 | }, 49 | { 50 | "score": 0.182282, 51 | "tone_id": "tentative", 52 | "tone_name": "Tentative" 53 | } 54 | ], 55 | "category_id": "language_tone", 56 | "category_name": "Language Tone" 57 | }, 58 | { 59 | "tones": [ 60 | { 61 | "score": 0.756101, 62 | "tone_id": "openness_big5", 63 | "tone_name": "Openness" 64 | }, 65 | { 66 | "score": 0.784779, 67 | "tone_id": "conscientiousness_big5", 68 | "tone_name": "Conscientiousness" 69 | }, 70 | { 71 | "score": 0.598989, 72 | "tone_id": "extraversion_big5", 73 | "tone_name": "Extraversion" 74 | }, 75 | { 76 | "score": 0.597154, 77 | "tone_id": "agreeableness_big5", 78 | "tone_name": "Agreeableness" 79 | }, 80 | { 81 | "score": 0.649775, 82 | "tone_id": "emotional_range_big5", 83 | "tone_name": "Emotional Range" 84 | } 85 | ], 86 | "category_id": "social_tone", 87 | "category_name": "Social Tone" 88 | } 89 | ] 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /data/second.txt: -------------------------------------------------------------------------------- 1 | Time is not always the same. There are days which give you rejoice, but they have their counterpart right on the way. They are effective just the moment you consider yourself the happiest person. Don't fall into traps. Be analytical. Don't trust people easily, especially when you fear betrayal. You would like to be happy with what you are, rather than becoming something disgusting. This word is just for the sake for testing the blog. 2 | 3 | { 4 | "document_tone": { 5 | "tone_categories": [ 6 | { 7 | "tones": [ 8 | { 9 | "score": 0.10004, 10 | "tone_id": "anger", 11 | "tone_name": "Anger" 12 | }, 13 | { 14 | "score": 0.646721, 15 | "tone_id": "disgust", 16 | "tone_name": "Disgust" 17 | }, 18 | { 19 | "score": 0.626063, 20 | "tone_id": "fear", 21 | "tone_name": "Fear" 22 | }, 23 | { 24 | "score": 0.57959, 25 | "tone_id": "joy", 26 | "tone_name": "Joy" 27 | }, 28 | { 29 | "score": 0.191186, 30 | "tone_id": "sadness", 31 | "tone_name": "Sadness" 32 | } 33 | ], 34 | "category_id": "emotion_tone", 35 | "category_name": "Emotion Tone" 36 | }, 37 | { 38 | "tones": [ 39 | { 40 | "score": 0.709736, 41 | "tone_id": "analytical", 42 | "tone_name": "Analytical" 43 | }, 44 | { 45 | "score": 0, 46 | "tone_id": "confident", 47 | "tone_name": "Confident" 48 | }, 49 | { 50 | "score": 0.922321, 51 | "tone_id": "tentative", 52 | "tone_name": "Tentative" 53 | } 54 | ], 55 | "category_id": "language_tone", 56 | "category_name": "Language Tone" 57 | }, 58 | { 59 | "tones": [ 60 | { 61 | "score": 0.696672, 62 | "tone_id": "openness_big5", 63 | "tone_name": "Openness" 64 | }, 65 | { 66 | "score": 0.640593, 67 | "tone_id": "conscientiousness_big5", 68 | "tone_name": "Conscientiousness" 69 | }, 70 | { 71 | "score": 0.380112, 72 | "tone_id": "extraversion_big5", 73 | "tone_name": "Extraversion" 74 | }, 75 | { 76 | "score": 0.501259, 77 | "tone_id": "agreeableness_big5", 78 | "tone_name": "Agreeableness" 79 | }, 80 | { 81 | "score": 0.311741, 82 | "tone_id": "emotional_range_big5", 83 | "tone_name": "Emotional Range" 84 | } 85 | ], 86 | "category_id": "social_tone", 87 | "category_name": "Social Tone" 88 | } 89 | ] 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /data/seventh.txt: -------------------------------------------------------------------------------- 1 | I interviewed for a job a few days ago and the interviewer informed me that it was "between me and one other person," and that he'd make the decision by the middle of this week (I'm assuming today through Thursday). This is after months of job searching and coming up with nothing, and while this job doesn't have everything I would want, it's not a bad job for me. Let's call this Job #1. However, the day before that interview I had submitted an application to a local place for a full-time position. Yesterday I got a call for an interview today, which is in a few hours. I'm confident that I'll do well in the interview, and the job offers way more hours, money, and opportunity for promotion. This will be Job #2. 2 | 3 | { 4 | "document_tone": { 5 | "tone_categories": [ 6 | { 7 | "tones": [ 8 | { 9 | "score": 0.171542, 10 | "tone_id": "anger", 11 | "tone_name": "Anger" 12 | }, 13 | { 14 | "score": 0.083164, 15 | "tone_id": "disgust", 16 | "tone_name": "Disgust" 17 | }, 18 | { 19 | "score": 0.177946, 20 | "tone_id": "fear", 21 | "tone_name": "Fear" 22 | }, 23 | { 24 | "score": 0.502551, 25 | "tone_id": "joy", 26 | "tone_name": "Joy" 27 | }, 28 | { 29 | "score": 0.275072, 30 | "tone_id": "sadness", 31 | "tone_name": "Sadness" 32 | } 33 | ], 34 | "category_id": "emotion_tone", 35 | "category_name": "Emotion Tone" 36 | }, 37 | { 38 | "tones": [ 39 | { 40 | "score": 0.693815, 41 | "tone_id": "analytical", 42 | "tone_name": "Analytical" 43 | }, 44 | { 45 | "score": 0.500192, 46 | "tone_id": "confident", 47 | "tone_name": "Confident" 48 | }, 49 | { 50 | "score": 0, 51 | "tone_id": "tentative", 52 | "tone_name": "Tentative" 53 | } 54 | ], 55 | "category_id": "language_tone", 56 | "category_name": "Language Tone" 57 | }, 58 | { 59 | "tones": [ 60 | { 61 | "score": 0.332777, 62 | "tone_id": "openness_big5", 63 | "tone_name": "Openness" 64 | }, 65 | { 66 | "score": 0.650671, 67 | "tone_id": "conscientiousness_big5", 68 | "tone_name": "Conscientiousness" 69 | }, 70 | { 71 | "score": 0.503615, 72 | "tone_id": "extraversion_big5", 73 | "tone_name": "Extraversion" 74 | }, 75 | { 76 | "score": 0.864213, 77 | "tone_id": "agreeableness_big5", 78 | "tone_name": "Agreeableness" 79 | }, 80 | { 81 | "score": 0.461735, 82 | "tone_id": "emotional_range_big5", 83 | "tone_name": "Emotional Range" 84 | } 85 | ], 86 | "category_id": "social_tone", 87 | "category_name": "Social Tone" 88 | } 89 | ] 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /data/sixth.txt: -------------------------------------------------------------------------------- 1 | There were about 25 or 30 of us. Some of us split one way and some another. A gunman just stood there spraying bullets around, right next to me. I managed to turn away and I ran into the hotel kitchen and then we were shunted into a restaurant in the basement. All of a sudden another gunmen appeared in front of us, carrying machine gun-type weapons. And he just started firing at us ... I just turned and ran in the opposite direction. 2 | 3 | { 4 | "document_tone": { 5 | "tone_categories": [ 6 | { 7 | "tones": [ 8 | { 9 | "score": 0.173256, 10 | "tone_id": "anger", 11 | "tone_name": "Anger" 12 | }, 13 | { 14 | "score": 0.193558, 15 | "tone_id": "disgust", 16 | "tone_name": "Disgust" 17 | }, 18 | { 19 | "score": 0.502034, 20 | "tone_id": "fear", 21 | "tone_name": "Fear" 22 | }, 23 | { 24 | "score": 0.130686, 25 | "tone_id": "joy", 26 | "tone_name": "Joy" 27 | }, 28 | { 29 | "score": 0.483035, 30 | "tone_id": "sadness", 31 | "tone_name": "Sadness" 32 | } 33 | ], 34 | "category_id": "emotion_tone", 35 | "category_name": "Emotion Tone" 36 | }, 37 | { 38 | "tones": [ 39 | { 40 | "score": 0.494171, 41 | "tone_id": "analytical", 42 | "tone_name": "Analytical" 43 | }, 44 | { 45 | "score": 0, 46 | "tone_id": "confident", 47 | "tone_name": "Confident" 48 | }, 49 | { 50 | "score": 0.968244, 51 | "tone_id": "tentative", 52 | "tone_name": "Tentative" 53 | } 54 | ], 55 | "category_id": "language_tone", 56 | "category_name": "Language Tone" 57 | }, 58 | { 59 | "tones": [ 60 | { 61 | "score": 0.904906, 62 | "tone_id": "openness_big5", 63 | "tone_name": "Openness" 64 | }, 65 | { 66 | "score": 0.427004, 67 | "tone_id": "conscientiousness_big5", 68 | "tone_name": "Conscientiousness" 69 | }, 70 | { 71 | "score": 0.379872, 72 | "tone_id": "extraversion_big5", 73 | "tone_name": "Extraversion" 74 | }, 75 | { 76 | "score": 0.21297, 77 | "tone_id": "agreeableness_big5", 78 | "tone_name": "Agreeableness" 79 | }, 80 | { 81 | "score": 0.423163, 82 | "tone_id": "emotional_range_big5", 83 | "tone_name": "Emotional Range" 84 | } 85 | ], 86 | "category_id": "social_tone", 87 | "category_name": "Social Tone" 88 | } 89 | ] 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /data/third.txt: -------------------------------------------------------------------------------- 1 | What do you think of yourself? Do you think the world won't be able to survive well without you. You are wrong. Your absense won't stop the world from running, no matter who you are and how much do you matter to the entire Earth. It is not you, but your impact, your contributions to the planet, to humanity, your work which lives forever, making your existence on the planet worth it. 2 | 3 | { 4 | "document_tone": { 5 | "tone_categories": [ 6 | { 7 | "tones": [ 8 | { 9 | "score": 0.244743, 10 | "tone_id": "anger", 11 | "tone_name": "Anger" 12 | }, 13 | { 14 | "score": 0.111543, 15 | "tone_id": "disgust", 16 | "tone_name": "Disgust" 17 | }, 18 | { 19 | "score": 0.074422, 20 | "tone_id": "fear", 21 | "tone_name": "Fear" 22 | }, 23 | { 24 | "score": 0.055459, 25 | "tone_id": "joy", 26 | "tone_name": "Joy" 27 | }, 28 | { 29 | "score": 0.57555, 30 | "tone_id": "sadness", 31 | "tone_name": "Sadness" 32 | } 33 | ], 34 | "category_id": "emotion_tone", 35 | "category_name": "Emotion Tone" 36 | }, 37 | { 38 | "tones": [ 39 | { 40 | "score": 0.862621, 41 | "tone_id": "analytical", 42 | "tone_name": "Analytical" 43 | }, 44 | { 45 | "score": 0.795808, 46 | "tone_id": "confident", 47 | "tone_name": "Confident" 48 | }, 49 | { 50 | "score": 0, 51 | "tone_id": "tentative", 52 | "tone_name": "Tentative" 53 | } 54 | ], 55 | "category_id": "language_tone", 56 | "category_name": "Language Tone" 57 | }, 58 | { 59 | "tones": [ 60 | { 61 | "score": 0.097495, 62 | "tone_id": "openness_big5", 63 | "tone_name": "Openness" 64 | }, 65 | { 66 | "score": 0.722431, 67 | "tone_id": "conscientiousness_big5", 68 | "tone_name": "Conscientiousness" 69 | }, 70 | { 71 | "score": 0.247508, 72 | "tone_id": "extraversion_big5", 73 | "tone_name": "Extraversion" 74 | }, 75 | { 76 | "score": 0.433536, 77 | "tone_id": "agreeableness_big5", 78 | "tone_name": "Agreeableness" 79 | }, 80 | { 81 | "score": 0.71357, 82 | "tone_id": "emotional_range_big5", 83 | "tone_name": "Emotional Range" 84 | } 85 | ], 86 | "category_id": "social_tone", 87 | "category_name": "Social Tone" 88 | } 89 | ] 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/favicon.ico -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | // var logger = require('./app/logger').logger; 3 | var md5 = require('md5'); 4 | var express = require('express'); 5 | var cookieParser = require('cookie-parser'); 6 | var app = express(); 7 | 8 | app.use(cookieParser()); 9 | var session = {}; 10 | 11 | function getRandomKey(username) { 12 | let d = new Date(); 13 | return md5(d.getTime() + username); 14 | } 15 | 16 | function sessionExists(username) { 17 | let exists = false; 18 | for (let key in session) { 19 | if (session[key] === username) 20 | return true; 21 | } 22 | return exists; 23 | } 24 | 25 | app.listen(8000, function (req, res) { 26 | console.log("server started"); 27 | }); 28 | 29 | app.get('/login/:userid', function(req, res) { 30 | // assuming ok username and password 31 | if (!sessionExists(req.params.userid)) { 32 | let sessionId = getRandomKey(req.params.userid); 33 | session[sessionId] = req.params.userid; 34 | res.cookie('sessionId', sessionId, { expire: 3600+Date.now() }); 35 | } 36 | res.send('done'); 37 | console.log(session); 38 | }); 39 | 40 | app.get('/logout', function(req, res) { 41 | // assuming ok username and password 42 | console.log(req.cookies); 43 | if (req.cookies.sessionId !== 'undefined') { 44 | delete session[req.cookies.sessionId]; 45 | res.clearCookie('sessionId'); 46 | } 47 | console.log(session); 48 | res.send('done'); 49 | }); 50 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "journal", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "body-parser": "^1.17.1", 13 | "cookie-parser": "^1.4.3", 14 | "ejs": "^2.5.6", 15 | "express": "^4.15.2", 16 | "express-session": "^1.15.2", 17 | "googleapis": "^18.0.0", 18 | "md5": "^2.2.1", 19 | "mysql": "^2.13.0", 20 | "request": "^2.81.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/favicon.ico -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Bold.eot -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Bold.ttf -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Bold.woff -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Bold.woff2 -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Light.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Light.eot -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Light.ttf -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Light.woff -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Light.woff2 -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Medium.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Medium.eot -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Medium.ttf -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Medium.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Medium.woff -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Medium.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Medium.woff2 -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Regular.eot -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Regular.ttf -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Regular.woff -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Regular.woff2 -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Thin.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Thin.eot -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Thin.ttf -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Thin.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Thin.woff -------------------------------------------------------------------------------- /public/fonts/roboto/Roboto-Thin.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/fonts/roboto/Roboto-Thin.woff2 -------------------------------------------------------------------------------- /public/homescreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/homescreen.png -------------------------------------------------------------------------------- /public/index-cloud.css: -------------------------------------------------------------------------------- 1 | html { 2 | --bgcolor: #26b2fa; 3 | } 4 | 5 | #Clouds { 6 | position: absolute; 7 | top: 0; 8 | right: 0; 9 | bottom: 0; 10 | left: 0; 11 | margin: auto; 12 | overflow: hidden; 13 | animation: FadeIn 3s ease-out; 14 | user-select: none; 15 | overflow: hidden; 16 | } 17 | 18 | @keyframes FadeIn { 19 | from { 20 | opacity: 0; 21 | } 22 | to { 23 | opacity: 1; 24 | } 25 | } 26 | 27 | .Cloud { 28 | position: absolute; 29 | width: 100%; 30 | background-repeat: no-repeat; 31 | background-size: auto 100%; 32 | height: 70px; 33 | animation-duration: 120s; 34 | animation-iteration-count: infinite; 35 | animation-fill-mode: forwards; 36 | animation-timing-function: linear; 37 | animation-name: Float, FadeFloat; 38 | z-index: 1; 39 | overflow: hidden; 40 | } 41 | 42 | .Cloud.Foreground { 43 | height: 10%; 44 | min-height: 20px; 45 | z-index: 3; 46 | } 47 | 48 | .Cloud.Background { 49 | height: 9.09090909%; 50 | min-height: 8px; 51 | animation-duration: 210s; 52 | } 53 | 54 | @keyframes Float { 55 | from { 56 | transform: translateX(100%) translateZ(0); 57 | } 58 | to { 59 | transform: translateX(-15%) translateZ(0); 60 | } 61 | } 62 | 63 | 64 | /* 65 | @keyframes Float { 66 | from { transform: translateX(100%) translateY(-100%) translateZ(0); } 67 | 50% { transform: translateX(55%) translateY(0) translateZ(0); } 68 | to { transform: translateX(-5%) translateY(-100%) translateZ(0); } 69 | } 70 | */ 71 | 72 | @keyframes FadeFloat { 73 | 0%, 74 | 100% { 75 | opacity: 0; 76 | } 77 | 5%, 78 | 90% { 79 | opacity: 1; 80 | } 81 | } 82 | 83 | .Cloud:nth-child(10) { 84 | animation-delay: -184.61538462s; 85 | top: 60%; 86 | } 87 | 88 | .Cloud.Foreground:nth-child(10) { 89 | animation-duration: 80s; 90 | height: 35%; 91 | } 92 | 93 | .Cloud.Background:nth-child(10) { 94 | animation-duration: 110s; 95 | height: -3.40909091%; 96 | } 97 | 98 | .Cloud:nth-child(9) { 99 | animation-delay: -166.15384615s; 100 | top: 54%; 101 | } 102 | 103 | .Cloud.Foreground:nth-child(9) { 104 | animation-duration: 84s; 105 | height: 32.5%; 106 | } 107 | 108 | .Cloud.Background:nth-child(9) { 109 | animation-duration: 114s; 110 | height: -2.15909091%; 111 | } 112 | 113 | .Cloud:nth-child(8) { 114 | animation-delay: -147.69230769s; 115 | top: 48%; 116 | } 117 | 118 | .Cloud.Foreground:nth-child(8) { 119 | animation-duration: 88s; 120 | height: 30%; 121 | } 122 | 123 | .Cloud.Background:nth-child(8) { 124 | animation-duration: 118s; 125 | height: -0.90909091%; 126 | } 127 | 128 | .Cloud:nth-child(7) { 129 | animation-delay: -129.23076923s; 130 | top: 42%; 131 | } 132 | 133 | .Cloud.Foreground:nth-child(7) { 134 | animation-duration: 92s; 135 | height: 27.5%; 136 | } 137 | 138 | .Cloud.Background:nth-child(7) { 139 | animation-duration: 122s; 140 | height: 0.34090909%; 141 | } 142 | 143 | .Cloud:nth-child(6) { 144 | animation-delay: -110.76923077s; 145 | top: 36%; 146 | } 147 | 148 | .Cloud.Foreground:nth-child(6) { 149 | animation-duration: 96s; 150 | height: 25%; 151 | } 152 | 153 | .Cloud.Background:nth-child(6) { 154 | animation-duration: 126s; 155 | height: 1.59090909%; 156 | } 157 | 158 | .Cloud:nth-child(5) { 159 | animation-delay: -92.30769231s; 160 | top: 30%; 161 | } 162 | 163 | .Cloud.Foreground:nth-child(5) { 164 | animation-duration: 100s; 165 | height: 22.5%; 166 | } 167 | 168 | .Cloud.Background:nth-child(5) { 169 | animation-duration: 130s; 170 | height: 2.84090909%; 171 | } 172 | 173 | .Cloud:nth-child(4) { 174 | animation-delay: -73.84615385s; 175 | top: 24%; 176 | } 177 | 178 | .Cloud.Foreground:nth-child(4) { 179 | animation-duration: 104s; 180 | height: 20%; 181 | } 182 | 183 | .Cloud.Background:nth-child(4) { 184 | animation-duration: 134s; 185 | height: 4.09090909%; 186 | } 187 | 188 | .Cloud:nth-child(3) { 189 | animation-delay: -55.38461538s; 190 | top: 18%; 191 | } 192 | 193 | .Cloud.Foreground:nth-child(3) { 194 | animation-duration: 108s; 195 | height: 17.5%; 196 | } 197 | 198 | .Cloud.Background:nth-child(3) { 199 | animation-duration: 138s; 200 | height: 5.34090909%; 201 | } 202 | 203 | .Cloud:nth-child(2) { 204 | animation-delay: -36.92307692s; 205 | top: 12%; 206 | } 207 | 208 | .Cloud.Foreground:nth-child(2) { 209 | animation-duration: 112s; 210 | height: 15%; 211 | } 212 | 213 | .Cloud.Background:nth-child(2) { 214 | animation-duration: 142s; 215 | height: 6.59090909%; 216 | } 217 | 218 | .Cloud:nth-child(1) { 219 | animation-delay: -18.46153846s; 220 | top: 6%; 221 | } 222 | 223 | .Cloud.Foreground:nth-child(1) { 224 | animation-duration: 116s; 225 | height: 12.5%; 226 | } 227 | 228 | .Cloud.Background:nth-child(1) { 229 | animation-duration: 146s; 230 | height: 7.84090909%; 231 | } 232 | 233 | .Cloud { 234 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKQAAABgCAYAAACTzNnjAAAFCklEQVR42u3d34uVRRjA8YMsEi0iSwhdRBGhSJgZiNRFIkWhQVEXBipKUVBBLCF6k0h4UxFkBLq4QT/Qiyi80EgxCjXMWqOMtqy0bBNja92yXatN3c3pGc9sHU/v+X3emWfe93vx+QN23u+e95x5Z94pmNWFQo5NEytErzgoBsSIOCf+FqbEBTEhzophcVTsFxvFEjE152PZHGMukbcB6BAPij0uqgtl0bXCBvyjeFPcS2wEWc0y0ec++Ywnf7rwbyc8grQ6RY8Y9RhhJT+Jde4TmghzFuR08bo4ryDEpE/N58QUYsx+kFPcD4yzCkMsZz+1uwkyu0HeKYYiCLHcN2I2QWYnSPudbHubfy37NuFu4wQZeZD2k2Uw4hDLHRZdBBnnH3K/5ykcX86IeQQZl6civ0XXYv/RlhJkHLZkOMTypz7dBKnbyzmJsfTZeTdB6vRszmIsjXI5QeryWMa/M9ZinzjdTJA63CLGcxzjpD/ElQQZfq3iKDFe8lSHIAPqI8L/6SHIMB4nvorTQQsI0v+teoz4KjpBkH7tIrqaNhCkH9cnbK5C8q/uywiSHzKabCLIdM3K+QR4o8YysfVWcZDvElnD1hNkOi5XuilLu5MlOyzni3vESnGfWCRuIMjm1zgSWPM7GWvNXdonXkdM8Q0dCwmytu8Iy/vK9B3iRoJMnghnqifc8jb7yXkXQf5nLWGo2WR2HUGuLrxPDKq25D6d9yBPE4I6/e6rVO6CnMpkuFq/eLmFKwtyMRde/dOg2XkKkvlH/X5P9ZNSWZBvcMGjMJza6iJlQe7nYkfjozwE+TkXOiprsx7kES5yVOzLYK/IcpA/cJGj806Wg/yaCxzlzsersxpkPxc4SruzGuQBLm603yU7DPOQUOSJWIK0E6j2lcvPm+JJVp+674oDbiFuv5t/fEXs5cJG65DmIO3KY3vG3yCLbXO1N1xVkB3uWfQQFye3rtUS5DN1bC5C9j0cOki7XOwUFwJOb6gg7TmCW1lMizI7QwQ5nW2qqGCv7yDtwsxfGXhU0OczyKvECIOOKvb5CnKa2+TDoKOat3wFyaIH1ONFH0H2MNCo00NpBzmXR39owIy0gzzOIKNOv6X9LHsZg4wGp3xsM/ZMoUfF3aaZ4++qBDnIIKMNzrsHKb11Lb6oEORtDCRSYB81f+vWxzYUJBv2kTYb5vx6gzzHgMHTjsUXagV5BwMFzz78d5NYQpDbGCAEcOzissaEIL9kcBDIx0lBsrwMIW0uD3KcQUHgqaEFpUGyLQGhnSgNkgGBBg8QJDQ5Phkky82g5bvkNQXDscDQY6MNcpiBgBL9NsjDDAS0LPq1Qb7EQECJicLFSUkGAkpMLgMaYzCgKci3GQxomPqZDPImBgMa9uOULifnDWcI7VRpkIsYEAR2sHwX2GcMCgJak/QKPh4lIsgcpOhM2iv7JIODAPqqvY7vPQYInlf6zKsWpN2iOMBAwZMD9bzSudPwvh+kr3gofJ0vve/ikxIp36pXNHosiD2j5gMGD2ksyG3lJK917qc5A4l2eNW04Wi5OaZ41DADilZu0xtMmw/fXCV+ZnDRoFFTfBdpaudlLxVfsXMRNYy7W3SH8XSAu/01bo8s/kL8xQWAM+JC7DIeDnCvZqZ4RGxxi3/3iUPOJ+5TtRXfG/v6jeadNMVjlqsZquG0uwU164ybg2vFuPuh2ax23tkm3N91VLwmbjVNvPT+H7Ro4730ITNPAAAAAElFTkSuQmCC); 235 | } 236 | 237 | .Cloud.Background { 238 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEoAAAAqCAYAAAAUJM0rAAACFUlEQVRo3u3aPSwDYRzH8UZEbAYiYrDYjLZGpIPBJLGwSKwi0k1iYBKDdFJsEiMxSZgsFZJGiGjqJWEhSKuaNKRUG8r5PfI8SXOud72+PH2eu2f47Ndv7+V5/nee/G6bh5MWmIV9iEMWvkGjfiADD7AHk9BU6+PSNK0kPAINwwXkC6KU6gvC4HVyKB/clhHHCDnbTqHbSaEaYIv+OK3KyBk274RQrXBXg0B6B/QPkTIUiZTiEIm5gkbZQjXTJ5nG2ZFsocJ1iMQEZQk1VcdIGl2L9Yoeitwj3uocirgRPVRAgEjMoMihkgKFStIzK063QVHYhKF6h/IKFMlKGpaNlhM8Qq1JFIp5gQHeoSIShmJPST/PUElJQ7FN9hivUGmJQxE56OQRKiN5qL/NNY9QKQeEIpdgR7VC9cEqHeGeUyEHXHrMUiWhyKx6BV4dEsNMtNxQI4Ls33h5LidUoEYjXKEXoXZDLbgsEBOzE8qne8fmJhE7oWIujUQcwhyMmy0VSKRRF0cyWlclYMYo1LEKZOgRugpDpVWUot5ZLI8LlwN23bNQKoY1vwpVmmsS6kOFsPRJQl2qENZIqGkVwnp9xb5nUksEcxm2hZlQMcy3OYXTgx0VpOi2pl8/jwqpMP9sF5twBl08ctE7I/dws5l5D5y4OBj51HvdzluYdlik0RL06cjkKpSlB1Span5x/AQb5Hfrxyy/oU5ISeVw53AAAAAASUVORK5CYII=); 239 | } 240 | 241 | html, 242 | body { 243 | margin: 0; 244 | padding: 0; 245 | } 246 | 247 | html { 248 | height: 100%; 249 | } 250 | 251 | body { 252 | color: #FFF; 253 | background-color: var(--bgcolor); 254 | background-image: radial-gradient(circle, #00b5ff 0%, #26b2fa 70%, #1fd2fb 100%); 255 | } -------------------------------------------------------------------------------- /public/index.css: -------------------------------------------------------------------------------- 1 | html { 2 | --bgcolor: #26b2fa; 3 | filter: hue-rotate(170deg); 4 | } 5 | 6 | body { 7 | margin: 0; 8 | transition-property: all; 9 | transition-duration: 0.3s; 10 | transition-timing-function: ease-in; 11 | } 12 | 13 | a { 14 | cursor: pointer; 15 | } 16 | 17 | #contentwrap { 18 | z-index: 9999; 19 | opacity: 1; 20 | margin-top: 6vw; 21 | } 22 | 23 | button { 24 | border: 0; 25 | } 26 | 27 | #Clouds { 28 | z-index: -1; 29 | transition-property: all; 30 | transition-duration: 0s; 31 | transition-timing-function: ease; 32 | } 33 | 34 | #word { 35 | color: white; 36 | z-index: 100; 37 | font-family: 'Oswald', sans-serif; 38 | font-size: 10em; 39 | text-align: center; 40 | position: absolute; 41 | left: 40%; 42 | top: 50%; 43 | transition-property: all; 44 | animation-duration: 2.69s; 45 | transition-timing-function: ease-out; 46 | } 47 | 48 | .purehidden { 49 | opacity: 0; 50 | } 51 | 52 | button:focus { 53 | outline: 0; 54 | } 55 | 56 | #start { 57 | width: 18vw; 58 | font-family: 'Quicksand', sans-serif; 59 | padding: 0.7vw; 60 | font-size: 1.5em; 61 | cursor: pointer; 62 | margin-top: 50px; 63 | } 64 | 65 | .msg { 66 | text-align: center; 67 | font-family: 'Quicksand', sans-serif; 68 | font-size: 2em; 69 | opacity: 1; 70 | } 71 | 72 | #welcome { 73 | display: flex; 74 | flex-direction: column; 75 | align-items: center; 76 | } 77 | 78 | #welcome div { 79 | margin-bottom: 1vw; 80 | } 81 | 82 | 83 | /*button*/ 84 | 85 | .hvr-underline-from-center { 86 | display: inline-block; 87 | vertical-align: middle; 88 | -webkit-transform: perspective(1px) translateZ(0); 89 | transform: perspective(1px) translateZ(0); 90 | box-shadow: 0 0 1px transparent; 91 | position: relative; 92 | overflow: hidden; 93 | background-color: transparent; 94 | color: white; 95 | border: 1px solid white; 96 | } 97 | 98 | .hvr-underline-from-center:hover { 99 | color: white; 100 | } 101 | 102 | .hvr-underline-from-center:before { 103 | content: ""; 104 | position: absolute; 105 | z-index: -1; 106 | left: 50%; 107 | right: 50%; 108 | bottom: 0; 109 | background: white; 110 | height: 2px; 111 | -webkit-transition-property: left, right; 112 | transition-property: left, right; 113 | -webkit-transition-duration: 0.3s; 114 | transition-duration: 0.3s; 115 | -webkit-transition-timing-function: ease-out; 116 | transition-timing-function: ease-out; 117 | } 118 | 119 | .hvr-underline-from-center:hover:before, 120 | .hvr-underline-from-center:focus:before, 121 | .hvr-underline-from-center:active:before { 122 | left: 0; 123 | right: 0; 124 | } 125 | 126 | 127 | /*close button */ 128 | 129 | #close { 130 | position: absolute; 131 | right: 32px; 132 | top: 32px; 133 | width: 32px; 134 | height: 32px; 135 | opacity: 0.3; 136 | } 137 | 138 | #close:hover { 139 | opacity: 1; 140 | } 141 | 142 | #close:before, 143 | #close:after { 144 | position: absolute; 145 | left: 15px; 146 | content: ' '; 147 | height: 33px; 148 | width: 2px; 149 | background-color: white; 150 | } 151 | 152 | #close:before { 153 | transform: rotate(45deg); 154 | } 155 | 156 | #close:after { 157 | transform: rotate(-45deg); 158 | } 159 | 160 | 161 | /*mic*/ 162 | 163 | .frame { 164 | position: absolute; 165 | top: 50%; 166 | left: 50%; 167 | width: 400px; 168 | height: 400px; 169 | margin-top: -200px; 170 | margin-left: -200px; 171 | border-radius: 2px; 172 | overflow: hidden; 173 | background: transparent; 174 | color: #fff; 175 | font-family: 'Open Sans', Helvetica, sans-serif; 176 | -webkit-font-smoothing: antialiased; 177 | -moz-osx-font-smoothing: grayscale; 178 | } 179 | 180 | .checkbox { 181 | display: none; 182 | } 183 | 184 | .checkbox:checked~.microphone .circle { 185 | animation: circle 5s linear infinite; 186 | } 187 | 188 | .checkbox:checked~.microphone .icon { 189 | animation: icon .7s ease-in-out both; 190 | } 191 | 192 | .checkbox:checked~.microphone .dots { 193 | animation: dots 1s ease-in-out both; 194 | } 195 | 196 | .checkbox:checked~.microphone .dot-1 { 197 | animation: dot 1s ease-in-out infinite; 198 | } 199 | 200 | .checkbox:checked~.microphone .dot-2 { 201 | animation: dot 1s ease-in-out -0.2s infinite; 202 | } 203 | 204 | .checkbox:checked~.microphone .dot-3 { 205 | animation: dot 1s ease-in-out -0.4s infinite; 206 | } 207 | 208 | .label { 209 | position: absolute; 210 | top: 0; 211 | left: 0; 212 | right: 0; 213 | bottom: 0; 214 | z-index: 50; 215 | cursor: pointer; 216 | } 217 | 218 | .microphone { 219 | position: absolute; 220 | width: 100px; 221 | height: 100px; 222 | top: 150px; 223 | left: 150px; 224 | } 225 | 226 | .microphone .circle { 227 | fill: none; 228 | stroke: #fff; 229 | stroke-width: 3; 230 | stroke-linecap: round; 231 | transform-origin: 50% 50%; 232 | } 233 | 234 | .microphone .icon { 235 | position: absolute; 236 | width: 24px; 237 | height: 66px; 238 | top: 16px; 239 | left: 38px; 240 | } 241 | 242 | .microphone .icon .body { 243 | position: relative; 244 | width: 24px; 245 | height: 52px; 246 | background: #fff; 247 | border-radius: 12px; 248 | } 249 | 250 | .microphone .icon .body .fill { 251 | position: relative; 252 | width: 6px; 253 | height: 16px; 254 | top: 7px; 255 | left: 9px; 256 | background: var(--bgcolor); 257 | filter: hue-rotate(180deg); 258 | border-radius: 3px; 259 | } 260 | 261 | .microphone .icon .foot_v { 262 | position: absolute; 263 | width: 4px; 264 | height: 15px; 265 | top: 51px; 266 | left: 10px; 267 | background: #fff; 268 | } 269 | 270 | .microphone .icon .foot_h { 271 | position: absolute; 272 | width: 24px; 273 | height: 4px; 274 | bottom: 0; 275 | left: 0; 276 | background: #fff; 277 | border-radius: 2px; 278 | } 279 | 280 | .microphone .dots { 281 | opacity: 0; 282 | position: absolute; 283 | width: 50px; 284 | height: 10px; 285 | top: 45px; 286 | left: 25px; 287 | } 288 | 289 | .microphone .dots .dot { 290 | float: left; 291 | width: 10px; 292 | height: 10px; 293 | border-radius: 50%; 294 | background: #fff; 295 | } 296 | 297 | .microphone .dots .dot-2 { 298 | margin: 0 10px; 299 | } 300 | 301 | @keyframes circle { 302 | 0% { 303 | stroke-dashoffset: 0; 304 | stroke-dasharray: 296 296; 305 | transform: rotate(0deg); 306 | } 307 | 100% { 308 | stroke-dashoffset: -592; 309 | stroke-dasharray: 296 296; 310 | transform: rotate(360deg); 311 | } 312 | } 313 | 314 | @keyframes dot { 315 | 0% { 316 | transform: translateY(5px); 317 | } 318 | 50% { 319 | transform: translateY(-5px); 320 | } 321 | 100% { 322 | transform: translateY(5px); 323 | } 324 | } 325 | 326 | @keyframes icon { 327 | 0% { 328 | transform: scale(1); 329 | opacity: 1; 330 | } 331 | 30% { 332 | transform: scale(1.1); 333 | opacity: 1; 334 | } 335 | 100% { 336 | transform: scale(0); 337 | opacity: 0; 338 | } 339 | } 340 | 341 | @keyframes dots { 342 | 0%, 343 | 60% { 344 | transform: scale(0); 345 | opacity: 0; 346 | } 347 | 100% { 348 | transform: scale(1); 349 | opacity: 1; 350 | } 351 | } 352 | 353 | #logo { 354 | filter: hue-rotate(-170deg); 355 | cursor: pointer; 356 | } 357 | 358 | #logomark { 359 | font-family: 'Text Me One', sans-serif; 360 | font-size: 8vw; 361 | text-align: center; 362 | margin: 0; 363 | margin-top: 4vw; 364 | } 365 | 366 | .hvr-float-shadow { 367 | display: inline-block; 368 | vertical-align: middle; 369 | -webkit-transform: perspective(1px) translateZ(0); 370 | transform: perspective(1px) translateZ(0); 371 | box-shadow: 0 0 1px transparent; 372 | position: relative; 373 | -webkit-transition-duration: 0.3s; 374 | transition-duration: 0.3s; 375 | -webkit-transition-property: transform; 376 | transition-property: transform; 377 | } 378 | 379 | .hvr-float-shadow:before { 380 | pointer-events: none; 381 | position: absolute; 382 | z-index: -1; 383 | content: ''; 384 | top: 100%; 385 | left: 5%; 386 | height: 10px; 387 | width: 90%; 388 | opacity: 0; 389 | background: -webkit-radial-gradient(center, ellipse, rgba(0, 0, 0, 0.35) 0%, transparent 80%); 390 | background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.35) 0%, transparent 80%); 391 | /* W3C */ 392 | -webkit-transition-duration: 0.3s; 393 | transition-duration: 0.3s; 394 | -webkit-transition-property: transform, opacity; 395 | transition-property: transform, opacity; 396 | } 397 | 398 | .hvr-float-shadow:hover, 399 | .hvr-float-shadow:focus, 400 | .hvr-float-shadow:active { 401 | -webkit-transform: translateY(-10px); 402 | transform: translateY(-10px); 403 | /* move the element up by 5px */ 404 | } 405 | 406 | .hvr-float-shadow:hover:before, 407 | .hvr-float-shadow:focus:before, 408 | .hvr-float-shadow:active:before { 409 | opacity: 1; 410 | -webkit-transform: translateY(10px); 411 | transform: translateY(10px); 412 | /* move the element down by 5px (it will stay in place because it's attached to the element that also moves up 5px) */ 413 | } 414 | 415 | #controlwrap { 416 | display: flex; 417 | flex-direction: column; 418 | text-align: center; 419 | margin-top: 20px; 420 | } 421 | 422 | #cr2>a { 423 | margin: 5px; 424 | background-color: transparent; 425 | border: none; 426 | cursor: pointer; 427 | font-size: 2vw; 428 | font-family: 'Quicksand', sans-serif; 429 | color: white; 430 | text-decoration: none; 431 | } 432 | 433 | .hidden { 434 | display: none; 435 | } 436 | 437 | .visible { 438 | display: block; 439 | } 440 | 441 | 442 | /*Loader*/ 443 | 444 | #loader { 445 | position: relative; 446 | display: block; 447 | margin: auto; 448 | margin-top: 10vw; 449 | width: 75px; 450 | height: 100px; 451 | } 452 | 453 | .loader__bar { 454 | position: absolute; 455 | bottom: 0; 456 | width: 10px; 457 | height: 50%; 458 | background: #fff; 459 | -webkit-transform-origin: center bottom; 460 | transform-origin: center bottom; 461 | box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.2); 462 | } 463 | 464 | .loader__bar:nth-child(1) { 465 | left: 0px; 466 | -webkit-transform: scale(1, 0.2); 467 | transform: scale(1, 0.2); 468 | -webkit-animation: barUp1 4s infinite; 469 | animation: barUp1 4s infinite; 470 | } 471 | 472 | .loader__bar:nth-child(2) { 473 | left: 15px; 474 | -webkit-transform: scale(1, 0.4); 475 | transform: scale(1, 0.4); 476 | -webkit-animation: barUp2 4s infinite; 477 | animation: barUp2 4s infinite; 478 | } 479 | 480 | .loader__bar:nth-child(3) { 481 | left: 30px; 482 | -webkit-transform: scale(1, 0.6); 483 | transform: scale(1, 0.6); 484 | -webkit-animation: barUp3 4s infinite; 485 | animation: barUp3 4s infinite; 486 | } 487 | 488 | .loader__bar:nth-child(4) { 489 | left: 45px; 490 | -webkit-transform: scale(1, 0.8); 491 | transform: scale(1, 0.8); 492 | -webkit-animation: barUp4 4s infinite; 493 | animation: barUp4 4s infinite; 494 | } 495 | 496 | .loader__bar:nth-child(5) { 497 | left: 60px; 498 | -webkit-transform: scale(1, 1); 499 | transform: scale(1, 1); 500 | -webkit-animation: barUp5 4s infinite; 501 | animation: barUp5 4s infinite; 502 | } 503 | 504 | .loader__ball { 505 | position: absolute; 506 | bottom: 10px; 507 | left: 0; 508 | width: 10px; 509 | height: 10px; 510 | background: #fff; 511 | border-radius: 50%; 512 | -webkit-animation: ball 4s infinite; 513 | animation: ball 4s infinite; 514 | } 515 | 516 | @-webkit-keyframes ball { 517 | 0% { 518 | -webkit-transform: translate(0, 0); 519 | transform: translate(0, 0); 520 | } 521 | 5% { 522 | -webkit-transform: translate(8px, -14px); 523 | transform: translate(8px, -14px); 524 | } 525 | 10% { 526 | -webkit-transform: translate(15px, -10px); 527 | transform: translate(15px, -10px); 528 | } 529 | 17% { 530 | -webkit-transform: translate(23px, -24px); 531 | transform: translate(23px, -24px); 532 | } 533 | 20% { 534 | -webkit-transform: translate(30px, -20px); 535 | transform: translate(30px, -20px); 536 | } 537 | 27% { 538 | -webkit-transform: translate(38px, -34px); 539 | transform: translate(38px, -34px); 540 | } 541 | 30% { 542 | -webkit-transform: translate(45px, -30px); 543 | transform: translate(45px, -30px); 544 | } 545 | 37% { 546 | -webkit-transform: translate(53px, -44px); 547 | transform: translate(53px, -44px); 548 | } 549 | 40% { 550 | -webkit-transform: translate(60px, -40px); 551 | transform: translate(60px, -40px); 552 | } 553 | 50% { 554 | -webkit-transform: translate(60px, 0); 555 | transform: translate(60px, 0); 556 | } 557 | 57% { 558 | -webkit-transform: translate(53px, -14px); 559 | transform: translate(53px, -14px); 560 | } 561 | 60% { 562 | -webkit-transform: translate(45px, -10px); 563 | transform: translate(45px, -10px); 564 | } 565 | 67% { 566 | -webkit-transform: translate(37px, -24px); 567 | transform: translate(37px, -24px); 568 | } 569 | 70% { 570 | -webkit-transform: translate(30px, -20px); 571 | transform: translate(30px, -20px); 572 | } 573 | 77% { 574 | -webkit-transform: translate(22px, -34px); 575 | transform: translate(22px, -34px); 576 | } 577 | 80% { 578 | -webkit-transform: translate(15px, -30px); 579 | transform: translate(15px, -30px); 580 | } 581 | 87% { 582 | -webkit-transform: translate(7px, -44px); 583 | transform: translate(7px, -44px); 584 | } 585 | 90% { 586 | -webkit-transform: translate(0, -40px); 587 | transform: translate(0, -40px); 588 | } 589 | 100% { 590 | -webkit-transform: translate(0, 0); 591 | transform: translate(0, 0); 592 | } 593 | } 594 | 595 | @keyframes ball { 596 | 0% { 597 | -webkit-transform: translate(0, 0); 598 | transform: translate(0, 0); 599 | } 600 | 5% { 601 | -webkit-transform: translate(8px, -14px); 602 | transform: translate(8px, -14px); 603 | } 604 | 10% { 605 | -webkit-transform: translate(15px, -10px); 606 | transform: translate(15px, -10px); 607 | } 608 | 17% { 609 | -webkit-transform: translate(23px, -24px); 610 | transform: translate(23px, -24px); 611 | } 612 | 20% { 613 | -webkit-transform: translate(30px, -20px); 614 | transform: translate(30px, -20px); 615 | } 616 | 27% { 617 | -webkit-transform: translate(38px, -34px); 618 | transform: translate(38px, -34px); 619 | } 620 | 30% { 621 | -webkit-transform: translate(45px, -30px); 622 | transform: translate(45px, -30px); 623 | } 624 | 37% { 625 | -webkit-transform: translate(53px, -44px); 626 | transform: translate(53px, -44px); 627 | } 628 | 40% { 629 | -webkit-transform: translate(60px, -40px); 630 | transform: translate(60px, -40px); 631 | } 632 | 50% { 633 | -webkit-transform: translate(60px, 0); 634 | transform: translate(60px, 0); 635 | } 636 | 57% { 637 | -webkit-transform: translate(53px, -14px); 638 | transform: translate(53px, -14px); 639 | } 640 | 60% { 641 | -webkit-transform: translate(45px, -10px); 642 | transform: translate(45px, -10px); 643 | } 644 | 67% { 645 | -webkit-transform: translate(37px, -24px); 646 | transform: translate(37px, -24px); 647 | } 648 | 70% { 649 | -webkit-transform: translate(30px, -20px); 650 | transform: translate(30px, -20px); 651 | } 652 | 77% { 653 | -webkit-transform: translate(22px, -34px); 654 | transform: translate(22px, -34px); 655 | } 656 | 80% { 657 | -webkit-transform: translate(15px, -30px); 658 | transform: translate(15px, -30px); 659 | } 660 | 87% { 661 | -webkit-transform: translate(7px, -44px); 662 | transform: translate(7px, -44px); 663 | } 664 | 90% { 665 | -webkit-transform: translate(0, -40px); 666 | transform: translate(0, -40px); 667 | } 668 | 100% { 669 | -webkit-transform: translate(0, 0); 670 | transform: translate(0, 0); 671 | } 672 | } 673 | 674 | @-webkit-keyframes barUp1 { 675 | 0% { 676 | -webkit-transform: scale(1, 0.2); 677 | transform: scale(1, 0.2); 678 | } 679 | 40% { 680 | -webkit-transform: scale(1, 0.2); 681 | transform: scale(1, 0.2); 682 | } 683 | 50% { 684 | -webkit-transform: scale(1, 1); 685 | transform: scale(1, 1); 686 | } 687 | 90% { 688 | -webkit-transform: scale(1, 1); 689 | transform: scale(1, 1); 690 | } 691 | 100% { 692 | -webkit-transform: scale(1, 0.2); 693 | transform: scale(1, 0.2); 694 | } 695 | } 696 | 697 | @keyframes barUp1 { 698 | 0% { 699 | -webkit-transform: scale(1, 0.2); 700 | transform: scale(1, 0.2); 701 | } 702 | 40% { 703 | -webkit-transform: scale(1, 0.2); 704 | transform: scale(1, 0.2); 705 | } 706 | 50% { 707 | -webkit-transform: scale(1, 1); 708 | transform: scale(1, 1); 709 | } 710 | 90% { 711 | -webkit-transform: scale(1, 1); 712 | transform: scale(1, 1); 713 | } 714 | 100% { 715 | -webkit-transform: scale(1, 0.2); 716 | transform: scale(1, 0.2); 717 | } 718 | } 719 | 720 | @-webkit-keyframes barUp2 { 721 | 0% { 722 | -webkit-transform: scale(1, 0.4); 723 | transform: scale(1, 0.4); 724 | } 725 | 40% { 726 | -webkit-transform: scale(1, 0.4); 727 | transform: scale(1, 0.4); 728 | } 729 | 50% { 730 | -webkit-transform: scale(1, 0.8); 731 | transform: scale(1, 0.8); 732 | } 733 | 90% { 734 | -webkit-transform: scale(1, 0.8); 735 | transform: scale(1, 0.8); 736 | } 737 | 100% { 738 | -webkit-transform: scale(1, 0.4); 739 | transform: scale(1, 0.4); 740 | } 741 | } 742 | 743 | @keyframes barUp2 { 744 | 0% { 745 | -webkit-transform: scale(1, 0.4); 746 | transform: scale(1, 0.4); 747 | } 748 | 40% { 749 | -webkit-transform: scale(1, 0.4); 750 | transform: scale(1, 0.4); 751 | } 752 | 50% { 753 | -webkit-transform: scale(1, 0.8); 754 | transform: scale(1, 0.8); 755 | } 756 | 90% { 757 | -webkit-transform: scale(1, 0.8); 758 | transform: scale(1, 0.8); 759 | } 760 | 100% { 761 | -webkit-transform: scale(1, 0.4); 762 | transform: scale(1, 0.4); 763 | } 764 | } 765 | 766 | @-webkit-keyframes barUp3 { 767 | 0% { 768 | -webkit-transform: scale(1, 0.6); 769 | transform: scale(1, 0.6); 770 | } 771 | 100% { 772 | -webkit-transform: scale(1, 0.6); 773 | transform: scale(1, 0.6); 774 | } 775 | } 776 | 777 | @keyframes barUp3 { 778 | 0% { 779 | -webkit-transform: scale(1, 0.6); 780 | transform: scale(1, 0.6); 781 | } 782 | 100% { 783 | -webkit-transform: scale(1, 0.6); 784 | transform: scale(1, 0.6); 785 | } 786 | } 787 | 788 | @-webkit-keyframes barUp4 { 789 | 0% { 790 | -webkit-transform: scale(1, 0.8); 791 | transform: scale(1, 0.8); 792 | } 793 | 40% { 794 | -webkit-transform: scale(1, 0.8); 795 | transform: scale(1, 0.8); 796 | } 797 | 50% { 798 | -webkit-transform: scale(1, 0.4); 799 | transform: scale(1, 0.4); 800 | } 801 | 90% { 802 | -webkit-transform: scale(1, 0.4); 803 | transform: scale(1, 0.4); 804 | } 805 | 100% { 806 | -webkit-transform: scale(1, 0.8); 807 | transform: scale(1, 0.8); 808 | } 809 | } 810 | 811 | @keyframes barUp4 { 812 | 0% { 813 | -webkit-transform: scale(1, 0.8); 814 | transform: scale(1, 0.8); 815 | } 816 | 40% { 817 | -webkit-transform: scale(1, 0.8); 818 | transform: scale(1, 0.8); 819 | } 820 | 50% { 821 | -webkit-transform: scale(1, 0.4); 822 | transform: scale(1, 0.4); 823 | } 824 | 90% { 825 | -webkit-transform: scale(1, 0.4); 826 | transform: scale(1, 0.4); 827 | } 828 | 100% { 829 | -webkit-transform: scale(1, 0.8); 830 | transform: scale(1, 0.8); 831 | } 832 | } 833 | 834 | @-webkit-keyframes barUp5 { 835 | 0% { 836 | -webkit-transform: scale(1, 1); 837 | transform: scale(1, 1); 838 | } 839 | 40% { 840 | -webkit-transform: scale(1, 1); 841 | transform: scale(1, 1); 842 | } 843 | 50% { 844 | -webkit-transform: scale(1, 0.2); 845 | transform: scale(1, 0.2); 846 | } 847 | 90% { 848 | -webkit-transform: scale(1, 0.2); 849 | transform: scale(1, 0.2); 850 | } 851 | 100% { 852 | -webkit-transform: scale(1, 1); 853 | transform: scale(1, 1); 854 | } 855 | } 856 | 857 | @keyframes barUp5 { 858 | 0% { 859 | -webkit-transform: scale(1, 1); 860 | transform: scale(1, 1); 861 | } 862 | 40% { 863 | -webkit-transform: scale(1, 1); 864 | transform: scale(1, 1); 865 | } 866 | 50% { 867 | -webkit-transform: scale(1, 0.2); 868 | transform: scale(1, 0.2); 869 | } 870 | 90% { 871 | -webkit-transform: scale(1, 0.2); 872 | transform: scale(1, 0.2); 873 | } 874 | 100% { 875 | -webkit-transform: scale(1, 1); 876 | transform: scale(1, 1); 877 | } 878 | } 879 | 880 | #load { 881 | position: absolute; 882 | width: 600px; 883 | height: 36px; 884 | left: 50%; 885 | top: 40%; 886 | margin-left: -300px; 887 | overflow: visible; 888 | -webkit-user-select: none; 889 | -moz-user-select: none; 890 | -ms-user-select: none; 891 | user-select: none; 892 | cursor: default; 893 | } 894 | 895 | #load div { 896 | position: absolute; 897 | width: 20px; 898 | height: 36px; 899 | opacity: 0; 900 | font-family: Helvetica, Arial, sans-serif; 901 | animation: move 2s linear infinite; 902 | -o-animation: move 2s linear infinite; 903 | -moz-animation: move 2s linear infinite; 904 | -webkit-animation: move 2s linear infinite; 905 | transform: rotate(180deg); 906 | -o-transform: rotate(180deg); 907 | -moz-transform: rotate(180deg); 908 | -webkit-transform: rotate(180deg); 909 | color: white; 910 | } 911 | 912 | #load div:nth-child(2) { 913 | animation-delay: 0.2s; 914 | -o-animation-delay: 0.2s; 915 | -moz-animation-delay: 0.2s; 916 | -webkit-animation-delay: 0.2s; 917 | } 918 | 919 | #load div:nth-child(3) { 920 | animation-delay: 0.4s; 921 | -o-animation-delay: 0.4s; 922 | -webkit-animation-delay: 0.4s; 923 | -webkit-animation-delay: 0.4s; 924 | } 925 | 926 | #load div:nth-child(4) { 927 | animation-delay: 0.6s; 928 | -o-animation-delay: 0.6s; 929 | -moz-animation-delay: 0.6s; 930 | -webkit-animation-delay: 0.6s; 931 | } 932 | 933 | #load div:nth-child(5) { 934 | animation-delay: 0.8s; 935 | -o-animation-delay: 0.8s; 936 | -moz-animation-delay: 0.8s; 937 | -webkit-animation-delay: 0.8s; 938 | } 939 | 940 | #load div:nth-child(6) { 941 | animation-delay: 1s; 942 | -o-animation-delay: 1s; 943 | -moz-animation-delay: 1s; 944 | -webkit-animation-delay: 1s; 945 | } 946 | 947 | #load div:nth-child(7) { 948 | animation-delay: 1.2s; 949 | -o-animation-delay: 1.2s; 950 | -moz-animation-delay: 1.2s; 951 | -webkit-animation-delay: 1.2s; 952 | } 953 | 954 | @keyframes move { 955 | 0% { 956 | left: 0; 957 | opacity: 0; 958 | } 959 | 35% { 960 | left: 41%; 961 | -moz-transform: rotate(0deg); 962 | -webkit-transform: rotate(0deg); 963 | -o-transform: rotate(0deg); 964 | transform: rotate(0deg); 965 | opacity: 1; 966 | } 967 | 65% { 968 | left: 59%; 969 | -moz-transform: rotate(0deg); 970 | -webkit-transform: rotate(0deg); 971 | -o-transform: rotate(0deg); 972 | transform: rotate(0deg); 973 | opacity: 1; 974 | } 975 | 100% { 976 | left: 100%; 977 | -moz-transform: rotate(-180deg); 978 | -webkit-transform: rotate(-180deg); 979 | -o-transform: rotate(-180deg); 980 | transform: rotate(-180deg); 981 | opacity: 0; 982 | } 983 | } 984 | 985 | @-moz-keyframes move { 986 | 0% { 987 | left: 0; 988 | opacity: 0; 989 | } 990 | 35% { 991 | left: 41%; 992 | -moz-transform: rotate(0deg); 993 | transform: rotate(0deg); 994 | opacity: 1; 995 | } 996 | 65% { 997 | left: 59%; 998 | -moz-transform: rotate(0deg); 999 | transform: rotate(0deg); 1000 | opacity: 1; 1001 | } 1002 | 100% { 1003 | left: 100%; 1004 | -moz-transform: rotate(-180deg); 1005 | transform: rotate(-180deg); 1006 | opacity: 0; 1007 | } 1008 | } 1009 | 1010 | @-webkit-keyframes move { 1011 | 0% { 1012 | left: 0; 1013 | opacity: 0; 1014 | } 1015 | 35% { 1016 | left: 41%; 1017 | -webkit-transform: rotate(0deg); 1018 | transform: rotate(0deg); 1019 | opacity: 1; 1020 | } 1021 | 65% { 1022 | left: 59%; 1023 | -webkit-transform: rotate(0deg); 1024 | transform: rotate(0deg); 1025 | opacity: 1; 1026 | } 1027 | 100% { 1028 | left: 100%; 1029 | -webkit-transform: rotate(-180deg); 1030 | transform: rotate(-180deg); 1031 | opacity: 0; 1032 | } 1033 | } 1034 | 1035 | @-o-keyframes move { 1036 | 0% { 1037 | left: 0; 1038 | opacity: 0; 1039 | } 1040 | 35% { 1041 | left: 41%; 1042 | -o-transform: rotate(0deg); 1043 | transform: rotate(0deg); 1044 | opacity: 1; 1045 | } 1046 | 65% { 1047 | left: 59%; 1048 | -o-transform: rotate(0deg); 1049 | transform: rotate(0deg); 1050 | opacity: 1; 1051 | } 1052 | 100% { 1053 | left: 100%; 1054 | -o-transform: rotate(-180deg); 1055 | transform: rotate(-180deg); 1056 | opacity: 0; 1057 | } 1058 | } 1059 | 1060 | #load div { 1061 | font-size: 20px; 1062 | } 1063 | 1064 | 1065 | /*select-css*/ 1066 | 1067 | @keyframes checkIn { 1068 | 0% { 1069 | top: -1%; 1070 | height: 10px; 1071 | width: 24px; 1072 | margin-left: -12px; 1073 | } 1074 | 7% { 1075 | top: -4%; 1076 | height: 12.5px; 1077 | width: 22px; 1078 | margin-left: -11px; 1079 | } 1080 | 17% { 1081 | top: -2%; 1082 | height: 15px; 1083 | width: 12px; 1084 | margin-left: -6px; 1085 | } 1086 | 25% { 1087 | top: 20%; 1088 | height: 15px; 1089 | width: 10px; 1090 | margin-left: -5px; 1091 | } 1092 | 30% { 1093 | top: 102%; 1094 | height: 10px; 1095 | width: 28px; 1096 | margin-left: -14px; 1097 | } 1098 | 45% { 1099 | top: 50%; 1100 | height: 15px; 1101 | width: 6px; 1102 | margin-left: -3px; 1103 | margin-top: -10px; 1104 | } 1105 | 60% { 1106 | top: 50%; 1107 | height: 20px; 1108 | width: 10px; 1109 | margin-left: -5px; 1110 | } 1111 | 70% { 1112 | top: 50%; 1113 | height: 40px; 1114 | width: 40px; 1115 | margin-left: -20px; 1116 | margin-top: -20px; 1117 | } 1118 | 80% { 1119 | top: 50%; 1120 | height: 32px; 1121 | width: 32px; 1122 | margin-left: -16px; 1123 | margin-top: -16px; 1124 | } 1125 | 90% { 1126 | top: 50%; 1127 | height: 24px; 1128 | width: 24px; 1129 | margin-left: -12px; 1130 | margin-top: -12px; 1131 | } 1132 | 100% { 1133 | top: 50%; 1134 | height: 24px; 1135 | width: 24px; 1136 | margin-left: -12px; 1137 | margin-top: -12px; 1138 | } 1139 | } 1140 | 1141 | @keyframes checkOut { 1142 | 0% { 1143 | overflow: visible; 1144 | top: 50%; 1145 | width: 30px; 1146 | height: 30px; 1147 | margin-top: -17px; 1148 | margin-left: -17px; 1149 | border: 2px solid white; 1150 | opacity: 1; 1151 | } 1152 | 100% { 1153 | width: 46px; 1154 | top: 50%; 1155 | height: 46px; 1156 | margin-top: -25px; 1157 | margin-left: -25px; 1158 | border: 2px solid white; 1159 | opacity: 0; 1160 | } 1161 | } 1162 | 1163 | #container { 1164 | position: relative; 1165 | display: inline-block; 1166 | } 1167 | 1168 | input#circle-input { 1169 | display: none; 1170 | } 1171 | 1172 | input#circle-input:checked+label#circle-cont { 1173 | overflow: hidden; 1174 | } 1175 | 1176 | input#circle-input:checked+label#circle-cont #circle { 1177 | background: white; 1178 | animation: checkIn 1s forwards linear 0s 1; 1179 | } 1180 | 1181 | label#circle-cont { 1182 | border-radius: 50%; 1183 | width: 30px; 1184 | height: 30px; 1185 | border: 1px solid #FFF; 1186 | display: block; 1187 | position: relative; 1188 | float: left; 1189 | overflow: visible; 1190 | } 1191 | 1192 | label#circle-cont #circle { 1193 | background: transparent; 1194 | position: absolute; 1195 | left: 50%; 1196 | border-radius: 50%; 1197 | top: -100%; 1198 | animation: checkOut 0.25s forwards linear 0s 1; 1199 | } 1200 | 1201 | label#label-name { 1202 | color: #FFF; 1203 | font-family: 'Quicksand', sans-serif; 1204 | position: relative; 1205 | float: left; 1206 | font-size: 1.25em; 1207 | margin: 4px 12px; 1208 | } 1209 | 1210 | input#circle-input-2 { 1211 | display: none; 1212 | } 1213 | 1214 | input#circle-input-2:checked+label#circle-cont-2 { 1215 | overflow: hidden; 1216 | } 1217 | 1218 | input#circle-input-2:checked+label#circle-cont-2 #circle-2 { 1219 | background: white; 1220 | animation: checkIn 1s forwards linear 0s 1; 1221 | } 1222 | 1223 | label#circle-cont-2 { 1224 | border-radius: 50%; 1225 | width: 30px; 1226 | height: 30px; 1227 | border: 1px solid #FFF; 1228 | display: block; 1229 | position: relative; 1230 | float: left; 1231 | overflow: visible; 1232 | } 1233 | 1234 | label#circle-cont-2 #circle-2 { 1235 | background: transparent; 1236 | position: absolute; 1237 | left: 50%; 1238 | border-radius: 50%; 1239 | top: -100%; 1240 | animation: checkOut 0.25s forwards linear 0s 1; 1241 | } 1242 | 1243 | label#label-name-2 { 1244 | color: #FFF; 1245 | font-family: 'Quicksand', sans-serif; 1246 | position: relative; 1247 | float: left; 1248 | font-size: 1.25em; 1249 | margin: 4px 12px; 1250 | } 1251 | 1252 | #r3 { 1253 | font-size: 1.5em; 1254 | margin-top: 30px; 1255 | } 1256 | 1257 | form div input { 1258 | padding: 5px; 1259 | } 1260 | 1261 | #signup { 1262 | font-family: 'Quicksand', sans-serif; 1263 | border-bottom: 1px solid transparent; 1264 | padding-bottom: 2px; 1265 | transition-property: all; 1266 | transition-duration: 0.2s; 1267 | transition-timing-function: ease-in-out; 1268 | } 1269 | 1270 | #signup:hover { 1271 | border-bottom: 1px solid white; 1272 | } 1273 | 1274 | #logbutton { 1275 | width: 8vw; 1276 | font-family: 'Quicksand', sans-serif; 1277 | padding: 0.5vw; 1278 | font-size: 1.5em; 1279 | cursor: pointer; 1280 | margin-top: 40px; 1281 | margin-bottom: 10px; 1282 | box-sizing: border-box; 1283 | } 1284 | 1285 | #logbutton:hover { 1286 | transform: scale(1.1); 1287 | border: none; 1288 | } 1289 | 1290 | 1291 | /*form styles*/ 1292 | 1293 | .inputbox { 1294 | font-family: 'Quicksand', sans-serif; 1295 | background: transparent; 1296 | color: white; 1297 | border: none; 1298 | border-bottom: 1px solid white; 1299 | color: white; 1300 | font-size: 1.3em; 1301 | width: 10vw; 1302 | border-radius: 0; 1303 | text-align: center; 1304 | } 1305 | 1306 | input:focus { 1307 | outline: none; 1308 | } 1309 | 1310 | .formlabel { 1311 | font-size: 1.2em; 1312 | font-family: 'Quicksand', sans-serif; 1313 | } 1314 | 1315 | #logoutbutton { 1316 | width: 8vw; 1317 | font-family: 'Quicksand', sans-serif; 1318 | padding: 0.5vw; 1319 | font-size: 1em; 1320 | cursor: pointer; 1321 | margin-top: 40px; 1322 | margin-bottom: 10px; 1323 | box-sizing: border-box; 1324 | background: transparent; 1325 | color: white; 1326 | text-decoration: underline; 1327 | position: absolute; 1328 | right: 0; 1329 | } -------------------------------------------------------------------------------- /public/index.html.orig: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MoodMonk 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

Mood Monk

16 | 17 | 18 | 19 | 20 |
21 |
22 | 23 |
Hello there! I am here to help you destress your life
24 |
We shall talk for a little while
25 | 26 |
27 |
28 | 29 | 52 | 53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 | 65 |
66 | 67 | 68 | 69 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /public/index.js: -------------------------------------------------------------------------------- 1 | var en, hi; 2 | en = 0; 3 | hi = 0; 4 | var begin = function () { 5 | "use strict"; 6 | document.getElementById("contentwrap").className = "animated flipOutX"; 7 | document.getElementById("close").className = "animated fadeIn"; 8 | document.getElementById("Clouds").className = "hidden"; 9 | document.getElementById("mic").className = "animated fadeInUpBig"; 10 | document.body.style.backgroundImage = "none"; 11 | }; 12 | 13 | var close = function () { 14 | "use strict"; 15 | document.getElementById("controls").className = "animated fadeOut"; 16 | document.getElementById("contentwrap").className = "animated flipInX"; 17 | document.getElementById("close").className = "animated fadeOut"; 18 | document.getElementById("Clouds").className = "visible"; 19 | document.getElementById("mic").className = "animated fadeOutDownBig"; 20 | document.body.style.backgroundImage = "background-image: radial-gradient(circle, #00b5ff 0%, #26b2fa 70%, #1fd2fb 100%)"; 21 | try { 22 | if (listening) stopListening(); 23 | } catch (e) { } 24 | var html = document.getElementsByTagName('html')[0]; 25 | html.style.setProperty("--bgcolor", '#26b2fa'); 26 | }; 27 | 28 | var change = function (mood) { 29 | "use strict"; 30 | console.log('changing to ' + mood); 31 | let moodcolor, textcolor, moodtext; 32 | switch (mood) { 33 | case ("anger"): 34 | moodcolor = "#e53935"; 35 | textcolor = "white"; 36 | moodtext = "Anger"; 37 | break; 38 | case ("disgust"): 39 | moodcolor = "#2e7d32"; 40 | textcolor = "white"; 41 | moodtext = "Disgust"; 42 | break; 43 | case ("fear"): 44 | moodcolor = "#5e35b1"; 45 | textcolor = "white"; 46 | moodtext = "Fear"; 47 | break; 48 | case ("joy"): 49 | moodcolor = "#ffeb3b"; 50 | textcolor = "white"; 51 | moodtext = "Joy"; 52 | break; 53 | case ("sadness"): 54 | moodcolor = "#0d47a1"; 55 | textcolor = "white"; 56 | moodtext = "Sadness"; 57 | break; 58 | } 59 | var html = document.getElementsByTagName('html')[0]; 60 | html.style.setProperty("--bgcolor", moodcolor); 61 | var div = document.createElement('div'); 62 | document.body.appendChild(div); 63 | div.id = 'word'; 64 | document.getElementById('word').textContent = moodtext; 65 | document.getElementById('word').style.color = textcolor; 66 | document.getElementById('word').className = "animated zoomIn"; 67 | document.getElementById('word').style.opacity = 0; 68 | setTimeout(function () { 69 | $("#word").remove(); 70 | }, 2000); 71 | }; 72 | 73 | document.getElementById("start").addEventListener('click', begin); 74 | document.getElementById("close").addEventListener('click', close); 75 | 76 | var ctr = 0; 77 | document.getElementById("mic").onclick = function () { 78 | document.getElementById("controls").className = "animated fadeInUpBig"; 79 | let enRad = document.getElementById('circle-input'); 80 | let hiRad = document.getElementById('circle-input-2'); 81 | ctr = (ctr + 1) % 2; 82 | if (ctr == 0) { 83 | if (enRad.checked) currentLanguage = 'en-IN'; 84 | else if (hiRad.checked) currentLanguage = 'hi-IN'; 85 | micClicked(); 86 | } 87 | }; 88 | 89 | document.getElementById("result").onclick = function () { 90 | document.body.style.backgroundColor = "#26b2fa"; 91 | document.getElementById("mic").className = "hidden"; 92 | document.getElementById("close").className = "hidden"; 93 | document.getElementById("logomark").className = "hidden"; 94 | document.getElementById("result").classList = "hidden"; 95 | document.getElementById("loading").className = "visible"; 96 | document.getElementById("loading2").className = "visible"; 97 | document.getElementById("Clouds").style.display = "block"; 98 | setTimeout(function () { window.location = 'result.html'; }, 5000); 99 | } 100 | -------------------------------------------------------------------------------- /public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teamsudocode/moodmonk/22e2b6c3eee0a276a39472d0b5bb4958d7e489a2/public/logo.png -------------------------------------------------------------------------------- /public/main.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MoodMonk 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | <% if (loggedIn) { %> 15 |
16 |
17 | 18 | 23 |
24 | <% } %> 25 |

Mood Monk

26 | 27 | 28 | 29 | 39 | 40 | 51 | 52 | <% if (!loggedIn) { %> 53 |
54 | <% if (failed) { %> 55 | Incorrect userid/password. 56 | <% } %> 57 | 58 |
59 |
60 | 61 |
62 | 63 |
64 |
65 |
66 |
67 | 68 |
69 | 70 |
71 | 78 |
79 | 80 |

81 | Not Registered? 82 | 90 |
91 |
92 | 93 | 94 | <% } %> 95 | 96 | <% if (loggedIn) { %> 97 | 98 | 99 |
100 |
101 | 102 |
Hello there! I am here to help you destress your life
103 |
We shall talk for a little while
104 |
What do you speak?
105 |
106 | 107 | 110 | 113 | 114 | 117 | 120 |
121 | 122 |
123 |
124 | 125 | 148 | 149 | 155 | 156 | 157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 | 169 |
170 | 171 | 172 | 173 | 178 | 179 | 180 | 181 | 182 | 183 | <% } %> 184 | 185 | 186 | -------------------------------------------------------------------------------- /public/mic.js: -------------------------------------------------------------------------------- 1 | var langs = [ 2 | ['English (India)', 'en-IN'], 3 | ['Hindi', 'hi-IN'] 4 | ]; 5 | 6 | var final_transcript = ''; 7 | var current_transcript = ''; 8 | var recognition = null; 9 | var compatible = false; 10 | var listening = false; 11 | var languageSelector = null; 12 | var currentLanguage = langs[0][1]; 13 | var resultDisplay = null; 14 | 15 | 16 | function checkCompatibility() { 17 | return 'webkitSpeechRecognition' in window || 18 | 'SpeechRecognition' in window; 19 | } 20 | 21 | function setupRecognitionHandlers() { 22 | if (!recognition) { 23 | console.log("Recognition not set up. This should not happen."); 24 | return; 25 | } 26 | recognition.onstart = function() { 27 | listening = true; 28 | }; 29 | recognition.onerror = function(event) { 30 | console.log("recognition says: wtf " + event.error); 31 | }; 32 | recognition.onend = function() { 33 | if (listening && recognition) { 34 | recognition.start(); 35 | } 36 | }; 37 | recognition.onresult = function(event) { 38 | for (var i = event.resultIndex; i < event.results.length; ++i) { 39 | if (event.results[i].isFinal) { 40 | current_transcript = event.results[i][0].transcript; 41 | final_transcript += event.results[i][0].transcript + '. '; 42 | } 43 | } 44 | final_transcript = capitalize(final_transcript); 45 | askWatson(current_transcript, change); 46 | console.log(final_transcript); 47 | if (resultDisplay) 48 | resultDisplay.innerText = current_transcript; 49 | // final_span.innerHTML = linebreak(final_transcript); 50 | }; 51 | } 52 | 53 | function setupMic(micElem, outputElem, languageSelect, errorHandlerDiv) 54 | { 55 | // setup language selectors 56 | if (languageSelect) { 57 | languageSelector = languageSelect; 58 | while (languageSelect.options.length > 0) 59 | languageSelect.options.remove(0); 60 | for (let i = 0; i < langs.length; i++) 61 | languageSelect.options.add(new Option(langs[i][0], langs[i][1])); 62 | } 63 | 64 | // setup mic elem 65 | micElem.onclick = micClicked; 66 | resultDisplay = outputElem; 67 | } 68 | 69 | // function setLang() { 70 | // if (! languageSelector) { 71 | // console.log("setLang: wtf"); 72 | // return; 73 | // } 74 | // currentLanguage = langs[languageSelector.selectedIndex][1]; 75 | // } 76 | 77 | function setLang(lang) { 78 | if (lang == 'en') currentLanguage = 'en-IN'; 79 | else if (lang == 'hi') currentLanguage = 'hi-IN'; 80 | } 81 | 82 | function micClicked(event) { 83 | if (listening) { 84 | stopListening(); 85 | return; 86 | } 87 | try { 88 | if (en == 1) setLang('en'); 89 | else if (hi == 1) setLang('hi'); 90 | } catch (e) {} 91 | startListening(); 92 | } 93 | 94 | function startListening() { 95 | if (!recognition) { 96 | recognition = new webkitSpeechRecognition(); 97 | setupRecognitionHandlers(); 98 | } 99 | listening = true; 100 | final_transcript = ''; 101 | recognition.lang = currentLanguage; 102 | recognition.start(); 103 | } 104 | 105 | function stopListening() 106 | { 107 | if (recognition) 108 | listening = false; 109 | recognition = null; 110 | resultDisplay = null; 111 | } 112 | 113 | function askWatson(text, callback) { 114 | if (window.jQuery === undefined) { 115 | console.log("i need to do ajax. import jquery before me"); 116 | } 117 | if (currentLanguage == 'en-IN') 118 | $.get('/askWatson/'+encodeURIComponent(text), callback); 119 | else if (currentLanguage == 'hi-IN') { 120 | $.get('http://api.mymemory.translated.net/get?q='+current_transcript+'&langpair=hi|en', function(data) { 121 | console.log(data.responseData.translatedText); 122 | $.get('/askWatson/'+encodeURIComponent(data.responseData.translatedText), callback); 123 | }); 124 | } 125 | } 126 | 127 | var first_char = /\S/; 128 | function capitalize(s) { 129 | return s.replace(first_char, function(m) { return m.toUpperCase(); }); 130 | } 131 | -------------------------------------------------------------------------------- /public/result.css: -------------------------------------------------------------------------------- 1 | html { 2 | font-family: 'Didact Gothic', sans-serif; 3 | } 4 | 5 | .more { 6 | cursor: pointer; 7 | color: lightgrey; 8 | float: right; 9 | } 10 | 11 | .hidden { 12 | display: none; 13 | } 14 | 15 | .cardhead { 16 | display: flex; 17 | flex-direction: row; 18 | align-content: center; 19 | align-items: center; 20 | text-align: center; 21 | } 22 | 23 | .cardhead span { 24 | margin-left: 1vw; 25 | font-size: 1.5vw; 26 | } 27 | 28 | #link, 29 | #moresongs { 30 | font-size: 1vw; 31 | } 32 | 33 | #sug1 { 34 | margin-top: 1vw; 35 | margin-right: 0.5vw; 36 | } 37 | 38 | #g1, 39 | #g2, 40 | #g3 { 41 | height: 300px; 42 | display: block; 43 | } 44 | 45 | #gl1 { 46 | width: 100%; 47 | height: 300px; 48 | display: block; 49 | margin-top: 40px; 50 | } 51 | 52 | #grapharea, 53 | #suggarea { 54 | padding: 30px; 55 | } 56 | 57 | .hl { 58 | font-size: 1.8vw; 59 | font-family: 'Oswald', sans-serif; 60 | background-color: #e3f2fd; 61 | border-left: 4px solid #90caf9; 62 | color: black; 63 | } 64 | 65 | #l0 { 66 | font-size: 2.2vw; 67 | font-family: 'Didact Gothic', sans-serif; 68 | } 69 | 70 | #lorem { 71 | font-family: 'Didact Gothic', sans-serif; 72 | font-size: 1vw; 73 | color: lightgrey; 74 | } 75 | 76 | #moodi { 77 | color: orange; 78 | } 79 | 80 | .descriptors { 81 | text-align: center; 82 | font-weight: bold; 83 | } -------------------------------------------------------------------------------- /public/result.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Results 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |
18 |
Your Mood today is
19 |
Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named 20 | Duden flows by their place and supplies it with the necessary regelialia.
21 |
22 |
23 |
Detailed Report
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
Emotional analysis
32 |
Language style
33 |
Social tendencies
34 |
35 |
36 |
37 |
Stress level chart for the last week
38 |
39 |
40 |
41 |
42 |
You can try these stuff to feel better
43 |
44 | 52 |
53 |
54 | videocam 55 | Watch a Video 56 |
57 |
58 | 60 |
61 |
62 |
63 | directions_walk 64 | Suggested Activities 65 |
66 |
67 | 69 |
70 |
71 |
72 | 73 | 74 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /public/result.js: -------------------------------------------------------------------------------- 1 | var max; 2 | function getDateKey(today) { 3 | let dd = today.getDate(); 4 | let mm = today.getMonth() + 1; //January is 0! 5 | let yyyy = today.getFullYear(); 6 | return mm + '-' + dd + '-' + yyyy; 7 | } 8 | 9 | var dati = getDateKey(new Date()); 10 | $.get("/logger/day/"+dati, function (data) { 11 | document.getElementById("moodi").innerHTML = stringi(); 12 | function stringi() { 13 | max = Math.max(data.emotion_tone.anger, data.emotion_tone.disgust, data.emotion_tone.fear, data.emotion_tone.sadness, data.emotion_tone.joy); 14 | if (max == data.emotion_tone.anger) { 15 | carding("anger"); 16 | return "anger"; 17 | } 18 | if (max == data.emotion_tone.disgust) { 19 | carding("disgust"); 20 | return "disgust"; 21 | } 22 | if (max == data.emotion_tone.fear) { 23 | carding("fear"); 24 | return "fear"; 25 | } 26 | if (max == data.emotion_tone.sadness) { 27 | carding("sadness"); 28 | return "sadness"; 29 | } 30 | if (max == data.emotion_tone.joy) { 31 | carding("joy"); 32 | return "joy"; 33 | } 34 | return null; 35 | } 36 | console.log(data.social_tone.openness); 37 | var chart1 = c3.generate({ 38 | bindto: '#g1', 39 | data: { 40 | // iris data from R 41 | columns: [ 42 | 43 | ], 44 | type: 'pie', 45 | onclick: function (d, i) { 46 | console.log("onclick", d, i); 47 | }, 48 | onmouseover: function (d, i) { 49 | console.log("onmouseover", d, i); 50 | }, 51 | onmouseout: function (d, i) { 52 | console.log("onmouseout", d, i); 53 | } 54 | }, 55 | color: { 56 | pattern: ['#0d47a1', '#1976d2', '#2196f3', '#64b5f6', '#bbdefb'] 57 | }, 58 | pie: { 59 | label: { 60 | format: function (value, ratio, id) { 61 | 62 | } 63 | } 64 | } 65 | }); 66 | 67 | let updateSpeed = 500; 68 | setTimeout(function() { 69 | chart1.load({ 70 | columns: [ 71 | ["anger", data.emotion_tone.anger.toFixed(3) ] ] 72 | }); 73 | }, updateSpeed*1); 74 | 75 | setTimeout(function() { 76 | chart1.load({ 77 | columns: [ 78 | [ "fear", data.emotion_tone.fear.toFixed(3) ] 79 | ] 80 | }); 81 | }, updateSpeed*2); 82 | 83 | setTimeout(function() { 84 | chart1.load({ 85 | columns: [ 86 | ["sadness", data.emotion_tone.sadness.toFixed(3) ], 87 | ] 88 | }); 89 | }, updateSpeed*3); 90 | 91 | setTimeout(function() { 92 | chart1.load({ 93 | columns: [ 94 | ["disgust", data.emotion_tone.disgust.toFixed(3) ], 95 | ] 96 | }); 97 | }, updateSpeed*4); 98 | 99 | setTimeout(function() { 100 | chart1.load({ 101 | columns: [ 102 | ["joy", data.emotion_tone.joy.toFixed(3) ], 103 | ] 104 | }); 105 | }, updateSpeed*5); 106 | 107 | 108 | 109 | var chart2 = c3.generate({ 110 | bindto: '#g2', 111 | data: { 112 | // iris data from R 113 | columns: [ 114 | 115 | ], 116 | type: 'pie', 117 | onclick: function (d, i) { 118 | console.log("onclick", d, i); 119 | }, 120 | onmouseover: function (d, i) { 121 | console.log("onmouseover", d, i); 122 | }, 123 | onmouseout: function (d, i) { 124 | console.log("onmouseout", d, i); 125 | } 126 | }, 127 | color: { 128 | pattern: ['#0d47a1', '#1976d2', '#2196f3', '#64b5f6', '#bbdefb'] 129 | }, 130 | pie: { 131 | label: { 132 | format: function (value, ratio, id) { 133 | 134 | } 135 | } 136 | } 137 | }); 138 | 139 | setTimeout(() => { 140 | chart2.load({ 141 | columns: [ 142 | [ "analytical", data.language_tone.analytical.toFixed(3) ] 143 | ] 144 | }); 145 | }, updateSpeed*1); 146 | 147 | setTimeout(() => { 148 | chart2.load({ 149 | columns: [ 150 | ["confident", data.language_tone.confident.toFixed(3) ] 151 | ] 152 | }); 153 | }, updateSpeed*2); 154 | 155 | setTimeout(function () { 156 | chart2.load({ 157 | columns: [ 158 | ["tentative", data.language_tone.tentative.toFixed(3) ] 159 | ] 160 | }); 161 | }, updateSpeed*3); 162 | 163 | 164 | var chart3 = c3.generate({ 165 | bindto: '#g3', 166 | data: { 167 | // iris data from R 168 | columns: [ 169 | 170 | ], 171 | type: 'pie', 172 | onclick: function (d, i) { 173 | console.log("onclick", d, i); 174 | }, 175 | onmouseover: function (d, i) { 176 | console.log("onmouseover", d, i); 177 | }, 178 | onmouseout: function (d, i) { 179 | console.log("onmouseout", d, i); 180 | } 181 | }, 182 | color: { 183 | pattern: ['#0d47a1', '#1976d2', '#2196f3', '#64b5f6', '#bbdefb'] 184 | }, 185 | pie: { 186 | label: { 187 | format: function (value, ratio, id) { 188 | 189 | } 190 | } 191 | } 192 | }); 193 | 194 | setTimeout(function () { 195 | chart3.load({ 196 | columns: [ 197 | ["openness", data.social_tone.openness.toFixed(3) ] 198 | ] 199 | }); 200 | }, updateSpeed*1); 201 | 202 | setTimeout(function () { 203 | chart3.load({ 204 | columns: [ 205 | ["conscientiousness", data.social_tone.conscientiousness.toFixed(3) ] 206 | ] 207 | }); 208 | }, updateSpeed*2); 209 | 210 | setTimeout(function () { 211 | chart3.load({ 212 | columns: [ 213 | ["extraversion", data.social_tone.extraversion.toFixed(3) ] 214 | ] 215 | }); 216 | }, updateSpeed*3); 217 | 218 | setTimeout(function () { 219 | chart3.load({ 220 | columns: [ 221 | ["agreableness", data.social_tone.agreableness.toFixed(3) ] 222 | ] 223 | }); 224 | }, updateSpeed*4); 225 | 226 | setTimeout(function () { 227 | chart3.load({ 228 | columns: [ 229 | ["emotional range", data.social_tone.emotional_range.toFixed(3) ], 230 | ] 231 | }); 232 | }, updateSpeed*5); 233 | 234 | 235 | }); 236 | 237 | function c4 (p, n, x1) { 238 | 239 | var chart4 = c3.generate({ 240 | bindto: '#gl1', 241 | data: { 242 | x: 'Date', 243 | columns: [ 244 | x1, 245 | p, 246 | n 247 | ], 248 | type: 'spline' 249 | } 250 | }); 251 | } 252 | function carding(mood){ 253 | console.log(mood); 254 | $.get("/recommend/video/" + mood, function(data){ 255 | document.getElementById("vlink").innerHTML = data; 256 | document.getElementById("vlink").href = data; 257 | }); 258 | $.get("/recommend/quote/" + mood, function(data){ 259 | console.log(data); 260 | document.getElementById("qlink").innerHTML = data; 261 | }); 262 | $.get("/recommend/activity/" + mood, function(data){ 263 | document.getElementById("actlink").innerHTML = data; 264 | }); 265 | } 266 | 267 | Date.prototype.addDays = function(days) { 268 | var dat = new Date(this.valueOf()); 269 | dat.setDate(dat.getDate() + days); 270 | return dat; 271 | }; 272 | 273 | var dateOneWeekAgo = (new Date()).addDays(-7); 274 | $.get("/logger/range/"+getDateKey(dateOneWeekAgo)+"/"+dati, function(data) { 275 | 276 | // setting up positive chart 277 | var positiveData = ['Positive emotions']; 278 | var negativeData = ['Negative emotions']; 279 | var xTicks = ['Date']; 280 | console.log(data); 281 | 282 | for (let day in data) { 283 | positiveData.push(data[day].emotion_tone.joy.toFixed(3)); 284 | negativeData.push( (data[day].emotion_tone.sadness + data[day].emotion_tone.fear + 285 | data[day].emotion_tone.disgust + data[day].emotion_tone.sadness).toFixed(3) / (4) ); 286 | xTicks.push(parseInt(day.substring(2,4))); 287 | } 288 | console.log(xTicks); 289 | console.log(positiveData); 290 | console.log(negativeData); 291 | c4(positiveData,negativeData, xTicks); 292 | }); 293 | -------------------------------------------------------------------------------- /response.json: -------------------------------------------------------------------------------- 1 | { 2 | "document_tone": { 3 | "tone_categories": [ 4 | { 5 | "tones": [ 6 | { 7 | "score": 0.52071, 8 | "tone_id": "anger", 9 | "tone_name": "Anger" 10 | }, 11 | { 12 | "score": 0.086613, 13 | "tone_id": "disgust", 14 | "tone_name": "Disgust" 15 | }, 16 | { 17 | "score": 0.1711, 18 | "tone_id": "fear", 19 | "tone_name": "Fear" 20 | }, 21 | { 22 | "score": 0.116554, 23 | "tone_id": "joy", 24 | "tone_name": "Joy" 25 | }, 26 | { 27 | "score": 0.636207, 28 | "tone_id": "sadness", 29 | "tone_name": "Sadness" 30 | } 31 | ], 32 | "category_id": "emotion_tone", 33 | "category_name": "Emotion Tone" 34 | }, 35 | { 36 | "tones": [ 37 | { 38 | "score": 0.306013, 39 | "tone_id": "analytical", 40 | "tone_name": "Analytical" 41 | }, 42 | { 43 | "score": 0, 44 | "tone_id": "confident", 45 | "tone_name": "Confident" 46 | }, 47 | { 48 | "score": 0.70327, 49 | "tone_id": "tentative", 50 | "tone_name": "Tentative" 51 | } 52 | ], 53 | "category_id": "language_tone", 54 | "category_name": "Language Tone" 55 | }, 56 | { 57 | "tones": [ 58 | { 59 | "score": 0.195074, 60 | "tone_id": "openness_big5", 61 | "tone_name": "Openness" 62 | }, 63 | { 64 | "score": 0.631838, 65 | "tone_id": "conscientiousness_big5", 66 | "tone_name": "Conscientiousness" 67 | }, 68 | { 69 | "score": 0.977727, 70 | "tone_id": "extraversion_big5", 71 | "tone_name": "Extraversion" 72 | }, 73 | { 74 | "score": 0.939484, 75 | "tone_id": "agreeableness_big5", 76 | "tone_name": "Agreeableness" 77 | }, 78 | { 79 | "score": 0.778736, 80 | "tone_id": "emotional_range_big5", 81 | "tone_name": "Emotional Range" 82 | } 83 | ], 84 | "category_id": "social_tone", 85 | "category_name": "Social Tone" 86 | } 87 | ] 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var logger = require('./app/logger').logger; 4 | var bodyParser = require('body-parser'); 5 | var express = require('express'); 6 | var app = express(); 7 | var md5 = require('md5'); 8 | var cookieParser = require('cookie-parser'); 9 | 10 | 11 | var tone = require('./app/tone').tone; 12 | var recommend = require('./app/recommend'); 13 | var auth = require('./app/auth'); 14 | 15 | var session = {}; 16 | 17 | function getRandomKey(username) { 18 | let d = new Date(); 19 | return md5(d.getTime() + username); 20 | } 21 | 22 | function sessionExists(username) { 23 | let exists = false; 24 | for (let key in session) { 25 | if (session[key] === username) 26 | return true; 27 | } 28 | return exists; 29 | } 30 | 31 | function isLoggedIn(sessionId) { 32 | return session[sessionId] !== undefined; 33 | } 34 | 35 | function getUserName(sessionId) { 36 | return session[sessionId]; 37 | } 38 | 39 | app.use(cookieParser()); 40 | app.use( bodyParser.json() ); // to support JSON-encoded bodies 41 | app.use(bodyParser.urlencoded({ // to support URL-encoded bodies 42 | extended: true 43 | })); 44 | 45 | app.engine('html', require('ejs').renderFile); 46 | app.set('view engine', 'html'); 47 | app.set('views', __dirname+'/public'); 48 | 49 | app.listen(3000, function (req, res) { 50 | console.log("server started"); 51 | }); 52 | 53 | app.use(express.static('public')); 54 | 55 | /*routes*/ 56 | 57 | app.get(['/', '/index.html'], function(req, res) { 58 | res.render('main.html', { loggedIn: isLoggedIn(req.cookies.sessionId), failed: false }); 59 | // if (isLoggedIn(req.cookies.sessionId)) 60 | // res.sendFile(__dirname+'/public/main.html'); 61 | // else 62 | // res.send('fuckoff'); 63 | }); 64 | 65 | // var sampleJson = require('./response.json'); 66 | app.get('/askWatson/:query', function (req, res) { 67 | 68 | if (isLoggedIn(req.cookies.sessionId) == false) { 69 | res.send('not logged in'); 70 | } 71 | 72 | console.log(req.params.query); 73 | function myCallback(retvalue) { 74 | // console.log('received response'); 75 | logger.log(session[req.cookies.sessionId], retvalue); 76 | res.send(logger.dominantEmotion(retvalue)); 77 | console.log('response sent to client'); 78 | }; 79 | tone(req.params.query, myCallback); 80 | // myCallback(sampleJson); 81 | }); 82 | 83 | app.get('/logger/day/:date', function (req, res) { 84 | logger.getByDate(session[req.cookies.sessionId], req.params.date, (json) => { 85 | // console.log('sending back', json); 86 | console.log("/logger/date/:date : sending data to client"); 87 | res.send(json); 88 | }); 89 | // res.send(logger.getByDate(req.params.date)); 90 | }); 91 | 92 | app.get('/logger/range/:from/:to', function (req, res) { 93 | // logger.getBetweenDates('lama', req.params.from, req.params.to, function(json) { 94 | logger.getBetweenDates(session[req.cookies.sessionId], req.params.from, req.params.to, function(json) { 95 | console.log("/logger for range : sending data to client"); 96 | res.send(json); 97 | }); 98 | }); 99 | 100 | app.get('/recommend/:what/:expression', function (req, res) { 101 | // overriding recommendations due to missing api keys 102 | //res.send(200); 103 | //return; 104 | 105 | function customCallback(text) { 106 | res.send(text); 107 | } 108 | switch(req.params.what) { 109 | case 'video': recommend.getVideo(req.params.expression, customCallback); break; 110 | case 'activity': recommend.getActivities(req.params.expression, customCallback); break; 111 | case 'quote': recommend.getQuotes(req.params.expression, customCallback); break; 112 | case 'test': recommend.test(req.params.expression, customCallback); break; 113 | default : res.send('invalid'); 114 | } 115 | }); 116 | 117 | app.post('/signup', function(req, res) { 118 | let failCheck = true; 119 | console.log('signup for', req.body.userid, req.body.password, req.body.passwordConfirm); 120 | auth.signup(req.body.userid, req.body.password, (status) => { 121 | if (status) 122 | res.redirect('/'); 123 | else 124 | res.send({ 125 | "error": "User already exists" 126 | }); 127 | }) 128 | }); 129 | 130 | app.post('/login', function(req, res) { 131 | // assuming ok username and password 132 | let failCheck = true; 133 | if (!sessionExists(req.body.userid)) { 134 | auth.login(req.body.userid, req.body.password, (status) => { 135 | console.log('login status: ' + status); 136 | if (status) { 137 | let sessionId = getRandomKey(req.body.userid); 138 | session[sessionId] = req.body.userid; 139 | res.cookie('sessionId', sessionId, { expire: 3600+Date.now() }); 140 | res.render('main.html', { loggedIn: true, failed: !status }); 141 | } else { 142 | res.render('main.html', { loggedIn: false, failed: true }); 143 | } 144 | }); 145 | } 146 | }); 147 | 148 | app.get('/logout', function(req, res) { 149 | // assuming ok username and password 150 | if (req.cookies.sessionId !== 'undefined') { 151 | delete session[req.cookies.sessionId]; 152 | res.clearCookie('sessionId'); 153 | } 154 | res.render('main.html', { loggedIn: isLoggedIn(req.cookies.sessionId), failed: false }); 155 | }); -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | var script = require(__dirname+'/app/mysqlquery.js'); 2 | 3 | var ob = {userid : 1, date : 2, anger : 3, disgust : 4 , fear : 5,joy : 6,sadness : 7}; 4 | script.setEmotionTone(ob, function(obj) { 5 | console.log(obj); 6 | }); 7 | -------------------------------------------------------------------------------- /watson-cred-2.json: -------------------------------------------------------------------------------- 1 | { 2 | "url": "https://gateway.watsonplatform.net/tone-analyzer/api", 3 | "username": "0c1c95de-9ed4-48cd-9c74-b61d9597ef0f", 4 | "password": "p0mnKDXCJAG4" 5 | } 6 | --------------------------------------------------------------------------------