/**
* pBar 2.0
* pBar is a simple jQuery plugin to show inline progress bar
*
* Copyright 2016, Atul Gupta
* Licensed under the MIT license.
* https://github.com/lastdates/pBar
*
* Date: Sat Mar 26 2016 14:57:11 GMT+0530 (IST)
*/
(function($){
var color,
i,
Color='color',
Title='title',
Onclick='onclick',
This='$(this)',
Div='
50)?to-50:to+50);
color=(colr||$bar.data(Color)||'#b32,#d31,#ea6,#fa6,#fd8,#ad6,#9c6,#5b6,#6a7').split(Coma);
$bar.html(Div+pickColor(from)+Width+from+'%">
')
.attr(Onclick,This+'.pBar();');
$bar.pBarVal(to);
});
}
$.fn.sBar = function(colr){
return this.each(function(){
var $bar=$(this),
value=$bar.data('value').split(Coma),
name=$bar.data('name').split(Coma),
sum=0,
div='',
title='';
color=(colr||$bar.data(Color)||'#147,#c00,#f00,#fc0,#ff0,#9c5,#0a5,#0ae,#07b,#026,#73a').split(Coma);
i=value.length; while(i--) sum += value[i]*1;
for(i=0;i';
if(value[i]*1) title+=''+value[i]+''+name[i]+' '+Div+color[i]+';" class="sBarTd" data-to="'+(value[i]*100/sum)+'">';
}
$bar.html(div+''+title+'')
.data(Color,color.join(Coma))
.attr(Onclick,This+'.sBar();');
$bar.find('div').each(function(){
var $div=$(this);
if($div.data('to')) $div.width($div.data('to')+Percent);
});
});
}
$("").appendTo("head");
$(document).ready(function(){$('.pBar').pBar();$('.sBar').sBar();});
})(jQuery);