├── .gitignore
├── .htaccess
├── LICENSE
├── README.md
├── app
├── code
│ └── KudosPlease.php
├── etc
│ └── config_example.php
└── index.php
├── config.rb
├── css
├── _vars.scss
├── assets
│ ├── _animations.scss
│ ├── _assets.scss
│ ├── _crystallo.scss
│ ├── _fonts.scss
│ ├── _helper.scss
│ ├── _iconfont.scss
│ ├── _keyframes.sass
│ ├── _kudosplease.scss
│ └── _prism.scss
├── kudosplease.css
├── kudosplease.scss
├── style.css
└── style.scss
├── img
├── blackorchid.png
├── blackorchid_@2X.jpg
├── darkocean.jpg
├── kudosplease.ico
├── kudosplease_1337.png
├── kudosplease_200.jpg
├── winter_sunrise.jpg
└── winter_sunrise_300.jpg
├── index.php
└── js
├── bundle.sh
├── bundle_all.sh
├── kudosplease-min.js
├── kudosplease.js
├── main-min.js
├── main.js
└── prism.js
/.gitignore:
--------------------------------------------------------------------------------
1 | .sass-cache/
2 | sftp-config.json
3 | config.php
4 |
5 |
--------------------------------------------------------------------------------
/.htaccess:
--------------------------------------------------------------------------------
1 |
2 |
3 | Header set Access-Control-Allow-Origin "*"
4 |
5 |
6 |
7 |
8 | RewriteEngine On
9 |
10 | RewriteBase /
11 |
12 | RewriteCond %{HTTP_HOST} ^api\.
13 | RewriteCond %{REQUEST_FILENAME} !-f
14 | RewriteRule (.*) /app/index.php$1 [L]
15 |
16 | # %{HTTP_HOST} ^/api
17 | #RewriteCond %{REQUEST_URI} !/api/$ [NC]
18 | #RewriteCond %{REQUEST_FILENAME} !-f
19 | #RewriteRule (.*) /api/$1 [L]
20 |
21 |
22 |
23 |
24 |
25 |
26 | # Compression
27 | AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/javascript
28 |
29 |
30 |
31 |
32 |
33 |
34 | ## Expire after some time
35 |
36 | ExpiresActive on
37 | ExpiresDefault "access plus 1 month"
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Tim Pietrusky
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 all
13 | 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 THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Kudos Please
2 |
3 | A simple Kudos widget with no dependencies. And it's free.
4 |
5 | [kudosplease.com](http://kudosplease.com)
6 |
7 | [](http://codepen.io/TimPietrusky/pen/acBCf)
8 |
9 | ## Examples
10 |
11 | * [Kudos Please](http://codepen.io/TimPietrusky/pen/acBCf)
12 | * [Tell us something about you](http://codepen.io/TimPietrusky/pen/Kazcy)
13 |
14 | ---
15 |
16 | Handcrafted 2013 by [@TimPietrusky](http://twitter.com/TimPietrusky) in Germany.
--------------------------------------------------------------------------------
/app/code/KudosPlease.php:
--------------------------------------------------------------------------------
1 | loadConfig();
15 |
16 | // Get the current request
17 | $this->request = $_SERVER['REQUEST_METHOD'];
18 |
19 |
20 | // Parameter "url" is set
21 | if (isset($_GET['url'])) {
22 | $this->url = urldecode($_GET['url']);
23 |
24 | // Connect to the database
25 | $this->connect();
26 |
27 | // Call methods in dependence on the request
28 | switch ($this->request) {
29 | case 'GET' : $this->get();
30 | break;
31 |
32 | case 'POST' : $this->post();
33 | break;
34 | }
35 | }
36 |
37 | // Generate the output
38 | $this->output();
39 | }
40 |
41 | /*
42 | * Loads the configuration.
43 | */
44 | protected function loadConfig() {
45 | $path = 'etc/config.php';
46 |
47 | if (file_exists($path)) {
48 | require_once($path);
49 | $this->config = $config;
50 | } else {
51 | die("Please copy the 'etc/config_sample.php' into 'etc/config.php' and change the configuration.");
52 | }
53 | }
54 |
55 | /*
56 | * Connect to the database.
57 | */
58 | protected function connect() {
59 | // Connect
60 | $this->mysqli = new mysqli($this->config->db->host, $this->config->db->user, $this->config->db->password, $this->config->db->database);
61 |
62 | // Handle error
63 | if (mysqli_connect_error()) {
64 | die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
65 | }
66 |
67 | // Escape input
68 | $this->url = $this->mysqli->real_escape_string($this->url);
69 | }
70 |
71 | /*
72 | * Generate the output with header.
73 | */
74 | protected function output() {
75 | header('Content-type: text/plain');
76 | echo($this->output);
77 | exit(0);
78 | }
79 |
80 | /*
81 | * Returns the current Kudos amount.
82 | */
83 | public function get() {
84 | $result = $this->mysqli->query('SELECT * FROM kudosplease where url = \'' . $this->url . '\'');
85 | $row = mysqli_fetch_object($result);
86 |
87 | // Create new row for the unkown url
88 | if (empty($row->kudos)) {
89 | $this->mysqli->query('INSERT IGNORE INTO kudosplease (url, kudos) VALUES (\'' . $this->url . '\', 0)');
90 | $this->output = 0;
91 |
92 | // Show the amount
93 | } else {
94 | $this->output = $row->kudos;
95 | }
96 | }
97 |
98 | /*
99 | * Increase the Kudos amount and return the new amount.
100 | */
101 | public function post() {
102 | $this->mysqli->query('UPDATE kudosplease SET kudos = kudos + 1 WHERE url = \'' . $this->url . '\'');
103 | $this->get();
104 | }
105 | }
106 |
107 | ?>
--------------------------------------------------------------------------------
/app/etc/config_example.php:
--------------------------------------------------------------------------------
1 | array(
4 | 'host' => 'localhost',
5 | 'user' => '',
6 | 'password' => '',
7 | 'database' => '',
8 | )
9 | );
10 |
11 | function array_to_object($array) {
12 | $obj = new stdClass;
13 | foreach($array as $k => $v) {
14 | if(is_array($v)) {
15 | $obj->{$k} = array_to_object($v);
16 | } else {
17 | $obj->{$k} = $v;
18 | }
19 | }
20 | return $obj;
21 | }
22 |
23 | $config = array_to_object($config);
24 | ?>
--------------------------------------------------------------------------------
/app/index.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/config.rb:
--------------------------------------------------------------------------------
1 | # Require any additional compass plugins here.
2 |
3 | # Set this to the root of your project when deployed:
4 | http_path = "/"
5 | css_dir = "css"
6 | sass_dir = "css"
7 | images_dir = "img"
8 | javascripts_dir = "js"
9 |
10 | # You can select your preferred output style here (can be overridden via the command line):
11 | # output_style = :expanded or :nested or :compact or :compressed
12 | output_style = :compressed
13 |
14 | # To enable relative paths to assets via compass helper functions. Uncomment:
15 | # relative_assets = true
16 |
17 | # To disable debugging comments that display the original location of your selectors. Uncomment:
18 | line_comments = false
19 |
20 |
21 | # If you prefer the indented syntax, you might want to regenerate this
22 | # project again passing --syntax sass, or you can uncomment this:
23 | # preferred_syntax = :sass
24 | # and then run:
25 | # sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
26 |
--------------------------------------------------------------------------------
/css/_vars.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * Colors
3 | */
4 | $color-alpha: #fd625e; // red
5 | $color-beta: #3eddc9; // cyan
6 | $color-gamma: #824d77; // purple
7 | $color-delta: darken(#d9d3bb, 10%); // grey
8 | $color-epsilon: #f3f1e2; // light grey
9 |
10 | /*
11 | * crystallo
12 | *
13 | * Padding for the columns (section > div)
14 | */
15 | $crystallo-padding: .5em;
16 |
17 | $crystallo-padding-top: $crystallo-padding;
18 | $crystallo-padding-right: $crystallo-padding;
19 | $crystallo-padding-bottom: $crystallo-padding;
20 | $crystallo-padding-left: $crystallo-padding;
--------------------------------------------------------------------------------
/css/assets/_animations.scss:
--------------------------------------------------------------------------------
1 | @import "compass/css3/_shared", "_keyframes";
2 |
3 | $default-animation-name: none;
4 | $default-animation-duration: 0;
5 | $default-animation-timing-function: ease;
6 | $default-animation-iteration-count: 1;
7 | $default-animation-direction: normal;
8 | $default-animation-play-state: running;
9 | $default-animation-delay: 0;
10 | $default-animation-fill-mode: none;
11 |
12 | @mixin animation-name(
13 | $name-1: $default-animation-name,
14 | $name-2: false,
15 | $name-3: false,
16 | $name-4: false,
17 | $name-5: false,
18 | $name-6: false,
19 | $name-7: false,
20 | $name-8: false,
21 | $name-9: false,
22 | $name-10: false
23 | ) {
24 | $name: compact($name-1, $name-2, $name-3, $name-4, $name-5, $name-6, $name-7, $name-8, $name-9, $name-10);
25 | @include experimental(animation-name, $name);
26 | }
27 |
28 | @mixin animation-duration(
29 | $duration-1: $default-animation-duration,
30 | $duration-2: false,
31 | $duration-3: false,
32 | $duration-4: false,
33 | $duration-5: false,
34 | $duration-6: false,
35 | $duration-7: false,
36 | $duration-8: false,
37 | $duration-9: false,
38 | $duration-10: false
39 | ) {
40 | $duration: compact($duration-1, $duration-2, $duration-3, $duration-4, $duration-5, $duration-6, $duration-7, $duration-8, $duration-9, $duration-10);
41 | @include experimental(animation-duration, $duration);
42 | }
43 |
44 | @mixin animation-timing-function(
45 | $timing-function-1: $default-animation-timing-function,
46 | $timing-function-2: false,
47 | $timing-function-3: false,
48 | $timing-function-4: false,
49 | $timing-function-5: false,
50 | $timing-function-6: false,
51 | $timing-function-7: false,
52 | $timing-function-8: false,
53 | $timing-function-9: false,
54 | $timing-function-10: false
55 | ) {
56 | $timing-function: compact($timing-function-1, $timing-function-2, $timing-function-3, $timing-function-4, $timing-function-5, $timing-function-6, $timing-function-7, $timing-function-8, $timing-function-9, $timing-function-10);
57 | @include experimental(animation-timing-function, $timing-function);
58 | }
59 |
60 | @mixin animation-iteration-count(
61 | $iteration-count-1: $default-animation-count,
62 | $iteration-count-2: false,
63 | $iteration-count-3: false,
64 | $iteration-count-4: false,
65 | $iteration-count-5: false,
66 | $iteration-count-6: false,
67 | $iteration-count-7: false,
68 | $iteration-count-8: false,
69 | $iteration-count-9: false,
70 | $iteration-count-10: false
71 | ) {
72 | $iteration-count: compact($iteration-count-1, $iteration-count-2, $iteration-count-3, $iteration-count-4, $iteration-count-5, $iteration-count-6, $iteration-count-7, $iteration-count-8, $iteration-count-9, $iteration-count-10);
73 | @include experimental(animation-iteration-count, $iteration-count);
74 | }
75 |
76 | @mixin animation-direction(
77 | $direction-1: $default-animation-direction,
78 | $direction-2: false,
79 | $direction-3: false,
80 | $direction-4: false,
81 | $direction-5: false,
82 | $direction-6: false,
83 | $direction-7: false,
84 | $direction-8: false,
85 | $direction-9: false,
86 | $direction-10: false
87 | ) {
88 | $direction: compact($direction-1, $direction-2, $direction-3, $direction-4, $direction-5, $direction-6, $direction-7, $direction-8, $direction-9, $direction-10);
89 | @include experimental(animation-direction, $direction);
90 | }
91 |
92 | @mixin animation-play-state(
93 | $play-state-1: $default-animation-play-state,
94 | $play-state-2: false,
95 | $play-state-3: false,
96 | $play-state-4: false,
97 | $play-state-5: false,
98 | $play-state-6: false,
99 | $play-state-7: false,
100 | $play-state-8: false,
101 | $play-state-9: false,
102 | $play-state-10: false
103 | ) {
104 | $play-state: compact($play-state-1, $play-state-2, $play-state-3, $play-state-4, $play-state-5, $play-state-6, $play-state-7, $play-state-8, $play-state-9, $play-state-10);
105 | @include experimental(animation-play-state, $play-state);
106 | }
107 |
108 | @mixin animation-delay(
109 | $delay-1: $default-animation-delay,
110 | $delay-2: false,
111 | $delay-3: false,
112 | $delay-4: false,
113 | $delay-5: false,
114 | $delay-6: false,
115 | $delay-7: false,
116 | $delay-8: false,
117 | $delay-9: false,
118 | $delay-10: false
119 | ) {
120 | $delay: compact($delay-1, $delay-2, $delay-3, $delay-4, $delay-5, $delay-6, $delay-7, $delay-8, $delay-9, $delay-10);
121 | @include experimental(animation-delay, $delay);
122 | }
123 |
124 | @mixin animation(
125 | $animation-1: default,
126 | $animation-2: false,
127 | $animation-3: false,
128 | $animation-4: false,
129 | $animation-5: false,
130 | $animation-6: false,
131 | $animation-7: false,
132 | $animation-8: false,
133 | $animation-9: false,
134 | $animation-10: false
135 | ) {
136 | @if $animation-1 == default {
137 | $animation-1: -compass-space-list(compact($default-animation-name, $default-animation-duration, $default-animation-timing-function, $default-animation-delay, $default-animation-iteration-count, $default-animation-direction, $default-animation-fill-mode))
138 | }
139 |
140 | $animation: compact($animation-1, $animation-2, $animation-3, $animation-4, $animation-5, $animation-6, $animation-7, $animation-8, $animation-9, $animation-10);
141 | @include experimental(animation, $animation);
142 | }
143 |
144 | // Simple animation with named arguments
145 | @mixin animation-simple(
146 | $name: $default-animation-name,
147 | $duration: $default-animation-duration,
148 | $timing-function: $default-animation-timing-function,
149 | $delay: $default-animation-delay,
150 | $iteration-count: $default-animation-iteration-count,
151 | $direction: $default-animation-direction
152 | ) {
153 | @include experimental(animation, $name $duration $timing-function $delay $iteration-count $direction);
154 | }
155 |
156 | // This one is from https://developer.mozilla.org/en/CSS/animation-fill-mode
157 | @mixin animation-fill-mode($fill-mode) {
158 | @include experimental(animation-fill-mode, $fill-mode);
159 | }
160 |
--------------------------------------------------------------------------------
/css/assets/_assets.scss:
--------------------------------------------------------------------------------
1 | /**
2 | * Compass imports
3 | */
4 | @import "compass/css3/images";
5 | @import "compass/css3";
6 | @import "compass/css3/user-interface";
7 | @import "compass/css3/filter";
8 |
9 | /**
10 | * Random imports
11 | */
12 | @import "vars",
13 | "helper",
14 | "crystallo",
15 | "keyframes",
16 | "animations",
17 | "fonts",
18 | "kudosplease",
19 | "prism";
--------------------------------------------------------------------------------
/css/assets/_crystallo.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * crystallo
3 | * ultra responsive to be a responsive css framework.
4 | *
5 | * crystallo is a solid & simple responsive (not yet) framework
6 | * to help you kick-start any form of web application.
7 | *
8 | * Get it here
9 | * http://github.com/TimPietrusky/crystallo
10 | *
11 | * 2012 by Tim Pietrusky
12 | * http://timpietrusky.com
13 | */
14 |
15 | *,
16 | *:before,
17 | *:after {
18 | @include box-sizing(border-box);
19 | }
20 |
21 |
22 | html,
23 | body {
24 | margin:0;
25 | padding:0;
26 | height:100%;
27 | width:100%;
28 | }
29 |
30 | body {
31 | overflow-x: hidden;
32 | $breakpoints: 860, 1024, 1152, 1280, 1400, 1600, 2048, 3200, 4000;
33 | @each $breakpoint in $breakpoints {
34 | &[data-max-width="#{$breakpoint}"] section[data-cols] {
35 | max-width: $breakpoint+px;
36 | }
37 |
38 | @if $breakpoint > 1500 {
39 | @media screen and (min-width: $breakpoint+px) {
40 | &[data-auto-extend="true"] section[data-cols] {
41 | max-width: $breakpoint+px;
42 | }
43 | }
44 | }
45 | }
46 | }
47 |
48 | button {
49 | width:100%;
50 | cursor:pointer;
51 | }
52 |
53 | img {
54 | max-width:100%;
55 | }
56 |
57 | article {
58 | position:relative;
59 | margin-top:1em;
60 | }
61 |
62 | section {
63 | position:relative;
64 | overflow: hidden;
65 | margin:0 auto;
66 |
67 | > div {
68 | height:100%;
69 | margin:0;
70 | padding: $crystallo-padding-top $crystallo-padding-right $crystallo-padding-bottom $crystallo-padding-left;
71 | }
72 | }
73 |
74 | /*
75 | * vertical-align: center
76 | */
77 | section[data-valign='center'] {
78 | display:block;
79 | }
80 |
81 | section[data-valign='center'] > div,
82 | section[data-valign='center'] > div + * {
83 | display: table-cell;
84 | vertical-align: middle;
85 | }
86 |
87 | /* pseudo elements default stuff */
88 | article[data-high]:before,
89 | article[data-high]:after,
90 | article[data-text]:before,
91 | article[data-text]:after,
92 | pre[data-text]:before,
93 | pre[data-text]:after {
94 | content:'';
95 | position:absolute;
96 | top:0;
97 | left:0;
98 | }
99 |
100 | /*
101 | * 1 column
102 | */
103 | section[data-cols='1'] {
104 | > div {
105 | display:block;
106 | }
107 | }
108 |
109 | /*
110 | * 2 columns
111 | */
112 | section[data-cols='2'] {}
113 |
114 | /* big screens */
115 | @media screen and (min-width: 44em) {
116 | section[data-cols='2'] > div,
117 | section[data-cols='3'] > div,
118 | section[data-cols='4'] > div,
119 | section[data-cols='5'] > div,
120 | section[data-cols='5'] > div:nth-child(4),
121 | section[data-cols='5'] > div:nth-child(5) {
122 | float: left;
123 | width: 50%;
124 | }
125 |
126 | section[data-cols='2'] > div:nth-child(odd) {
127 | clear:both;
128 | }
129 |
130 | section[data-cols='3'] > div:last-child,
131 | section[data-cols='5'] > div:last-child {
132 | width: 100%;
133 | }
134 | }
135 |
136 | /*
137 | * 3 columns
138 | */
139 | section[data-cols='3'] {}
140 |
141 | /* big screens */
142 | @media screen and (min-width: 66em) {
143 | section[data-cols='3'] > div,
144 | section[data-cols='4'] > div,
145 | section[data-cols='5'] > div {
146 | width: 33.3%;
147 | }
148 |
149 | section[data-cols='3'] > div:last-child {
150 | width: 33.3%;
151 | }
152 |
153 | section[data-cols='5'] > div:nth-child(5) {
154 | width: 50%;
155 | }
156 |
157 | section[data-cols='4'] > div:last-child {
158 | width: 100%;
159 | }
160 | }
161 |
162 | /*
163 | * 4 columns
164 | */
165 | section[data-cols='4'] {}
166 |
167 | /* big screens */
168 | @media screen and (min-width: 74em) {
169 | section[data-cols='4'] > div,
170 | section[data-cols='4'] > div:last-child {
171 | width: 25%;
172 | }
173 |
174 | section[data-cols='4'] > div:nth-child(4n+1) {
175 | clear: both;
176 | }
177 | }
178 |
179 | /*
180 | * 5 columns
181 | */
182 | section[data-cols='5'] {}
183 |
184 | /* big screens */
185 | @media screen and (min-width: 80em) {
186 | section[data-cols='5'] > div,
187 | section[data-cols='5'] > div:last-child,
188 | section[data-cols='5'] > div:nth-child(4) {
189 | width: 20%;
190 | }
191 | }
192 |
193 | /* small screens */
194 | @include breakpoint(baby-bear) {
195 | section[data-valign='center'] > div,
196 | section[data-valign='center'] > div + * {
197 | display: block;
198 | }
199 | }
--------------------------------------------------------------------------------
/css/assets/_fonts.scss:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'Source Sans Pro';
3 | font-style: normal;
4 | font-weight: 400;
5 | src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url(http://themes.googleusercontent.com/static/fonts/sourcesanspro/v5/ODelI1aHBYDBqgeIAH2zlBM0YzuT7MdOe03otPbuUS0.woff) format('woff');
6 | }
7 | @font-face {
8 | font-family: 'Source Sans Pro';
9 | font-style: normal;
10 | font-weight: 700;
11 | src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url(http://themes.googleusercontent.com/static/fonts/sourcesanspro/v5/toadOcfmlt9b38dHJxOBGFkQc6VGVFSmCnC_l7QZG60.woff) format('woff');
12 | }
13 |
14 | @font-face {
15 | font-family: 'fontelico';
16 | font-style: 'normal';
17 | font-weight: 'normal';
18 | src: url('http://weloveiconfonts.com/api/fonts/fontelico/fontelico.eot');
19 | src: url('http://weloveiconfonts.com/api/fonts/fontelico/fontelico.eot?#iefix') format('eot'),
20 | url('http://weloveiconfonts.com/api/fonts/fontelico/fontelico.woff') format('woff'),
21 | url('http://weloveiconfonts.com/api/fonts/fontelico/fontelico.ttf') format('truetype'),
22 | url('http://weloveiconfonts.com/api/fonts/fontelico/fontelico.svg#fontelico') format('svg');
23 | }
24 | .fontelico-emo-happy:before{content:'\e800'}.fontelico-emo-wink:before{content:'\e801'}.fontelico-emo-wink2:before{content:'\e813'}.fontelico-emo-unhappy:before{content:'\e802'}.fontelico-emo-sleep:before{content:'\e803'}.fontelico-emo-thumbsup:before{content:'\e804'}.fontelico-emo-devil:before{content:'\e805'}.fontelico-emo-surprised:before{content:'\e806'}.fontelico-emo-tongue:before{content:'\e807'}.fontelico-emo-coffee:before{content:'\e808'}.fontelico-emo-sunglasses:before{content:'\e809'}.fontelico-emo-displeased:before{content:'\e80a'}.fontelico-emo-beer:before{content:'\e80b'}.fontelico-emo-grin:before{content:'\e80c'}.fontelico-emo-angry:before{content:'\e80d'}.fontelico-emo-saint:before{content:'\e80e'}.fontelico-emo-cry:before{content:'\e80f'}.fontelico-emo-shoot:before{content:'\e810'}.fontelico-emo-squint:before{content:'\e811'}.fontelico-emo-laugh:before{content:'\e812'}.fontelico-spin1:before{content:'\e830'}.fontelico-spin2:before{content:'\e831'}.fontelico-spin3:before{content:'\e832'}.fontelico-spin4:before{content:'\e834'}.fontelico-spin5:before{content:'\e838'}.fontelico-spin6:before{content:'\e839'}.fontelico-firefox:before{content:'\e840'}.fontelico-chrome:before{content:'\e841'}.fontelico-opera:before{content:'\e842'}.fontelico-ie:before{content:'\e843'}
--------------------------------------------------------------------------------
/css/assets/_helper.scss:
--------------------------------------------------------------------------------
1 | /* ******** *
2 | * HELPER *
3 | * ******** */
4 |
5 | /**
6 | * Media Queries handler
7 | */
8 | @mixin breakpoint($point) {
9 | @if $point == papa-bear {
10 | @media (min-width: 67em) { @content; }
11 | }
12 | @if $point == mama-bear {
13 | @media (max-width: 66em) { @content; }
14 | }
15 | @if $point == baby-bear {
16 | @media (max-width: 44em) { @content; }
17 | }
18 | }
19 |
20 | /**
21 | * Retina dispalys handler
22 | */
23 | @mixin retina() {
24 | @media
25 | only screen and (-webkit-min-device-pixel-ratio: 2),
26 | only screen and ( min--moz-device-pixel-ratio: 2),
27 | only screen and ( -o-min-device-pixel-ratio: 2/1),
28 | only screen and ( min-device-pixel-ratio: 2),
29 | only screen and ( min-resolution: 192dpi),
30 | only screen and ( min-resolution: 2dppx) {
31 | @content;
32 | }
33 | }
--------------------------------------------------------------------------------
/css/assets/_iconfont.scss:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'fontelico';
3 | font-style: 'normal';
4 | font-weight: 'normal';
5 | src: url('http://weloveiconfonts.com/api/fonts/fontelico/fontelico.eot');
6 | src: url('http://weloveiconfonts.com/api/fonts/fontelico/fontelico.eot?#iefix') format('eot'),
7 | url('http://weloveiconfonts.com/api/fonts/fontelico/fontelico.woff') format('woff'),
8 | url('http://weloveiconfonts.com/api/fonts/fontelico/fontelico.ttf') format('truetype'),
9 | url('http://weloveiconfonts.com/api/fonts/fontelico/fontelico.svg#fontelico') format('svg');
10 | }
11 | .fontelico-emo-happy:before{content:'\e800'}.fontelico-emo-wink:before{content:'\e801'}.fontelico-emo-wink2:before{content:'\e813'}.fontelico-emo-unhappy:before{content:'\e802'}.fontelico-emo-sleep:before{content:'\e803'}.fontelico-emo-thumbsup:before{content:'\e804'}.fontelico-emo-devil:before{content:'\e805'}.fontelico-emo-surprised:before{content:'\e806'}.fontelico-emo-tongue:before{content:'\e807'}.fontelico-emo-coffee:before{content:'\e808'}.fontelico-emo-sunglasses:before{content:'\e809'}.fontelico-emo-displeased:before{content:'\e80a'}.fontelico-emo-beer:before{content:'\e80b'}.fontelico-emo-grin:before{content:'\e80c'}.fontelico-emo-angry:before{content:'\e80d'}.fontelico-emo-saint:before{content:'\e80e'}.fontelico-emo-cry:before{content:'\e80f'}.fontelico-emo-shoot:before{content:'\e810'}.fontelico-emo-squint:before{content:'\e811'}.fontelico-emo-laugh:before{content:'\e812'}.fontelico-spin1:before{content:'\e830'}.fontelico-spin2:before{content:'\e831'}.fontelico-spin3:before{content:'\e832'}.fontelico-spin4:before{content:'\e834'}.fontelico-spin5:before{content:'\e838'}.fontelico-spin6:before{content:'\e839'}.fontelico-firefox:before{content:'\e840'}.fontelico-chrome:before{content:'\e841'}.fontelico-opera:before{content:'\e842'}.fontelico-ie:before{content:'\e843'}
--------------------------------------------------------------------------------
/css/assets/_keyframes.sass:
--------------------------------------------------------------------------------
1 | @import "compass/css3/_shared"
2 |
3 | // Requires SASS syntax and not SCSS in order to work (sass 3.2 ?)
4 | // Experimental support is scoped within keyframes so for instance -moz-keyframes won't contain -webkit- properties
5 |
6 |
7 | // Mixin to set every support to false
8 | =reset-experimental-support
9 | $experimental-support-for-mozilla: false
10 | $experimental-support-for-webkit: false
11 | $experimental-support-for-opera: false
12 | $experimental-support-for-microsoft: false
13 | $experimental-support-for-khtml: false
14 |
15 |
16 | =keyframes($name, $moz: $experimental-support-for-mozilla, $webkit: $experimental-support-for-webkit, $o: $experimental-support-for-opera, $ms: $experimental-support-for-microsoft, $khtml: $experimental-support-for-khtml, $official: true)
17 |
18 | // Save support
19 | $original-experimental-support-for-mozilla: $experimental-support-for-mozilla
20 | $original-experimental-support-for-webkit: $experimental-support-for-webkit
21 | $original-experimental-support-for-opera: $experimental-support-for-opera
22 | $original-experimental-support-for-microsoft: $experimental-support-for-microsoft
23 | $original-experimental-support-for-khtml: $experimental-support-for-khtml
24 |
25 | @if $moz
26 | +reset-experimental-support
27 | $experimental-support-for-mozilla: true
28 |
29 | @-moz-keyframes #{$name}
30 | @content
31 |
32 |
33 | @if $webkit
34 |
35 | +reset-experimental-support
36 | $experimental-support-for-webkit: true
37 |
38 | @-webkit-keyframes #{$name}
39 | @content
40 |
41 | @if $o
42 |
43 | +reset-experimental-support
44 | $experimental-support-for-opera: true
45 |
46 | @-o-keyframes #{$name}
47 | @content
48 |
49 | @if $ms
50 |
51 | +reset-experimental-support
52 | $experimental-support-for-microsoft: true
53 |
54 | @-ms-keyframes #{$name}
55 | @content
56 |
57 | @if $khtml
58 |
59 | +reset-experimental-support
60 | $experimental-support-for-khtml: true
61 |
62 | @-khtml-keyframes #{$name}
63 | @content
64 |
65 | // Restore support
66 | $experimental-support-for-mozilla: $original-experimental-support-for-mozilla
67 | $experimental-support-for-webkit: $original-experimental-support-for-webkit
68 | $experimental-support-for-opera: $original-experimental-support-for-opera
69 | $experimental-support-for-microsoft: $original-experimental-support-for-microsoft
70 | $experimental-support-for-khtml: $original-experimental-support-for-khtml
71 |
72 | @if $official
73 | @keyframes #{$name}
74 | @content
75 |
--------------------------------------------------------------------------------
/css/assets/_kudosplease.scss:
--------------------------------------------------------------------------------
1 | @import "compass/css3";
2 |
3 | /*
4 | * Use Fontelico from weloveiconfonts.com
5 | */
6 | [class*="fontelico-"]:before {
7 | font-family: 'fontelico', sans-serif;
8 | font-weight:normal;
9 | }
10 |
11 | /*
12 | * Kudos
13 | */
14 | $kudos_duration: 1.5s;
15 | $kudos_duration_finish: .45s;
16 | $kudos_width: 6em;
17 | $kudos_height: 6em;
18 | $kudos_color_alpha: #fff; // default
19 | $kudos_color_beta: $color-beta; // active
20 | $kudos_color_gamma: $color-delta; // default border
21 |
22 | .kudos {
23 | color:#000;
24 | position:relative;
25 | width:$kudos_width;
26 | height:$kudos_height;
27 | margin:.35em auto 1.5em auto;
28 | background:$kudos_color_alpha;
29 | box-shadow:
30 | inset 0 0 0 .25em $kudos_color_gamma,
31 | inset 0 0 0 $kudos_width / 3 $kudos_color_alpha,
32 | inset 0 0 0 $kudos_width $kudos_color_gamma
33 | ;
34 | line-height:$kudos_height;
35 | text-align:center;
36 | border-radius:50%;
37 | @include user-select(none);
38 | @include transition(box-shadow $kudos_duration_finish / 2 ease-out);
39 |
40 | &:before {
41 | @include transition(font-size $kudos_duration_finish ease-in);
42 | font-size:1.45em;
43 | color:$kudos_color_alpha;
44 | line-height:1.45;
45 | }
46 |
47 | &.active {
48 | @include transition(box-shadow $kudos_duration linear);
49 | box-shadow:
50 | inset 0 0 0 .25em $kudos_color_gamma,
51 | inset 0 0 0 0 $kudos_color_alpha,
52 | inset 0 0 0 .75em rgba($kudos_color_beta, .75),
53 | inset 0 0 0 $kudos_width $kudos_color_beta
54 | ;
55 |
56 | &:after {
57 | content: 'Don\'t move!';
58 | }
59 | }
60 |
61 | &.finish {
62 | @include transition(
63 | box-shadow $kudos_duration_finish linear,
64 | transform $kudos_duration_finish * 1.25 ease-in-out
65 | );
66 | box-shadow:
67 | inset 0 0 0 .25em rgba($kudos_color_beta, .5),
68 | inset 0 0 0 .5em $kudos_color_alpha,
69 | inset 0 0 0 .75em rgba($kudos_color_beta, .75),
70 | inset 0 0 0 1em $kudos_color_alpha,
71 | inset 0 0 0 0 $kudos_color_alpha,
72 | inset 0 0 0 $kudos_width $kudos_color_beta
73 | ;
74 |
75 | &:before {
76 | font-size:1.45em;
77 | color:$kudos_color_alpha;
78 | line-height:1.45;
79 | }
80 | }
81 |
82 | &:after {
83 | position:absolute;
84 | content: attr(data-amount) ' Kudos';
85 | bottom:-1.25em;
86 | left:0;
87 | width:$kudos_width;
88 | text-align:center;
89 | line-height:1em;
90 | }
91 | }
--------------------------------------------------------------------------------
/css/assets/_prism.scss:
--------------------------------------------------------------------------------
1 | /**
2 | * prism.js default theme for JavaScript, CSS and HTML
3 | * Based on dabblet (http://dabblet.com)
4 | * @author Lea Verou
5 | */
6 |
7 | code[class*="language-"],
8 | pre[class*="language-"] {
9 | color: black;
10 | text-shadow: 0 1px white;
11 | font-family: Consolas, Monaco, 'Andale Mono', monospace;
12 | direction: ltr;
13 | text-align: left;
14 | white-space: pre;
15 | word-spacing: normal;
16 |
17 | -moz-tab-size: 4;
18 | -o-tab-size: 4;
19 | tab-size: 4;
20 |
21 | -webkit-hyphens: none;
22 | -moz-hyphens: none;
23 | -ms-hyphens: none;
24 | hyphens: none;
25 | }
26 |
27 | @media print {
28 | code[class*="language-"],
29 | pre[class*="language-"] {
30 | text-shadow: none;
31 | }
32 | }
33 |
34 | /* Code blocks */
35 | pre[class*="language-"] {
36 | padding: 1em;
37 | margin: .5em 0;
38 | overflow: auto;
39 | }
40 |
41 | :not(pre) > code[class*="language-"],
42 | pre[class*="language-"] {
43 | background: #f5f2f0;
44 | }
45 |
46 | /* Inline code */
47 | :not(pre) > code[class*="language-"] {
48 | padding: .1em;
49 | border-radius: .3em;
50 | }
51 |
52 | .token.comment,
53 | .token.prolog,
54 | .token.doctype,
55 | .token.cdata {
56 | color: slategray;
57 | }
58 |
59 | .token.punctuation {
60 | color: #999;
61 | }
62 |
63 | .namespace {
64 | opacity: .7;
65 | }
66 |
67 | .token.property,
68 | .token.tag,
69 | .token.boolean,
70 | .token.number {
71 | color: #905;
72 | }
73 |
74 | .token.selector,
75 | .token.attr-name,
76 | .token.string {
77 | color: #690;
78 | }
79 |
80 | .token.operator,
81 | .token.entity,
82 | .token.url,
83 | .language-css .token.string,
84 | .style .token.string {
85 | color: #a67f59;
86 | background: hsla(0,0%,100%,.5);
87 | }
88 |
89 | .token.atrule,
90 | .token.attr-value,
91 | .token.keyword {
92 | color: #07a;
93 | }
94 |
95 |
96 | .token.regex,
97 | .token.important {
98 | color: #e90;
99 | }
100 |
101 | .token.important {
102 | font-weight: bold;
103 | }
104 |
105 | .token.entity {
106 | cursor: help;
107 | }
108 |
--------------------------------------------------------------------------------
/css/kudosplease.css:
--------------------------------------------------------------------------------
1 | .kudos{color:#000;position:relative;width:6em;height:6em;margin:.5em auto 1.5em auto;background:#fff;box-shadow:inset 0 0 0 0.25em #000,inset 0 0 0 2em #fff,inset 0 0 0 6em #000;line-height:6em;text-align:center;border-radius:50%;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-transition:box-shadow 0.225s ease-out;-moz-transition:box-shadow 0.225s ease-out;-o-transition:box-shadow 0.225s ease-out;transition:box-shadow 0.225s ease-out}.kudos:before{-webkit-transition:font-size 0.45s ease-in;-moz-transition:font-size 0.45s ease-in;-o-transition:font-size 0.45s ease-in;transition:font-size 0.45s ease-in;font-size:1.75em;line-height:1.75;color:#fff}.kudos.active{-webkit-transition:box-shadow 1.5s linear;-moz-transition:box-shadow 1.5s linear;-o-transition:box-shadow 1.5s linear;transition:box-shadow 1.5s linear;box-shadow:inset 0 0 0 0.25em #000,inset 0 0 0 0 #fff,inset 0 0 0 0.75em rgba(204,61,57,0.75),inset 0 0 0 6em #cc3d39}.kudos.active:after{content:'Don\'t move!'}.kudos.finish{-webkit-transition:box-shadow 0.45s linear,-webkit-transform 0.5625s ease-in-out;-moz-transition:box-shadow 0.45s linear,-moz-transform 0.5625s ease-in-out;-o-transition:box-shadow 0.45s linear,-o-transform 0.5625s ease-in-out;transition:box-shadow 0.45s linear,transform 0.5625s ease-in-out;box-shadow:inset 0 0 0 0.25em rgba(204,61,57,0.5),inset 0 0 0 0.5em #fff,inset 0 0 0 0.75em rgba(204,61,57,0.75),inset 0 0 0 1em #fff,inset 0 0 0 0 #fff,inset 0 0 0 6em #cc3d39}.kudos.finish:hover{-webkit-transform:scale(1.25, 1.25);-moz-transform:scale(1.25, 1.25);-ms-transform:scale(1.25, 1.25);-o-transform:scale(1.25, 1.25);transform:scale(1.25, 1.25)}.kudos.finish:before{font-size:2.25em;line-height:2.25;color:#fff}.kudos:after{position:absolute;content:attr(data-amount) " Kudos";bottom:-1.25em;left:0;width:6em;text-align:center;line-height:1em}
2 |
--------------------------------------------------------------------------------
/css/kudosplease.scss:
--------------------------------------------------------------------------------
1 | /**
2 | * Compass imports
3 | */
4 | @import "compass/css3/images";
5 | @import "compass/css3";
6 | @import "compass/css3/user-interface";
7 | @import "compass/css3/filter";
8 |
9 | /*@import url(http://weloveiconfonts.com/api/?family=fontawesome);
10 |
11 | /*
12 | * Use FontAwesome from weloveiconfonts.com
13 | */
14 | /*[class*="fontawesome-"]:before {
15 | font-family: 'FontAwesome', sans-serif;
16 | font-weight:normal;
17 | }*/
18 |
19 | /*
20 | * Kudos
21 | */
22 | $kudos_duration: 1.5s;
23 | $kudos_duration_finish: .45s;
24 | $kudos_width: 6em;
25 | $kudos_height: 6em;
26 | $kudos_color_alpha: #fff;
27 | $kudos_color_beta: #cc3d39;
28 |
29 | .kudos {
30 | color:#000;
31 | position:relative;
32 | width:$kudos_width;
33 | height:$kudos_height;
34 | margin:.5em auto 1.5em auto;
35 | background:$kudos_color_alpha;
36 | box-shadow:
37 | inset 0 0 0 .25em #000,
38 | inset 0 0 0 $kudos_width / 3 $kudos_color_alpha,
39 | inset 0 0 0 $kudos_width #000
40 | ;
41 | line-height:$kudos_height;
42 | text-align:center;
43 | border-radius:50%;
44 | @include user-select(none);
45 | @include transition(box-shadow $kudos_duration_finish / 2 ease-out);
46 |
47 | &:before {
48 | @include transition(font-size $kudos_duration_finish ease-in);
49 | font-size:1.75em;
50 | line-height:1.75;
51 | color:$kudos_color_alpha;
52 | }
53 |
54 | &.active {
55 | @include transition(box-shadow $kudos_duration linear);
56 | box-shadow:
57 | inset 0 0 0 .25em #000,
58 | inset 0 0 0 0 $kudos_color_alpha,
59 | inset 0 0 0 .75em rgba($kudos_color_beta, .75),
60 | inset 0 0 0 $kudos_width $kudos_color_beta
61 | ;
62 |
63 | &:after {
64 | content: 'Don\'t move!';
65 | }
66 | }
67 |
68 | &.finish {
69 | @include transition(
70 | box-shadow $kudos_duration_finish linear,
71 | transform $kudos_duration_finish * 1.25 ease-in-out
72 | );
73 | box-shadow:
74 | inset 0 0 0 .25em rgba($kudos_color_beta, .5),
75 | inset 0 0 0 .5em $kudos_color_alpha,
76 | inset 0 0 0 .75em rgba($kudos_color_beta, .75),
77 | inset 0 0 0 1em $kudos_color_alpha,
78 | inset 0 0 0 0 $kudos_color_alpha,
79 | inset 0 0 0 $kudos_width $kudos_color_beta
80 | ;
81 |
82 | &:hover {
83 | @include transform(scale(1.25, 1.25), translateY(-.75em));
84 | }
85 |
86 | &:before {
87 | font-size:2.25em;
88 | line-height:2.25;
89 | color:$kudos_color_alpha;
90 | }
91 | }
92 |
93 | &:after {
94 | position:absolute;
95 | content: attr(data-amount) ' Kudos';
96 | bottom:-1.25em;
97 | left:0;
98 | width:$kudos_width;
99 | text-align:center;
100 | line-height:1em;
101 | }
102 | }
--------------------------------------------------------------------------------
/css/style.css:
--------------------------------------------------------------------------------
1 | *,*:before,*:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html,body{margin:0;padding:0;height:100%;width:100%}body{overflow-x:hidden}body[data-max-width="860"] section[data-cols]{max-width:860px}body[data-max-width="1024"] section[data-cols]{max-width:1024px}body[data-max-width="1152"] section[data-cols]{max-width:1152px}body[data-max-width="1280"] section[data-cols]{max-width:1280px}body[data-max-width="1400"] section[data-cols]{max-width:1400px}body[data-max-width="1600"] section[data-cols]{max-width:1600px}@media screen and (min-width: 1600px){body[data-auto-extend="true"] section[data-cols]{max-width:1600px}}body[data-max-width="2048"] section[data-cols]{max-width:2048px}@media screen and (min-width: 2048px){body[data-auto-extend="true"] section[data-cols]{max-width:2048px}}body[data-max-width="3200"] section[data-cols]{max-width:3200px}@media screen and (min-width: 3200px){body[data-auto-extend="true"] section[data-cols]{max-width:3200px}}body[data-max-width="4000"] section[data-cols]{max-width:4000px}@media screen and (min-width: 4000px){body[data-auto-extend="true"] section[data-cols]{max-width:4000px}}button{width:100%;cursor:pointer}img{max-width:100%}article{position:relative;margin-top:1em}section{position:relative;overflow:hidden;margin:0 auto}section>div{height:100%;margin:0;padding:0.5em 0.5em 0.5em 0.5em}section[data-valign='center']{display:block}section[data-valign='center']>div,section[data-valign='center']>div+*{display:table-cell;vertical-align:middle}article[data-high]:before,article[data-high]:after,article[data-text]:before,article[data-text]:after,pre[data-text]:before,pre[data-text]:after{content:'';position:absolute;top:0;left:0}section[data-cols='1']>div{display:block}@media screen and (min-width: 44em){section[data-cols='2']>div,section[data-cols='3']>div,section[data-cols='4']>div,section[data-cols='5']>div,section[data-cols='5']>div:nth-child(4),section[data-cols='5']>div:nth-child(5){float:left;width:50%}section[data-cols='2']>div:nth-child(odd){clear:both}section[data-cols='3']>div:last-child,section[data-cols='5']>div:last-child{width:100%}}@media screen and (min-width: 66em){section[data-cols='3']>div,section[data-cols='4']>div,section[data-cols='5']>div{width:33.3%}section[data-cols='3']>div:last-child{width:33.3%}section[data-cols='5']>div:nth-child(5){width:50%}section[data-cols='4']>div:last-child{width:100%}}@media screen and (min-width: 74em){section[data-cols='4']>div,section[data-cols='4']>div:last-child{width:25%}section[data-cols='4']>div:nth-child(4n+1){clear:both}}@media screen and (min-width: 80em){section[data-cols='5']>div,section[data-cols='5']>div:last-child,section[data-cols='5']>div:nth-child(4){width:20%}}@media (max-width: 44em){section[data-valign='center']>div,section[data-valign='center']>div+*{display:block}}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:400;src:local("Source Sans Pro"),local("SourceSansPro-Regular"),url(http://themes.googleusercontent.com/static/fonts/sourcesanspro/v5/ODelI1aHBYDBqgeIAH2zlBM0YzuT7MdOe03otPbuUS0.woff) format("woff")}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:700;src:local("Source Sans Pro Bold"),local("SourceSansPro-Bold"),url(http://themes.googleusercontent.com/static/fonts/sourcesanspro/v5/toadOcfmlt9b38dHJxOBGFkQc6VGVFSmCnC_l7QZG60.woff) format("woff")}@font-face{font-family:'fontelico';font-style:'normal';font-weight:'normal';src:url("http://weloveiconfonts.com/api/fonts/fontelico/fontelico.eot");src:url("http://weloveiconfonts.com/api/fonts/fontelico/fontelico.eot?#iefix") format("eot"),url("http://weloveiconfonts.com/api/fonts/fontelico/fontelico.woff") format("woff"),url("http://weloveiconfonts.com/api/fonts/fontelico/fontelico.ttf") format("truetype"),url("http://weloveiconfonts.com/api/fonts/fontelico/fontelico.svg#fontelico") format("svg")}.fontelico-emo-happy:before{content:'\e800'}.fontelico-emo-wink:before{content:'\e801'}.fontelico-emo-wink2:before{content:'\e813'}.fontelico-emo-unhappy:before{content:'\e802'}.fontelico-emo-sleep:before{content:'\e803'}.fontelico-emo-thumbsup:before{content:'\e804'}.fontelico-emo-devil:before{content:'\e805'}.fontelico-emo-surprised:before{content:'\e806'}.fontelico-emo-tongue:before{content:'\e807'}.fontelico-emo-coffee:before{content:'\e808'}.fontelico-emo-sunglasses:before{content:'\e809'}.fontelico-emo-displeased:before{content:'\e80a'}.fontelico-emo-beer:before{content:'\e80b'}.fontelico-emo-grin:before{content:'\e80c'}.fontelico-emo-angry:before{content:'\e80d'}.fontelico-emo-saint:before{content:'\e80e'}.fontelico-emo-cry:before{content:'\e80f'}.fontelico-emo-shoot:before{content:'\e810'}.fontelico-emo-squint:before{content:'\e811'}.fontelico-emo-laugh:before{content:'\e812'}.fontelico-spin1:before{content:'\e830'}.fontelico-spin2:before{content:'\e831'}.fontelico-spin3:before{content:'\e832'}.fontelico-spin4:before{content:'\e834'}.fontelico-spin5:before{content:'\e838'}.fontelico-spin6:before{content:'\e839'}.fontelico-firefox:before{content:'\e840'}.fontelico-chrome:before{content:'\e841'}.fontelico-opera:before{content:'\e842'}.fontelico-ie:before{content:'\e843'}[class*="fontelico-"]:before{font-family:'fontelico', sans-serif;font-weight:normal}.kudos{color:#000;position:relative;width:6em;height:6em;margin:.35em auto 1.5em auto;background:#fff;box-shadow:inset 0 0 0 0.25em #c7be9a,inset 0 0 0 2em #fff,inset 0 0 0 6em #c7be9a;line-height:6em;text-align:center;border-radius:50%;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-transition:box-shadow 0.225s ease-out;-moz-transition:box-shadow 0.225s ease-out;-o-transition:box-shadow 0.225s ease-out;transition:box-shadow 0.225s ease-out}.kudos:before{-webkit-transition:font-size 0.45s ease-in;-moz-transition:font-size 0.45s ease-in;-o-transition:font-size 0.45s ease-in;transition:font-size 0.45s ease-in;font-size:1.45em;color:#fff;line-height:1.45}.kudos.active{-webkit-transition:box-shadow 1.5s linear;-moz-transition:box-shadow 1.5s linear;-o-transition:box-shadow 1.5s linear;transition:box-shadow 1.5s linear;box-shadow:inset 0 0 0 0.25em #c7be9a,inset 0 0 0 0 #fff,inset 0 0 0 0.75em rgba(62,221,201,0.75),inset 0 0 0 6em #3eddc9}.kudos.active:after{content:'Don\'t move!'}.kudos.finish{-webkit-transition:box-shadow 0.45s linear,-webkit-transform 0.5625s ease-in-out;-moz-transition:box-shadow 0.45s linear,-moz-transform 0.5625s ease-in-out;-o-transition:box-shadow 0.45s linear,-o-transform 0.5625s ease-in-out;transition:box-shadow 0.45s linear,transform 0.5625s ease-in-out;box-shadow:inset 0 0 0 0.25em rgba(62,221,201,0.5),inset 0 0 0 0.5em #fff,inset 0 0 0 0.75em rgba(62,221,201,0.75),inset 0 0 0 1em #fff,inset 0 0 0 0 #fff,inset 0 0 0 6em #3eddc9}.kudos.finish:before{font-size:1.45em;color:#fff;line-height:1.45}.kudos:after{position:absolute;content:attr(data-amount) " Kudos";bottom:-1.25em;left:0;width:6em;text-align:center;line-height:1em}code[class*="language-"],pre[class*="language-"]{color:black;text-shadow:0 1px white;font-family:Consolas, Monaco, 'Andale Mono', monospace;direction:ltr;text-align:left;white-space:pre;word-spacing:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}@media print{code[class*="language-"],pre[class*="language-"]{text-shadow:none}}pre[class*="language-"]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*="language-"],pre[class*="language-"]{background:#f5f2f0}:not(pre)>code[class*="language-"]{padding:.1em;border-radius:.3em}.token.comment,.token.prolog,.token.doctype,.token.cdata{color:slategray}.token.punctuation{color:#999}.namespace{opacity:.7}.token.property,.token.tag,.token.boolean,.token.number{color:#905}.token.selector,.token.attr-name,.token.string{color:#690}.token.operator,.token.entity,.token.url,.language-css .token.string,.style .token.string{color:#a67f59;background:rgba(255,255,255,0.5)}.token.atrule,.token.attr-value,.token.keyword{color:#07a}.token.regex,.token.important{color:#e90}.token.important{font-weight:bold}.token.entity{cursor:help}pre[class*="language-"]{background:#f3f1e2;margin:0}.kudos{font-size:2em}body{height:100%;position:relative;font:1.5em "Source Sans Pro", sans-serif;color:#fff;background:#f3f1e2}h1{font-size:2.75em;font-weight:700;padding:0 .75em;margin:.25em;text-transform:uppercase;text-align:center}@media (max-width: 44em){h1{font-size:2em;margin:.25em .5em}}h2{color:#824d77;margin:.5em 0 .5em 0}a{color:#824d77;text-decoration:none;border-bottom:0.15em solid #824d77;padding-bottom:.25em;-webkit-transition:color 0.25s ease-in-out,padding 0.25s ease-in-out;-moz-transition:color 0.25s ease-in-out,padding 0.25s ease-in-out;-o-transition:color 0.25s ease-in-out,padding 0.25s ease-in-out;transition:color 0.25s ease-in-out,padding 0.25s ease-in-out}a:hover{color:rgba(130,77,119,0.5);padding-bottom:.05em}button{background:#fc312c;color:#fff;border:none;font-size:1.45em;line-height:1em;padding:.75em 0;font-family:inherit;-webkit-transition:background 0.25s ease-in-out,color 0.25s ease-in-out;-moz-transition:background 0.25s ease-in-out,color 0.25s ease-in-out;-o-transition:background 0.25s ease-in-out,color 0.25s ease-in-out;transition:background 0.25s ease-in-out,color 0.25s ease-in-out}button::-moz-focus-inner{border:none}button:hover{background:#fff;color:#fc312c}button.button--alpha{background:#fff;color:#fc312c}button.button--alpha:hover{background:#fc312c;color:#fff}img{max-width:100%}p{padding:.25em 0;margin:.75em 0}pre{font-size:.8em}ul{list-style-type:square}ul>li{margin:.5em 0}article{margin:1em 0 1em 0;padding:0 0}article[data-high="1"]{margin-top:0;background:#fff}article[data-high="1"] p{margin:0;text-align:center;color:#c7be9a;font-weight:700}article[data-high="1"]>section{color:#fd625e}article[data-high="2"]{background:#fff}article[data-high="2"]>section.section--alpha{background:#fd625e}article[data-high="2"]>section.section--alpha div[data-type="1"]{position:absolute;background:#fff;padding-top:.25em}@media (max-width: 44em){article[data-high="2"]>section.section--alpha div[data-type="1"]{position:relative}}article[data-high="2"]>section.section--alpha div[data-type="2"]{padding:.5em .5em 0 .5em;float:right;min-height:16em}article[data-high="2"]>section.section--beta h2{color:#fff}article[data-high="2"]>section.section--beta div[data-type="1"]{position:absolute;right:0;background:#fff;padding-top:.25em}@media (max-width: 44em){article[data-high="2"]>section.section--beta div[data-type="1"]{position:relative;right:auto}}article[data-high="2"]>section.section--beta div[data-type="2"]{min-height:16em}@media (max-width: 44em){article[data-high="2"]>section.section--beta div[data-type="2"]{padding:0}}article[data-high="2"]>section.section--beta div[data-type="2"]>div{background:#824d77;padding:.5em}article[data-high="3"]{padding:1em 0}article[data-high="3"]>section div[data-type="1"]{background:#fff}article[data-high="4"]{background:#fff;border-top:0.45em solid #824d77;border-bottom:0.45em solid #824d77}article[data-high="4"]>section{padding-top:1em;padding-bottom:1em;color:#000}@media (max-width: 44em){article[data-high="4"]>section{padding-top:0;padding-bottom:0}}article[data-high="5"]{background:#c7be9a;margin-bottom:0;padding-top:1em}article[data-high="5"]>section{color:#000}section[data-cols='2']:before,section[data-cols='2']:after{content:'';display:table}section[data-cols='2']:after{clear:both}
2 |
--------------------------------------------------------------------------------
/css/style.scss:
--------------------------------------------------------------------------------
1 | @charset "UTF-8";
2 |
3 | /**
4 | * Assets
5 | */
6 | @import "assets/assets";
7 |
8 | /*
9 | * prism
10 | */
11 | pre[class*="language-"] {
12 | background:$color-epsilon;
13 | margin:0;
14 | }
15 |
16 | /*
17 | * Kudos Please widget
18 | */
19 | $kudos_color_alpha: $color-alpha;
20 |
21 | .kudos {
22 | font-size:2em;
23 | }
24 |
25 | /**
26 | * Style
27 | */
28 | body {
29 | height:100%;
30 | position:relative;
31 | font: 1.5em "Source Sans Pro", sans-serif;
32 | color:#fff;
33 | background:$color-epsilon;
34 | }
35 |
36 | h1 {
37 | font-size:2.75em;
38 | font-weight: 700;
39 | padding:0 .75em;
40 | margin:.25em;
41 | text-transform: uppercase;
42 | text-align: center;
43 |
44 | @include breakpoint(baby-bear) {
45 | font-size:2em;
46 | margin:.25em .5em;
47 | }
48 | }
49 |
50 | h2 {
51 | color:$color-gamma;
52 | margin:.5em 0 .5em 0;
53 | }
54 |
55 | a {
56 | color:$color-gamma;
57 | text-decoration: none;
58 | border-bottom: .15em solid rgba($color-gamma, 1);
59 | padding-bottom:.25em;
60 |
61 | @include transition(
62 | color .25s ease-in-out,
63 | padding .25s ease-in-out
64 | );
65 |
66 | &:hover {
67 | color:rgba($color-gamma, .5);
68 | padding-bottom:.05em;
69 | }
70 | }
71 |
72 | button {
73 | background: darken($color-alpha, 10%);
74 | color: #fff;
75 | border:none;
76 | font-size:1.45em;
77 | line-height:1em;
78 | padding: .75em 0;
79 | font-family:inherit;
80 | @include transition(
81 | background .25s ease-in-out,
82 | color .25s ease-in-out
83 | );
84 |
85 | &::-moz-focus-inner {
86 | border:none;
87 | }
88 |
89 | &:hover {
90 | background:#fff;
91 | color:darken($color-alpha, 10%);
92 | }
93 |
94 | &.button--alpha {
95 | background:#fff;
96 | color:darken($color-alpha, 10%);
97 |
98 | &:hover {
99 | background: darken($color-alpha, 10%);
100 | color: #fff;
101 | }
102 | }
103 | }
104 |
105 | img {
106 | max-width:100%;
107 | }
108 |
109 | p {
110 | padding:.25em 0;
111 | margin:.75em 0;
112 | }
113 |
114 | pre {
115 | font-size:.8em;
116 | }
117 |
118 | ul {
119 | list-style-type:square;
120 |
121 | > li {
122 | margin: .5em 0;
123 | }
124 | }
125 |
126 | /*
127 | * Article
128 | */
129 | article {
130 | margin:1em 0 1em 0;
131 | padding:0 0;
132 | }
133 |
134 | article[data-high="1"] {
135 | margin-top:0;
136 | background:#fff;
137 |
138 | p {
139 | margin:0;
140 | text-align:center;
141 | color:$color-delta;
142 | font-weight:700;
143 | }
144 |
145 | > section {
146 | color:$color-alpha;
147 | }
148 | }
149 |
150 | article[data-high="2"] {
151 | background:#fff;
152 |
153 | > section {
154 | &.section--alpha {
155 | background:$color-alpha;
156 |
157 | div[data-type="1"] {
158 | position:absolute;
159 | background:#fff;
160 | padding-top: .25em;
161 |
162 | @include breakpoint(baby-bear) {
163 | position:relative;
164 | }
165 | }
166 |
167 | div[data-type="2"] {
168 | padding:.5em .5em 0 .5em;
169 | float:right;
170 | min-height:16em;
171 | }
172 | }
173 |
174 | &.section--beta {
175 | h2 {
176 | color:#fff;
177 | }
178 |
179 | div[data-type="1"] {
180 |
181 | position:absolute;
182 | right:0;
183 | background:#fff;
184 | padding-top: .25em;
185 |
186 | @include breakpoint(baby-bear) {
187 | position:relative;
188 | right:auto;
189 | }
190 | }
191 |
192 | div[data-type="2"] {
193 | min-height:16em;
194 |
195 | @include breakpoint(baby-bear) {
196 | padding:0;
197 | }
198 |
199 | > div {
200 | background:$color-gamma;
201 | padding:.5em;
202 | }
203 | }
204 | }
205 | }
206 | }
207 |
208 | article[data-high="3"] {
209 | padding:1em 0;
210 |
211 | > section {
212 | div[data-type="1"] {
213 | background:#fff;
214 | }
215 | }
216 | }
217 |
218 | article[data-high="4"] {
219 | background:#fff;
220 | border-top:.45em solid $color-gamma;
221 | border-bottom:.45em solid $color-gamma;
222 |
223 | > section {
224 | padding-top:1em;
225 | padding-bottom:1em;
226 | color:#000;
227 |
228 | @include breakpoint(baby-bear) {
229 | padding-top:0;
230 | padding-bottom:0;
231 | }
232 | }
233 | }
234 |
235 |
236 | article[data-high="5"] {
237 | background:$color-delta;
238 | margin-bottom:0;
239 | padding-top:1em;
240 |
241 | > section {
242 | color:#000;
243 | }
244 | }
245 |
246 | section[data-cols='2'] {
247 | &:before,
248 | &:after {
249 | content: '';
250 | display: table;
251 | }
252 |
253 | &:after {
254 | clear: both;
255 | }
256 | }
--------------------------------------------------------------------------------
/img/blackorchid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimPietrusky/KudosPlease/41f6e627a7b573bbf6c5ee6360cc1c0b4abcf518/img/blackorchid.png
--------------------------------------------------------------------------------
/img/blackorchid_@2X.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimPietrusky/KudosPlease/41f6e627a7b573bbf6c5ee6360cc1c0b4abcf518/img/blackorchid_@2X.jpg
--------------------------------------------------------------------------------
/img/darkocean.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimPietrusky/KudosPlease/41f6e627a7b573bbf6c5ee6360cc1c0b4abcf518/img/darkocean.jpg
--------------------------------------------------------------------------------
/img/kudosplease.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimPietrusky/KudosPlease/41f6e627a7b573bbf6c5ee6360cc1c0b4abcf518/img/kudosplease.ico
--------------------------------------------------------------------------------
/img/kudosplease_1337.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimPietrusky/KudosPlease/41f6e627a7b573bbf6c5ee6360cc1c0b4abcf518/img/kudosplease_1337.png
--------------------------------------------------------------------------------
/img/kudosplease_200.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimPietrusky/KudosPlease/41f6e627a7b573bbf6c5ee6360cc1c0b4abcf518/img/kudosplease_200.jpg
--------------------------------------------------------------------------------
/img/winter_sunrise.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimPietrusky/KudosPlease/41f6e627a7b573bbf6c5ee6360cc1c0b4abcf518/img/winter_sunrise.jpg
--------------------------------------------------------------------------------
/img/winter_sunrise_300.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TimPietrusky/KudosPlease/41f6e627a7b573bbf6c5ee6360cc1c0b4abcf518/img/winter_sunrise_300.jpg
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Kudos Please
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
ku·dos Please
38 |
39 |
40 |
To gain kudos is to earn respect and recognition (Urbandirectory).
41 |
42 |
43 |
44 |
45 |
46 |
47 |
50 |
51 |
A one-element kudos widget with no dependencies.
52 |
Works on touch and normal devices.
53 |
The widget interacts with the Kudos Please API so you don't have to worry about saving the amount.
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
1. Insert JS / CSS
67 |
JS
68 |
<script src="kudosplease-min.js"></script>
69 |
CSS
70 |
<link rel="stylesheet" href="kudosplease-min.css">
71 |
72 |
73 |
2. Insert the widget
74 |
HTML
75 |
<div class="kudos" data-amount="0" data-url="domain.tld/my-awesome-article"></div>
76 |
77 | - data-amount - the amount of kudos for a specific url
78 | - data-url - the url to a specific site which receives the widget (without http://)
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
3. Create the widget
87 |
new KudosPlease({
88 | el : '.kudos',
89 | duration : 1500,
90 | persistent : true,
91 | status : {
92 | alpha: 'fontelico-emo-shoot',
93 | beta: 'fontelico-emo-shoot',
94 | gamma: 'fontelico-emo-beer'
95 | }
96 | });
97 |
98 | - el - the class of the kudos dom element
99 | - duration - seconds until the kudos amount is increased
100 | - persistent - [default: true] enables/disables localStorage to prevent the same user from kudoing the same URL again
101 | -
102 | status - adds a class to the widget which represents the content (e.g. icon) of the widget for every status
103 |
104 | - alpha - amount of 0
105 | - beta - amount > 0
106 | - gamma - kudos given (finish)
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
Persistence disabled
119 |
120 | After you reload the page, you can use the widget again.
121 |
122 |
123 |
new KudosPlease({
124 | el : '.kudos--persistent',
125 | duration : 1500,
126 | persistent : false,
127 | status : {
128 | alpha: '',
129 | beta: '',
130 | gamma: 'fontelico-emo-sunglasses'
131 | }
132 | });
133 |
134 |
135 |
138 |
139 |
140 |
141 |
142 |
158 |
159 |
160 |
161 |
162 |
163 |
164 | Handcrafted 2013 - 2014 by @TimPietrusky.
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
182 |
183 |
184 |
185 |
--------------------------------------------------------------------------------
/js/bundle.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Minify JavaScripts
4 |
5 | # If the output file already exists, we don't want to double its size. Remove it.
6 | if [ -e "./kudosplease-min.js" ]; then
7 | echo -e "Removing existing copy of $BUNDLEFILE."
8 | rm kudosplease-min.js
9 | fi
10 |
11 | yui-compressor -o kudosplease-min.js kudosplease.js
12 |
13 | echo -e "\nDone."
14 | exit 0
15 |
--------------------------------------------------------------------------------
/js/bundle_all.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Minify JavaScripts
4 |
5 | # If the output file already exists, we don't want to double its size. Remove it.
6 | if [ -e "./main-min.js" ]; then
7 | rm main-min.js
8 | fi
9 |
10 | cat kudosplease.js main.js prism.js > main-combined.js
11 |
12 | yui-compressor -o main-min.js main-combined.js
13 |
14 | rm main-combined.js
15 |
16 | echo -e "\nDone."
17 | exit 0
18 |
--------------------------------------------------------------------------------
/js/kudosplease-min.js:
--------------------------------------------------------------------------------
1 | KudosPlease=(function(){var a=document.documentElement.classList,p=!!a,e=function(r,q){return p?function(s,t){if(t!=""){return s.classList[r](t)}}:q},g=e("add",function(s,r){r=r.split(",");for(var q=0;qclass to el
28 | */
29 | addClass = inject('add', function(el, classes) {
30 | classes = classes.split(',');
31 |
32 | for (var i=0; i < classes.length; i++) {
33 | if (el.className.indexOf(classes[i]) == -1) {
34 | el.className = el.className.trim() + ' ' + classes[i];
35 | }
36 | }
37 | }),
38 |
39 | /*
40 | * Remove class
to el
41 | */
42 | removeClass = inject('remove', function(el, classes) {
43 | classes = classes.split(',');
44 |
45 | for (var i = 0; i < classes.length; i++) {
46 | el.className = el.className.replace(classes[i], '').trim();
47 | }
48 | }),
49 |
50 | /*
51 | * Returns true
if el
has
52 | * the class
, false
otherwise
53 | */
54 | hasClass = inject('contains', function(el, className) {
55 | var classes = el.className.split(' '),
56 | result = false;
57 |
58 | for (var i = 0; i < classes.length; i++) {
59 | if (classes[i] == className) {
60 | result = true;
61 | }
62 | }
63 |
64 | return result;
65 | }),
66 | /*
67 | * Change the status of the widget and
68 | * aply 3 different classes for the icon
69 | * in the middle.
70 | */
71 | changeStatus = function(el, state, _$) {
72 | if (_$.status != undefined) {
73 |
74 | if (el.getAttribute('data-status') != undefined) {
75 | removeClass(el, _$.status[el.getAttribute('data-status')]);
76 | }
77 |
78 | addClass(el, _$.status[state]);
79 | el.setAttribute('data-status', state);
80 | }
81 | },
82 |
83 | /*
84 | * State: finished (kudos given)
85 | */
86 | finish = function(el, increase, _$) {
87 | // Finished
88 | addClass(el, 'finish');
89 | changeStatus(el, 'gamma', _$);
90 |
91 | increase = increase || false;
92 | amount = loadAmount(parseInt(el.getAttribute('data-id'), 10), _$);
93 |
94 | if (increase) {
95 | ++amount;
96 |
97 | // Update kudos via ajax
98 | request(el, 'POST', _$);
99 | }
100 | },
101 | /*
102 | * Enter the element
103 | */
104 | enter = function(e, el, _$) {
105 | var id = -1;
106 |
107 | // Do the kudo twist
108 | if (!hasClass(el, 'finish')) {
109 | // Activate the kudo twist
110 | addClass(el, 'active');
111 |
112 | // Start timeout
113 | id = setTimeout(function() {
114 | removeClass(el, 'active');
115 | finish(el, true, _$);
116 | }, _$.duration);
117 |
118 | // Add timeout id to global object
119 | _$.timer[el.getAttribute('data-id')] = id;
120 | }
121 | },
122 | /*
123 | * Touch enter the element
124 | */
125 | touchEnter = function(e, el, _$){
126 | // Only execute on single finger touch to allow zooming.
127 | if (e.touches.length === 1){
128 | // prevent from propagation and preventDefault. So we can use both touch events and mouse events.
129 | e.stopPropagation();
130 | e.preventDefault();
131 |
132 | // Execute "normal" enter function
133 | enter(e, el, _$);
134 | }
135 | },
136 |
137 | /*
138 | * Leave the element
139 | */
140 | out = function(e, el, _$) {
141 | if (!hasClass(el, 'finish')) {
142 | removeClass(el, 'active');
143 | clearTimeout(_$.timer[el.getAttribute('data-id')]);
144 | }
145 | },
146 | /*
147 | * Bind event
148 | */
149 | on = function(el, event, func, _$) {
150 | try {
151 | el.addEventListener(event, function(e) { func(e, el, _$); }, false);
152 | } catch(e) {
153 | el.attachEvent('on' + event, function(e) { func(e, el, _$); });
154 | }
155 | },
156 |
157 | /*
158 | * Saves the amount of a specific widget into localStorage
159 | * when persistent
is true
.
160 | */
161 | save = function(el, amount, _$) {
162 | if (_$.persistent) {
163 | window.localStorage.setItem('kudos:saved:' + el.getAttribute('data-url'), amount);
164 | }
165 | },
166 |
167 | /*
168 | * Loads the amount of a specific widget from the localStorage
169 | * when persistent
is true
.
170 | */
171 | loadAmount = function(id, _$) {
172 | var result = _$.elements[id].getAttribute('data-amount') || 0;
173 |
174 | if (_$.persistent) {
175 | if ((amount = window.localStorage.getItem('kudos:saved:' + _$.elements[id].getAttribute('data-url'))) != undefined) {
176 | result = amount;
177 | }
178 | }
179 |
180 | return result;
181 | },
182 |
183 |
184 | /*
185 | * Create a ajax request to a backend
186 | * which just keeps track of the kudos counter
187 | * via php & mysql
188 | */
189 | request = function(el, type, _$) {
190 | var xhr;
191 |
192 | // Initialize
193 | try {
194 | xhr = new ActiveXObject("Microsoft.XMLHTTP");
195 | } catch(e) {
196 | xhr = new XMLHttpRequest();
197 | }
198 |
199 | // Response received
200 | xhr.onreadystatechange = function() {
201 | if (xhr.readyState == 4 && xhr.status == 200) {
202 | var amount = xhr.responseText;
203 | el.setAttribute('data-amount', amount);
204 |
205 | if (type == 'GET') {
206 | // Set status based on amount
207 | changeStatus(el, amount == 0 ? 'alpha' : 'beta', _$);
208 |
209 | // When persistence is activated and a value was saved for the URL,
210 | // the kudos widget is in status gamma (finished)
211 | if (_$.persistent
212 | && window.localStorage.getItem('kudos:saved:' + el.getAttribute('data-url')) != null) {
213 | changeStatus(el, 'gamma', _$);
214 | }
215 | }
216 |
217 | if (type == 'POST') {
218 | save(el, amount, _$);
219 | }
220 | }
221 | };
222 |
223 | var url = "?url="+encodeURIComponent(el.getAttribute('data-url'));
224 | // Open request
225 | xhr.open(type, "http://api.kudosplease.com/" + url, true);
226 | xhr.send();
227 | };
228 |
229 | /*
230 | * Constructor
231 | */
232 | function KudosPlease(args) {
233 | // All widgets
234 | this.elements = document.querySelectorAll(args.el);
235 | // Set the status
236 | this.status = args.status;
237 | // Is localStorage enabled?
238 | this.persistent = args.persistent != undefined ? (args.persistent && window.localStorage != undefined) : true;
239 | // Duration of activation
240 | this.duration = args.duration;
241 | // setTimeout-ID's
242 | this.timer = {};
243 |
244 | for (var i = 0; i < this.elements.length; i++) {
245 | var el = this.elements[i];
246 |
247 | // Delete all elements from localStorage
248 | // localStorage.setItem('kudos:saved:'+el.getAttribute('data-url'), 0);
249 |
250 | // Identify element
251 | el.setAttribute('data-id', i);
252 |
253 | // Load kudos via ajax
254 | request(el, 'GET', this);
255 |
256 | // Amount is 0
257 | if (loadAmount(i, this) == 0) {
258 | // Set kudos amount
259 | el.setAttribute('data-amount', 0);
260 |
261 | // Init timer id
262 | this.timer[i] = -1;
263 |
264 | // Events, both touch and mouse
265 | on(el, 'touchstart', touchEnter, this);
266 | on(el, 'touchend', out, this);
267 | on(el, 'mouseover', enter, this);
268 | on(el, 'mouseout', out, this);
269 |
270 | // Load the amount and display it, because user already voted
271 | } else {
272 | finish(el, false, this);
273 | }
274 | }
275 |
276 | return this;
277 | }
278 |
279 | // trim polyfill
280 | ''.trim || (String.prototype.trim = function(){
281 | return this.replace(/^\s+|\s+$/g,'');
282 | });
283 |
284 | return KudosPlease;
285 | })();
--------------------------------------------------------------------------------
/js/main-min.js:
--------------------------------------------------------------------------------
1 | KudosPlease=(function(){var a=document.documentElement.classList,p=!!a,e=function(s,q){return p?function(t,u){if(u!=""){return t.classList[s](u)}}:q},g=e("add",function(t,s){s=s.split(",");for(var q=0;q/g,">").replace(/\u00a0/g," ");var h={element:e,language:g,grammar:p,code:k};a.hooks.run("before-highlight",h);if(j&&self.Worker){var m=new Worker(a.filename);m.onmessage=function(f){h.highlightedCode=d.stringify(JSON.parse(f.data));h.element.innerHTML=h.highlightedCode;q&&q.call(h.element);a.hooks.run("after-highlight",h)};m.postMessage(JSON.stringify({language:h.language,code:h.code}))}else{h.highlightedCode=a.highlight(h.code,h.grammar);h.element.innerHTML=h.highlightedCode;q&&q.call(e);a.hooks.run("after-highlight",h)}},highlight:function(g,f){return d.stringify(a.tokenize(g,f))},tokenize:function(H,A){var w=a.Token,D=[H],t=A.rest;if(t){for(var z in t){A[z]=t[z]}delete A.rest}H:for(var z in A){if(!A.hasOwnProperty(z)||!A[z]){continue}var q=A[z],L=q.inside,G=!!q.lookbehind||0;q=q.pattern||q;for(var C=0;CH.length){break H}if(J instanceof w){continue}q.lastIndex=0;var E=q.exec(J);if(E){G&&(G=E[1].length);var x=E.index-1+G,E=E[0].slice(G),I=E.length,k=x+I,B=J.slice(0,x+1),F=J.slice(k+1),j=[C,1];B&&j.push(B);var K=new w(z,L?a.tokenize(E,L):E);j.push(K);F&&j.push(F);Array.prototype.splice.apply(D,j)}}}return D},hooks:{all:{},add:function(g,h){var f=a.hooks.all;f[g]=f[g]||[];f[g].push(h)},run:function(j,k){var h=a.hooks.all[j];if(!h||!h.length){return}for(var f=0,g;g=h[f++];){g(k)}}}},d=a.Token=function(g,f){this.type=g;this.content=f};d.stringify=function(j){if(typeof j=="string"){return j}if(Object.prototype.toString.call(j)=="[object Array]"){return j.map(d.stringify).join("")}var h={type:j.type,content:d.stringify(j.content),tag:"span",classes:["token",j.type],attributes:{}};h.type=="comment"&&(h.attributes.spellcheck="true");a.hooks.run("wrap",h);var f="";for(var g in h.attributes){f+=g+'="'+(h.attributes[g]||"")+'"'}return"<"+h.tag+' class="'+h.classes.join(" ")+'" '+f+">"+h.content+""+h.tag+">"};if(!self.document){self.addEventListener("message",function(h){var j=JSON.parse(h.data),g=j.language,f=j.code;self.postMessage(JSON.stringify(a.tokenize(f,a.languages[g])));self.close()},!1);return}var b=document.getElementsByTagName("script");b=b[b.length-1];if(b){a.filename=b.src;document.addEventListener&&!b.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",a.highlightAll)}})();Prism.languages.markup={comment:/<!--[\w\W]*?--(>|>)/g,prolog:/<\?.+?\?>/,doctype:/<!DOCTYPE.+?>/,cdata:/<!\[CDATA\[[\w\W]+?]]>/i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&#?[\da-z]{1,8};/gi};Prism.hooks.add("wrap",function(a){a.type==="entity"&&(a.attributes.title=a.content.replace(/&/,"&"))});Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:/@[\w-]+?(\s+[^;{]+)?(?=\s*{|\s*;)/gi,url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\}]*(?=\s*\{)/g,property:/(\b|\B)[a-z-]+(?=\s*:)/ig,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,ignore:/&(lt|gt|amp);/gi,punctuation:/[\{\};:]/g};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<|<)style[\w\W]*?(>|>)[\w\W]*?(<|<)\/style(>|>)/ig,inside:{tag:{pattern:/(<|<)style[\w\W]*?(>|>)|(<|<)\/style(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css}}});Prism.languages.clike={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|[^:]\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,number:/\b-?(0x)?\d*\.?[\da-f]+\b/g,operator:/[-+]{1,2}|!|=?<|=?>|={1,2}|(&){1,2}|\|?\||\?|\*|\//g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|catch|finally|null|break|continue)\b/g,number:/\b(-?(0x)?\d*\.?[\da-f]+|NaN|-?Infinity)\b/g});Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}});Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<|<)script[\w\W]*?(>|>)[\w\W]*?(<|<)\/script(>|>)/ig,inside:{tag:{pattern:/(<|<)script[\w\W]*?(>|>)|(<|<)\/script(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}});
--------------------------------------------------------------------------------
/js/main.js:
--------------------------------------------------------------------------------
1 | function r(f){/in/.test(document.readyState)?setTimeout('r('+f+')',9):f()}
2 |
3 | r(function() {
4 | /*
5 | * Create Kudos Please widget
6 | */
7 | new KudosPlease({
8 | el : '.kudos--default',
9 | duration : 1500,
10 | status : {
11 | alpha: 'fontelico-emo-shoot',
12 | beta: 'fontelico-emo-shoot',
13 | gamma: 'fontelico-emo-beer'
14 | }
15 | });
16 |
17 | /*
18 | * Create a Kudos Please widget and disable persistence
19 | */
20 | new KudosPlease({
21 | el : '.kudos--persistent',
22 | duration : 1500,
23 | persistent : false,
24 | status : {
25 | alpha: '',
26 | beta: '',
27 | gamma: 'fontelico-emo-sunglasses'
28 | }
29 | });
30 | });
--------------------------------------------------------------------------------
/js/prism.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Prism: Lightweight, robust, elegant syntax highlighting
3 | * MIT license http://www.opensource.org/licenses/mit-license.php/
4 | * @author Lea Verou http://lea.verou.me
5 | */(function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]=t.util.clone(e[i]));return r;case"Array":return e.slice()}return e}},languages:{extend:function(e,n){var r=t.util.clone(t.languages[e]);for(var i in n)r[i]=n[i];return r},insertBefore:function(e,n,r,i){i=i||t.languages;var s=i[e],o={};for(var u in s)if(s.hasOwnProperty(u)){if(u==n)for(var a in r)r.hasOwnProperty(a)&&(o[a]=r[a]);o[u]=s[u]}return i[e]=o},DFS:function(e,n){for(var r in e){n.call(e,r,e[r]);t.util.type(e)==="Object"&&t.languages.DFS(e[r],n)}}},highlightAll:function(e,n){var r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');for(var i=0,s;s=r[i++];)t.highlightElement(s,e===!0,n)},highlightElement:function(r,i,s){var o,u,a=r;while(a&&!e.test(a.className))a=a.parentNode;if(a){o=(a.className.match(e)||[,""])[1];u=t.languages[o]}if(!u)return;r.className=r.className.replace(e,"").replace(/\s+/g," ")+" language-"+o;a=r.parentNode;/pre/i.test(a.nodeName)&&(a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+o);var f=r.textContent;if(!f)return;f=f.replace(/&/g,"&").replace(//g,">").replace(/\u00a0/g," ");var l={element:r,language:o,grammar:u,code:f};t.hooks.run("before-highlight",l);if(i&&self.Worker){var c=new Worker(t.filename);c.onmessage=function(e){l.highlightedCode=n.stringify(JSON.parse(e.data));l.element.innerHTML=l.highlightedCode;s&&s.call(l.element);t.hooks.run("after-highlight",l)};c.postMessage(JSON.stringify({language:l.language,code:l.code}))}else{l.highlightedCode=t.highlight(l.code,l.grammar);l.element.innerHTML=l.highlightedCode;s&&s.call(r);t.hooks.run("after-highlight",l)}},highlight:function(e,r){return n.stringify(t.tokenize(e,r))},tokenize:function(e,n){var r=t.Token,i=[e],s=n.rest;if(s){for(var o in s)n[o]=s[o];delete n.rest}e:for(var o in n){if(!n.hasOwnProperty(o)||!n[o])continue;var u=n[o],a=u.inside,f=!!u.lookbehind||0;u=u.pattern||u;for(var l=0;le.length)break e;if(c instanceof r)continue;u.lastIndex=0;var h=u.exec(c);if(h){f&&(f=h[1].length);var p=h.index-1+f,h=h[0].slice(f),d=h.length,v=p+d,m=c.slice(0,p+1),g=c.slice(v+1),y=[l,1];m&&y.push(m);var b=new r(o,a?t.tokenize(h,a):h);y.push(b);g&&y.push(g);Array.prototype.splice.apply(i,y)}}}return i},hooks:{all:{},add:function(e,n){var r=t.hooks.all;r[e]=r[e]||[];r[e].push(n)},run:function(e,n){var r=t.hooks.all[e];if(!r||!r.length)return;for(var i=0,s;s=r[i++];)s(n)}}},n=t.Token=function(e,t){this.type=e;this.content=t};n.stringify=function(e){if(typeof e=="string")return e;if(Object.prototype.toString.call(e)=="[object Array]")return e.map(n.stringify).join("");var r={type:e.type,content:n.stringify(e.content),tag:"span",classes:["token",e.type],attributes:{}};r.type=="comment"&&(r.attributes.spellcheck="true");t.hooks.run("wrap",r);var i="";for(var s in r.attributes)i+=s+'="'+(r.attributes[s]||"")+'"';return"<"+r.tag+' class="'+r.classes.join(" ")+'" '+i+">"+r.content+""+r.tag+">"};if(!self.document){self.addEventListener("message",function(e){var n=JSON.parse(e.data),r=n.language,i=n.code;self.postMessage(JSON.stringify(t.tokenize(i,t.languages[r])));self.close()},!1);return}var r=document.getElementsByTagName("script");r=r[r.length-1];if(r){t.filename=r.src;document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)}})();;
6 | Prism.languages.markup={comment:/<!--[\w\W]*?--(>|>)/g,prolog:/<\?.+?\?>/,doctype:/<!DOCTYPE.+?>/,cdata:/<!\[CDATA\[[\w\W]+?]]>/i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&#?[\da-z]{1,8};/gi};Prism.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&/,"&"))});;
7 | Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:/@[\w-]+?(\s+[^;{]+)?(?=\s*{|\s*;)/gi,url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\}]*(?=\s*\{)/g,property:/(\b|\B)[a-z-]+(?=\s*:)/ig,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,ignore:/&(lt|gt|amp);/gi,punctuation:/[\{\};:]/g};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<|<)style[\w\W]*?(>|>)[\w\W]*?(<|<)\/style(>|>)/ig,inside:{tag:{pattern:/(<|<)style[\w\W]*?(>|>)|(<|<)\/style(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css}}});;
8 | Prism.languages.clike={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|[^:]\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,number:/\b-?(0x)?\d*\.?[\da-f]+\b/g,operator:/[-+]{1,2}|!|=?<|=?>|={1,2}|(&){1,2}|\|?\||\?|\*|\//g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};;
9 | Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|catch|finally|null|break|continue)\b/g,number:/\b(-?(0x)?\d*\.?[\da-f]+|NaN|-?Infinity)\b/g});Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}});Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<|<)script[\w\W]*?(>|>)[\w\W]*?(<|<)\/script(>|>)/ig,inside:{tag:{pattern:/(<|<)script[\w\W]*?(>|>)|(<|<)\/script(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}});;
10 |
--------------------------------------------------------------------------------