Git Product home page Git Product logo

kudos's Introduction

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');
  // do something with the element?
  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

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.

kudos's People

Contributors

masukomi avatar robhurring avatar pehrlich avatar lkorth avatar mshwery avatar ahoereth avatar

Watchers

Fred avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.