├── .meteor ├── .finished-upgraders ├── .gitignore ├── .id ├── packages ├── platforms ├── release └── versions ├── README.md ├── thebutton.css ├── thebutton.html ├── thebutton.js └── thebutton.png /.meteor/.finished-upgraders: -------------------------------------------------------------------------------- 1 | # This file contains information which helps Meteor properly upgrade your 2 | # app when you run 'meteor update'. You should check it into version control 3 | # with your project. 4 | 5 | notices-for-0.9.0 6 | notices-for-0.9.1 7 | 0.9.4-platform-file 8 | notices-for-facebook-graph-api-2 9 | -------------------------------------------------------------------------------- /.meteor/.gitignore: -------------------------------------------------------------------------------- 1 | local 2 | -------------------------------------------------------------------------------- /.meteor/.id: -------------------------------------------------------------------------------- 1 | # This file contains a token that is unique to your project. 2 | # Check it into your repository along with the rest of this directory. 3 | # It can be used for purposes such as: 4 | # - ensuring you don't accidentally deploy one app on top of another 5 | # - providing package authors with aggregated statistics 6 | 7 | ali0ss1by812p14g4kz6 8 | -------------------------------------------------------------------------------- /.meteor/packages: -------------------------------------------------------------------------------- 1 | # Meteor packages used by this project, one per line. 2 | # Check this file (and the other files in this directory) into your repository. 3 | # 4 | # 'meteor add' and 'meteor remove' will edit this file for you, 5 | # but you can also edit it by hand. 6 | 7 | meteor-platform 8 | reactive-var 9 | accounts-ui 10 | accounts-password 11 | d3 12 | momentjs:moment 13 | -------------------------------------------------------------------------------- /.meteor/platforms: -------------------------------------------------------------------------------- 1 | server 2 | browser 3 | -------------------------------------------------------------------------------- /.meteor/release: -------------------------------------------------------------------------------- 1 | METEOR@1.1.0.2 2 | -------------------------------------------------------------------------------- /.meteor/versions: -------------------------------------------------------------------------------- 1 | accounts-base@1.2.0 2 | accounts-password@1.1.1 3 | accounts-ui@1.1.5 4 | accounts-ui-unstyled@1.1.7 5 | autoupdate@1.2.1 6 | base64@1.0.3 7 | binary-heap@1.0.3 8 | blaze@2.1.2 9 | blaze-tools@1.0.3 10 | boilerplate-generator@1.0.3 11 | callback-hook@1.0.3 12 | check@1.0.5 13 | d3@1.0.0 14 | ddp@1.1.0 15 | deps@1.0.7 16 | ejson@1.0.6 17 | email@1.0.6 18 | fastclick@1.0.3 19 | geojson-utils@1.0.3 20 | html-tools@1.0.4 21 | htmljs@1.0.4 22 | http@1.1.0 23 | id-map@1.0.3 24 | jquery@1.11.3_2 25 | json@1.0.3 26 | launch-screen@1.0.2 27 | less@1.0.14 28 | livedata@1.0.13 29 | localstorage@1.0.3 30 | logging@1.0.7 31 | meteor@1.1.6 32 | meteor-platform@1.2.2 33 | minifiers@1.1.5 34 | minimongo@1.0.8 35 | mobile-status-bar@1.0.3 36 | momentjs:moment@2.10.2 37 | mongo@1.1.0 38 | npm-bcrypt@0.7.8_2 39 | observe-sequence@1.0.6 40 | ordered-dict@1.0.3 41 | random@1.0.3 42 | reactive-dict@1.1.0 43 | reactive-var@1.0.5 44 | reload@1.1.3 45 | retry@1.0.3 46 | routepolicy@1.0.5 47 | service-configuration@1.0.4 48 | session@1.1.0 49 | sha@1.0.3 50 | spacebars@1.0.6 51 | spacebars-compiler@1.0.6 52 | srp@1.0.3 53 | templating@1.1.1 54 | tracker@1.0.7 55 | ui@1.0.6 56 | underscore@1.0.3 57 | url@1.0.4 58 | webapp@1.2.0 59 | webapp-hashing@1.0.3 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Build your own /r/thebutton 2 | 3 |  4 | 5 | This is the codebase accompanying the article [Build Your Own /r/thebutton](https://medium.com/@Rahul/build-your-own-r-thebutton-with-meteor-d4b878fbb0d2) and the [demo](http://thebutton.meteor.com). It's not intended as a full reproduction of Reddit's experiment, but as an educational exploration of what kind of approach one can use to build something like The Button. I plan to use this in Meteor workshops in the future. 6 | 7 | Leave me any feedback here in the issues or on [Twitter](http://twitter.com/rahul). 8 | 9 | # License 10 | 11 | WTFPL. 12 | -------------------------------------------------------------------------------- /thebutton.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-size: 14px; 3 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 4 | font-weight: 200; 5 | margin: 3rem 2rem; 6 | line-height: 1.5; 7 | } 8 | 9 | nav { 10 | display: flex; 11 | align-items: center; 12 | justify-content: space-between; 13 | width: 600px; 14 | text-align: right; 15 | margin: 1rem auto; 16 | } 17 | 18 | .thebutton-container { 19 | display: flex; 20 | width: 600px; 21 | padding: 2rem; 22 | margin: 0 auto; 23 | background: #f9f9f9; 24 | border: solid 1px #ccc; 25 | box-shadow: 0 2px 5px rgba(0,0,0,.2); 26 | align-items: center; 27 | } 28 | 29 | .thebutton-container > div { 30 | flex: 1; 31 | text-align: center; 32 | } 33 | 34 | .thebutton-countdown { 35 | padding: 1rem 0; 36 | background: #eee; 37 | font-size: 24px; 38 | font-family: monospace; 39 | border-radius: 4px; 40 | box-shadow: inset 0 2px 1px rgba(0,0,0,.1); 41 | } 42 | 43 | .thebutton-countdown span { 44 | background: white; 45 | border-radius: 4px; 46 | padding: .4rem; 47 | padding-bottom: .2rem; 48 | box-shadow: inset 0 1px 2px rgba(0,0,0,.3); 49 | } 50 | .countdown-100ms, .countdown-10ms { color: #999;} 51 | 52 | span[class^='remaining-'] { 53 | color: white; 54 | padding: 2px 4px; 55 | border-radius: 4px; 56 | } 57 | span[class^='remaining-5'] { background: purple; } 58 | span[class^='remaining-4'] { background: brown; } 59 | span[class^='remaining-3'] { background: green; } 60 | span[class^='remaining-2'] { background: #ffd100; } 61 | span[class^='remaining-1'] { background: #69f; } 62 | span[class^='remaining-0'] { background: hotpink; } 63 | 64 | button { 65 | cursor: pointer; 66 | font-size: 14px; 67 | padding: 1.2rem; 68 | text-align: center; 69 | width: 150px; 70 | border-radius: 4px; 71 | border: solid 1px #69c; 72 | background: #3E9EFF -webkit-linear-gradient(top, #3E9EFF, #2276CA); 73 | color: #999; 74 | -webkit-font-smoothing: antialiased; 75 | box-shadow: 0 2px 2px rgba(0,0,0,.5), inset 0 -3px 0 rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.2); 76 | -webkit-transition: ease .25s; 77 | } 78 | button:hover { 79 | border-color: #369; 80 | background: #3E9EFF; 81 | box-shadow: 0 1px 5px rgba(0,0,0,.5), inset 0 -3px 0 rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.2); 82 | } 83 | button:focus { 84 | margin-top: 2px; 85 | outline: none; 86 | box-shadow: inset 0 1px rgba(0,0,0,.2); 87 | } 88 | button:disabled { 89 | background: #ccc; 90 | border-color: #bbb; 91 | cursor: default; 92 | box-shadow: none; 93 | } 94 | 95 | .thebutton-piechart-container { 96 | margin: 0 auto; 97 | width: 120px; 98 | height: 120px; 99 | border-radius: 50%; 100 | background: #eee; 101 | box-shadow: inset 0 2px 1px rgba(0,0,0,.1); 102 | } 103 | .thebutton-piechart { 104 | width: 120px; 105 | height: 120px; 106 | } 107 | 108 | .what-is-this { 109 | width: 600px; 110 | margin: 5rem auto 0 auto; 111 | text-align: center; 112 | } -------------------------------------------------------------------------------- /thebutton.html: -------------------------------------------------------------------------------- 1 |
2 |22 | Made by @Rahul with Meteor. 23 |
24 |25 | 26 | 27 |
28 |