This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| legend: { | |
| show: true, | |
| item: { | |
| onmouseover: function(id) { | |
| if(id== "Curry") { | |
| document.getElementById('hoverImg').innerHTML = "<img src='img/curry.png' border=0/></a>"; | |
| document.getElementById("hoverImg").style.transitionDuration = "10s"; | |
| } | |
| onmouseout: function(id) { | |
| if(id== "Curry") { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| eon.chart({ | |
| channel: nbaChannel, | |
| pubnub: pubnubEon, | |
| debug: true, | |
| generate: { | |
| bindto: '#chart', | |
| data: { | |
| labels: true, | |
| type: 'donut', | |
| colors: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var nbaChannel = 'NBAChannel'; | |
| function publish2() { | |
| pubnubEon.publish({ | |
| channel: nbaChannel, | |
| message: { | |
| eon: { | |
| "Splash Bros" : numSplashWords/totalNumTweets, | |
| "Curry" : numCurryWords/totalNumTweets, | |
| "Green" : numDraymondWords/totalNumTweets, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var pubnubEon = PUBNUB.init({ | |
| subscribe_key: 'your-sub-key', | |
| publish_key: 'your-pub-key' | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function bestFans() { | |
| var fanElement = document.getElementById('scrollDiv'); | |
| var fanStr = document.createTextNode('Warriors fans are Tweeting more'); | |
| var notFanStr = document.createTextNode('Cleveland fans are Tweeting more'); | |
| var tieFanStr = document.createTextNode('Both teams\' fans are tweeting equally!'); | |
| if (numDubsTeamWords == numCavsTeamWords) { | |
| fanElement.innerHTML = tieFanStr; | |
| fanElement.appendChild(tieFanStr); | |
| } //if |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (splashWords.some(function(v) { return data.text.toLowerCase().indexOf(v) !== -1; })) { | |
| numSplashWords += 1; | |
| totalNumTweets += 1; | |
| publish2(); | |
| console.log(data); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function processData(data) { | |
| if (!data) return; | |
| if (splashWords.some(function(v) { return data.text.toLowerCase().indexOf(v) !== -1; })) { | |
| numSplashWords +=1; | |
| totalNumTweets+=1; | |
| publish2(); | |
| console.log(data); | |
| } | |
| bestFans(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var numCurryWords = 0; | |
| var numSplashWords = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var curryWords = [ | |
| 'stephen curry', 'chef curry', '#stephcurry', '#chefcurry', ‘curry’ | |
| ] | |
| var splashWords = [ | |
| 'splash brothers', 'splash bros', 'splash' | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getData() { | |
| pubnubTweet.history({ | |
| channel: channel, | |
| count: 75, | |
| callback: function(messages) { | |
| pubnubTweet.each(messages[0], processData); | |
| getStreamData(); | |
| }, | |
| error: function(error) { | |
| console.log(error); |