• Stars
    star
    412
  • Rank 105,024 (Top 3 %)
  • Language
    CSS
  • Created over 12 years ago
  • Updated about 11 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An example of Svbtle style kudos

Kudos

Dustin Kurtis came up with an excellent idea for the Svbtle blogging network (go visit Svbtle.com to see an example). He called them Kudos. They're little widgets next to each post that enable users to give "Kudos" to posts they really like. You hover over the widget, it gives a fun little animation, and changes the icon and count after a moment.

This is an example implementation of that for you to use in your own blog.

Screenshots

Start -> pre-kudo -> Funky Animation Here-> post-kudo -> Finish.

Demo

here

Basic Usage:

WordPress people

ahoereth has put together a wordpress plugin (source here) based on this.

Everyone else

See the index.html example for information

    <figure class="kudo kudoable" data-id="1">
        <a class="kudobject">
            <div class="opening">
                <div class="circle">&nbsp;</div>
            </div>
        </a>
        <a href="#kudo" class="count">
            <span class="num">0</span>
            <span class="txt">Kudos</span>
        </a>
    </figure>
$(function()
{
  // initialize the kudoer
  $("figure.kudo").kudoable();
});

// bind to events on the kudos
$("figure.kudo").on("kudo:added", function(event)
{
  var element = $(this);
  var id = element.data('id');
  // send the data to your server...
  console.log("Kudod", element);
});

Events

After kudoing an object it will emit the following events:

  1. kudo:active is sent when you hover over the object (the circle is growing)
  2. kudo:inactive is sent when you mouse-off the object
  3. kudo:added is sent when you successfully kudo something
  4. kudo:removed is sent when you un-kudo something

Important Note

(Primarily for people new to HTML / CSS who don't normally write back-end code.)

This is the client side of the equation. It will work quite well, but without a server-side component there will be no way to sum up all the kudos. Each person's browser will know that they gave it a Kudo, but if you don't store the information in some centralized location there's no way they could possibly know that anyone else gave it a Kudo. This means that the maximum number anyone will see is 1 (the one they gave it) unless you send the information to server, store it there, and insert the current count every time the page is loaded.

This is how the internet works. This is not a limitation of this library.

This codebase specifically does not contain any back-end code because it would not only be different in every language it would be different in every framework, and different in every usage of every framework. Storing a running count is very easy to do, but how you should go about it is unique to how you are choosing to track user interactions.

Sub-note

This implementation stores one cookie for every Kudo given. If someone Kudos everything you put out there you'll eventually hit the maximum number of cookies you're allowed to give them. Because dynamic cookie handling is as unique to your back end as the solution to how you'll keep track of the Kudos given to a thing, this demo-code does not address this limitation. Again, it's trivial enough to do, you just have to decide how you want to do it.

Improvements

Make some! ;) The animation of the text isn't bad but could use some love from a css wizard. Pull-requests will be happily applied.

jQuery

Kudos currently depends on jQuery and a good cookie library like the jQuery Cookie plugin to keep track of who's voted already, but as there is so little code it would be very easy to modify to use a different library if you had such a need.

License

This code is distributed under the MIT license, however, it includes a copy of jQuery which is dual licensed under MIT or GPL (your choice) and it also includes a copy of jQuery Cookie which is licensed under the MIT license. Portions of the CSS code are from the wordpress-svbtle Wordpress theme.

More Repositories

1

vim-markdown-folding

Fold markdown documents by section.
Vim Script
248
star
2

arc90-readability

A copy of the original Arc90 repo with links to many of the current ports.
PHP
214
star
3

JekyllMail

JekyllMail enables you to post to your Jekyll / Octopress powered blog by email.
Ruby
119
star
4

aspirin

Aspirin is an embeddable send-only SMTP server.
Java
90
star
5

mobtvse

Working towards being the worlds best Markdown blogging app...
JavaScript
45
star
6

private_comments

a tool for managing private comments on, but not in, your files
Scheme
44
star
7

hey

Hey allows you to track your interruptions as they occur.
JavaScript
31
star
8

oho

oho: converts colorful terminal output to html
Crystal
30
star
9

jsonpath-perl

Perl port of JSONPath
Perl
23
star
10

git_accessories

assorted little helper scripts for git
Shell
22
star
11

changelog_manager

A tool to let a team add CHANGELOG entries without constant conflicts.
Crystal
19
star
12

omniauth-dwolla

Dwolla OAuth2 Strategy for OmniAuth 1.0.
Ruby
17
star
13

private-comments-mode

Emacs Lisp
15
star
14

cleandiff

CleanDiff is a better diffing tool, that's easier on your brain.
Shell
11
star
15

hey_3

Hey! An Interruption and Time Tracking Command line app.
Raku
11
star
16

passbook2

Ruby Gem to generate Apple Passbook files.
Ruby
10
star
17

git-status-report

a git tool for creating weekly status reports
Ruby
10
star
18

masuconfigs

masukomi's collection of configuration files, and common scripts.
Vim Script
7
star
19

rtest

An RSpec wrapper to cut down on noise and simplify rerunning tests.
Ruby
6
star
20

fenestro

ingests HTML from the command line and renders it in helpful windows
Swift
5
star
21

backup_brain

A self-hosted bookmarks manager with "Reader View" style link archiving.
Ruby
4
star
22

tampermonkey_scripts

JavaScript
4
star
23

got

A simple shell script that makes it trivial to see if a process is running and give you the details.
4
star
24

dwdiff-annotated

an annotated version of the dwdiff source code
C
3
star
25

vim_private_comments

a vim plugin for private comments
Vim Script
3
star
26

sentence_options

A command line options parser for sentence-like human interfaces to your apps.
Crystal
3
star
27

Definitely

An implementation of the Maybe Monad for Raku
Raku
3
star
28

readable_url

Simplify URL content with Readability & optionally convert to Markdown.
Rust
3
star
29

Terminal-Graphing-BarChart

Raku Library for generating Bar Charts for the Command Line
Raku
3
star
30

ob-raku

Raku support for org-babel
Emacs Lisp
3
star
31

passy

A password generator for Ubiquity
JavaScript
2
star
32

gpup

Makes it easy to push to the upstream git branch, and eliminates possibility of force pushing to the wrong place.
Shell
2
star
33

crystal_fmt

produces text tables from a grid of strings
Crystal
2
star
34

masubiquity

A collection of Ubiquity commands written by masukomi
JavaScript
2
star
35

html_encode_decode

A Vim plugin to encode and decode HTML entities
Vim Script
2
star
36

UUID-V4

Raku library to generate a random v4 UUID (Universally Unique IDentifier)
Raku
2
star
37

acl_plus_rbac

Rails plugin supporting Access Control Lists + Role Based Authorization
Ruby
2
star
38

mdcd

MarkDown Code Documentation (for Chicken Scheme)
Scheme
2
star
39

graceful_disasters

Source Documents for the Graceful Disasters Incident Management Process http://gracefuldisasters.com
2
star
40

git_branch_finder

A tool too help you find that branch you did that thing in.
Shell
1
star
41

postcircumfix-test

a test package demonstrating a potential bug in postcircumfix
Raku
1
star
42

crystal_cli_graph

a command line graph generator for crystal
Crystal
1
star
43

grouped_settings

A port of Alex Wayne's Settings plugin that adds support for groups of settings.
Ruby
1
star
44

hey_2

Hey, the interrupt tracker (version 2)
Crystal
1
star
45

jiok

Go
1
star
46

XDG-GuaranteedResources

Guarantees that a resource is present in the expected XDG Base Directory directory
Raku
1
star
47

gh-open-branch-pr

Easily find and open a GitHub PR from your current branch.
Ruby
1
star
48

Listicles

Adds convenience methods to Array
Raku
1
star
49

Prettier-Table

A simple Raku module to make it quick and easy to represent tabular data in visually appealing ASCII tables.
Raku
1
star
50

aha

Ansi HTML Adapter
C
1
star