├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── bower.json ├── dashboard ├── ss-twitter.html └── ss-twitter.js ├── demo.gif ├── extension.js ├── graphics ├── app │ ├── twitter.html │ └── twitter.js ├── img │ ├── logo.png │ └── twitter.png ├── index.html └── style │ └── twitter.css └── package.json /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bower_components/ 2 | node_modules 3 | coverage 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 David Thomas (http://synth3.tk) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ss-twitter 2 | A standalone, 0.7.0-compatible version of the Twitter graphic from [toth3-overlay](https://github.com/TipoftheHats/toth3-overlay), which was made for [Tip of the Hats 2015](http://tipofthehats.org/). 3 | 4 | This is a [NodeCG](http://github.com/nodecg/nodecg) bundle. It cannot be run on its own, it has to be run as part of an existing NodeCG installation. Please see NodeCG's documentation for installation and setup instructions before continuing with toth3-overlay setup. 5 | 6 | ## Demo 7 | 8 | ![Demo image](demo.gif) 9 | 10 | [YouTube demo with sound effects](https://www.youtube.com/watch?v=_y1cdy95Emk) 11 | 12 | ## Installation 13 | 1. Install NodeCG (don't forget to run `npm install` from your the root of your NodeCG installation directory after you have installed it! This is what installs all of NodeCG's dependencies, which are required.) 14 | 15 | 2. Clone ss-twitter to `nodecg/bundles/ss-twitter` 16 | 17 | 3. Install lfg-sounds (required). 18 | ```sh 19 | nodecg install "supportclass/lfg-sounds#~0.1.1" 20 | ``` 21 | 22 | 4. Create `nodecg/cfg/ss-twitter.json` and `nodecg/cfg/lfg-sounds.json`. These are the necessary config files. 23 | 24 | ## Configuration 25 | The bundle's config lives at `nodecg/cfg/ss-twitter.json` and is required for the graphic to work. 26 | 27 | If you don't have Twitter credentials, you must make them before attempting to use this. Check the developer site for more info on how to register. 28 | ``` 29 | { 30 | "consumerKey": "yourConsumerKey", 31 | "consumerSecret": "yourConsumerSecret", 32 | "accessTokenKey": "yourAccessTokenKey", 33 | "accessTokenSecret": "yourAccessTokenSecret" 34 | } 35 | ``` 36 | 37 | For sounds to play, you must also put the following code into `nodecg/cfg/lfg-sounds.json`. 38 | ``` 39 | { 40 | "soundNames":[ 41 | "ss-twitter-image_in", 42 | "ss-twitter-image_out", 43 | "ss-twitter-tweet_in", 44 | "ss-twitter-tweet_out" 45 | ] 46 | } 47 | ``` 48 | 49 | ## Credits 50 | - [Alex "Lange" Van Camp](http://alexvan.camp/) - Original creator of the code 51 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ss-twitter", 3 | "dependencies": { 4 | "autosize": "~3.0.6", 5 | "gsap": "~1.16.1", 6 | "iron-image": "PolymerElements/iron-image#~1.2.2", 7 | "jquery": "~2.1.4", 8 | "numeral": "~1.5.3" 9 | } 10 | } -------------------------------------------------------------------------------- /dashboard/ss-twitter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
10 |

Preview

11 |
12 |
URL 13 | 14 |
15 |
16 | 17 |
18 |
19 |

Program

20 |
21 |
ID 22 | 23 |
24 |
Content
25 | 26 |
27 |
28 |
29 |
30 | 31 |
32 |
33 | 34 |
35 |
36 |
37 |
38 | 39 |
40 |
41 | 42 |
43 |
44 | 45 |
46 |
47 |
48 |
49 |
50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /dashboard/ss-twitter.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | var $take = $('button[command="take"]'); 4 | var $show = $('button[command="show"]'); 5 | var $hide = $('button[command="hide"]'); 6 | var $pulse = $('button[command="pulse"]'); 7 | var $preview = $('.js-preview'); 8 | var $program = $('.js-program'); 9 | 10 | var tweet = nodecg.Replicant('tweet') 11 | .on('change', function(oldVal, newVal) { 12 | $program.find('.js-id').val(newVal.id); 13 | $program.find('.js-content').val(newVal.text); 14 | }); 15 | 16 | var tweetShowing = nodecg.Replicant('tweetShowing') 17 | .on('change', function(oldVal, newVal) { 18 | $show.prop('disabled', newVal); 19 | $pulse.prop('disabled', newVal); 20 | $hide.prop('disabled', !newVal); 21 | 22 | // When this changes, disable the "take" button for a bit 23 | if ($take.data('cooldownTimer')) { 24 | clearTimeout($take.data('cooldownTimer')); 25 | } 26 | 27 | $take.prop('disabled', true); 28 | $take.data('cooldownTimer', setTimeout(function() { 29 | $take.prop('disabled', false); 30 | }, 1000)); 31 | }); 32 | 33 | nodecg.Replicant('tweetPulsing') 34 | .on('change', function(oldVal, newVal) { 35 | $hide.prop('disabled', !tweetShowing.value ? true : newVal); 36 | }); 37 | 38 | $take.click(function () { 39 | nodecg.sendMessage('getTweet', $preview.find('.js-url').val()); 40 | }); 41 | 42 | $show.click(function () { 43 | tweetShowing.value = true; 44 | }); 45 | 46 | $hide.click(function () { 47 | tweetShowing.value = false; 48 | }); 49 | 50 | $pulse.click(function () { 51 | nodecg.sendMessage('pulseTweet', $(this).data('duration')); 52 | }); 53 | })(); -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splitscreen/ss-twitter/5253be5fc1ff6514ff8145e38f6f847553c74ead/demo.gif -------------------------------------------------------------------------------- /extension.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function (nodecg) { 4 | if (!nodecg.bundleConfig) { 5 | nodecg.log.error('cfg/ss-twitter.json was not found. ' + 6 | 'This file is where the Twitter API keys are set. ' + 7 | 'Without those, the Twitter graphic cannot function.'); 8 | return; 9 | } else if (typeof nodecg.bundleConfig.consumerKey === 'undefined') { 10 | nodecg.log.error('consumerKey is not defined in cfg/ss-twitter.json! ' + 11 | 'This key (obtained from your Twitter developer account) ' + 12 | ' is required for the Twitter graphic to function.'); 13 | return; 14 | } else if (typeof nodecg.bundleConfig.consumerSecret === 'undefined') { 15 | nodecg.log.error('consumerSecret is not defined in cfg/ss-twitter.json! ' + 16 | 'This secret (obtained from your Twitter developer account) ' + 17 | ' is required for the Twitter graphic to function.'); 18 | return; 19 | } else if (typeof nodecg.bundleConfig.accessTokenKey === 'undefined') { 20 | nodecg.log.error('accessTokenKey is not defined in cfg/ss-twitter.json! ' + 21 | 'This key (obtained from your Twitter developer account) ' + 22 | ' is required for the Twitter graphic to function.'); 23 | return; 24 | } else if (typeof nodecg.bundleConfig.accessTokenSecret === 'undefined') { 25 | nodecg.log.error('accessTokenSecret is not defined in cfg/ss-twitter.json! ' + 26 | 'This secret (obtained from your Twitter developer account) ' + 27 | ' is required for the Twitter graphic to function.'); 28 | return; 29 | } 30 | 31 | var Twitter = require('twitter'); 32 | var twitter = new Twitter({ 33 | consumer_key: nodecg.bundleConfig.consumerKey, 34 | consumer_secret: nodecg.bundleConfig.consumerSecret, 35 | access_token_key: nodecg.bundleConfig.accessTokenKey, 36 | access_token_secret: nodecg.bundleConfig.accessTokenSecret 37 | }); 38 | 39 | var tweetShowing = nodecg.Replicant('tweetShowing', {defaultValue: false, persistent: false}); 40 | var tweetPulsing = nodecg.Replicant('tweetPulsing', {defaultValue: false, persistent: false}); 41 | var tweet = nodecg.Replicant('tweet', {defaultValue: {}}); 42 | 43 | nodecg.listenFor('getTweet', function(url) { 44 | var id = url.split('/').pop(); 45 | twitter.get('statuses/show', {id: id, include_my_retweet: false}, function(error, tw){ 46 | if (error) { 47 | nodecg.log.error('Couldn\'t get tweet:', error[0].message); 48 | return; 49 | } 50 | 51 | tweet.value = tw; 52 | }); 53 | }); 54 | 55 | nodecg.listenFor('pulseTweet', function pulse(duration) { 56 | // Don't stack pulses 57 | if (tweetPulsing.value) return; 58 | 59 | tweetShowing.value = true; 60 | tweetPulsing.value = true; 61 | 62 | // End pulse after "duration" seconds 63 | setTimeout(function() { 64 | tweetShowing.value = false; 65 | tweetPulsing.value = false; 66 | }, duration * 1000); 67 | }); 68 | }; 69 | -------------------------------------------------------------------------------- /graphics/app/twitter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 97 | 98 | 99 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /graphics/app/twitter.js: -------------------------------------------------------------------------------- 1 | /* global TweenLite, Power1 */ 2 | (function() { 3 | 'use strict'; 4 | 5 | createjs.Sound.volume = 0; 6 | 7 | console.log(createjs.Sound.volume); 8 | 9 | setTimeout(function() { 10 | //TweenLite.to(createjs.Sound, 0.5, {volume: 1}); 11 | }, 1000); 12 | 13 | nodecg.Replicant('mainShowing', {defaultValue: true}).on('change', function(oldVal, newVal) { 14 | if (newVal) { 15 | TweenLite.to(document.body, 0.6, {opacity: 1, ease: Power1.easeInOut}); 16 | } else { 17 | TweenLite.to(document.body, 0.6, {opacity: 0, ease: Power1.easeInOut}); 18 | } 19 | }); 20 | })(); -------------------------------------------------------------------------------- /graphics/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splitscreen/ss-twitter/5253be5fc1ff6514ff8145e38f6f847553c74ead/graphics/img/logo.png -------------------------------------------------------------------------------- /graphics/img/twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splitscreen/ss-twitter/5253be5fc1ff6514ff8145e38f6f847553c74ead/graphics/img/twitter.png -------------------------------------------------------------------------------- /graphics/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 |
13 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /graphics/style/twitter.css: -------------------------------------------------------------------------------- 1 | body { margin: 0; opacity: 0;} 2 | 3 | #container { 4 | position: absolute; 5 | width: 1920px; 6 | height: 1080px; 7 | overflow: hidden; 8 | font-family: 'Open Sans', sans-serif; 9 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ss-twitter", 3 | "version": "0.0.0", 4 | "description": "A NodeCG bundle to display Tweets", 5 | "dependencies": { 6 | "numeral": "^1.5.3", 7 | "q": "^1.4.1", 8 | "request": "^2.61.0", 9 | "twitter": "^1.2.5" 10 | }, 11 | "homepage": "http://splitscreenshow.com/open-source/", 12 | "author": { 13 | "name": "David Thomas", 14 | "email": "guy@synth3.tk", 15 | "url": "http://synth3.tk" 16 | }, 17 | "files": [ 18 | "dashboard", 19 | "graphics", 20 | "extension.js", 21 | "extension" 22 | ], 23 | "keywords": [ 24 | "nodecg", 25 | "nodecg-bundle", 26 | "twitter" 27 | ], 28 | "nodecg": { 29 | "compatibleRange": "~0.7.0", 30 | "dashboardPanels": [ 31 | { 32 | "name": "ss-twitter", 33 | "title": "Twitter", 34 | "width": 4, 35 | "file": "ss-twitter.html", 36 | "headerColor": "#55acee" 37 | } 38 | ], 39 | "graphics": [ 40 | { 41 | "file": "index.html", 42 | "width": 1280, 43 | "height": 720 44 | } 45 | ] 46 | }, 47 | "repository": "https://github.com/nodecg/nodecg.git", 48 | "license": "MIT" 49 | } 50 | --------------------------------------------------------------------------------