Hakim El Hattab
Swedish designer/developer working on Slides.com
SL( 'components' ).Kudos = (function(){
// A hash of deck_id:kudos_count
var cache = {};
// Flag set while interacting with server
var busy = false;
function initialize() {
// Cache initial kudos values
$( '[data-kudos-value][data-kudos-id]' ).each( function( i, el ) {
var id = el.getAttribute( 'data-kudos-id' );
if( id && !cache[id] ) {
cache[id] = el.getAttribute( 'data-kudos-value' );
}
}.bind( this ) );
// Bind kudos triggers
$( '.kudos-trigger[data-kudos-id]' ).on( 'click', function( event ) {
var el = event.currentTarget;
if( el.getAttribute( 'data-kudoed-by-user' ) === 'true' ) {
unkudo( el.getAttribute( 'data-kudos-id' ) );
}
else {
kudo( el.getAttribute( 'data-kudos-id' ) );
}
}.bind( this ) );
}
});
Foreground:
Foreground + background:
Opacity:
Border
By Hakim El Hattab