1
0
mirror of https://github.com/tabler/tabler.git synced 2026-08-12 06:12:22 +04:00
This commit is contained in:
codecalm
2018-02-14 22:04:13 +01:00
parent 994dea290b
commit 0f316de5ef
662 changed files with 93074 additions and 0 deletions
+101
View File
@@ -0,0 +1,101 @@
var hexToRgba = function(hex, opacity) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
var rgb = result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : null;
return 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', '+ opacity + ')';
};
$(document).ready(function () {
// Initialize tooltips
$('[data-toggle="tooltip"]').tooltip();
// Initialize popovers
$('[data-toggle="popover"]').popover({
html: true
});
// Function for remove card
$('[data-toggle="card-remove"]').on('click', function (e) {
var $card = $(this).closest('div.card');
$card.remove();
e.preventDefault();
return false;
});
// Function for collapse card
$('[data-toggle="card-collapse"]').on('click', function (e) {
var $this = $(this),
$card = $this.closest('div.card');
$card.toggleClass('card-collapsed');
e.preventDefault();
return false;
});
// Function for fullscreen card
$('[data-toggle="card-fullscreen"]').on('click', function(e) {
var $card = $(this).closest('div.card');
$card.toggleClass('card-fullscreen').removeClass('card-collapsed');
e.preventDefault();
return false;
});
if($('[data-sparkline]').length) {
var generateSparkline = function($elem, data, params) {
$elem.sparkline(data, {
type: $elem.attr('data-sparkline-type'),
height: '100%',
barColor: params.color,
lineColor: params.color,
fillColor: 'transparent',
spotColor: params.color,
spotRadius: 0,
lineWidth: 2,
highlightColor: hexToRgba(params.color, .6),
highlightLineColor: '#666',
defaultPixelsPerValue: 5
});
};
require(['sparkline'], function(){
$('[data-sparkline]').each(function(){
var $chart = $(this);
generateSparkline($chart, JSON.parse($chart.attr('data-sparkline')), {
color: $chart.attr('data-sparkline-color')
});
});
});
}
if($('.chart-circle').length) {
require(['circle-progress'], function () {
$('.chart-circle').each(function () {
var $this = $(this);
$this.circleProgress({
fill: {
color: tabler.colors[$this.attr('data-color')] || tabler.colors.blue
},
size: $this.height(),
startAngle: -Math.PI / 4 * 2,
emptyFill: '#F4F4F4',
lineCap: 'round'
});
});
});
}
});
+31
View File
@@ -0,0 +1,31 @@
require.config({
shim: {
'bootstrap': ['jquery'],
'sparkline': ['jquery'],
'tablesorter': ['jquery'],
'vector-map': ['jquery'],
'vector-map-de': ['vector-map', 'jquery'],
'vector-map-world': ['vector-map', 'jquery'],
'core': ['bootstrap'],
},
paths: {
'core': 'assets/js/core',
'jquery': 'assets/js/vendors/jquery-3.2.1.min',
'popper': 'assets/js/vendors/popper.min',
'chart': 'assets/js/vendors/chart.bundle.min',
'bootstrap': 'assets/js/vendors/bootstrap.min',
'sparkline': 'assets/js/vendors/jquery.sparkline.min',
'selectize': 'assets/js/vendors/selectize.min',
'tablesorter': 'assets/js/vendors/jquery.tablesorter.min',
'vector-map': 'assets/js/vendors/jquery-jvectormap-2.0.3.min',
'vector-map-de': 'assets/js/vendors/jquery-jvectormap-de-merc',
'vector-map-world': 'assets/js/vendors/jquery-jvectormap-world-mill',
'circle-progress': 'assets/js/vendors/circle-progress.min',
}
});
window.tabler = {
colors: {"blue":"#467fcf","azure":"#45aaf2","indigo":"#6574cd","purple":"#a55eea","pink":"#f66d9b","red":"#e74c3c","orange":"#fd9644","yellow":"#f1c40f","lime":"#7bd235","green":"#5eba00","teal":"#2bcbba","cyan":"#17a2b8","gray":"#868e96","gray-dark":"#343a40"}
};
require(['core']);
+5
View File
File diff suppressed because one or more lines are too long
+7
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+10
View File
@@ -0,0 +1,10 @@
/**
* jquery-circle-progress - jQuery Plugin to draw animated circular progress bars:
* {@link http://kottenator.github.io/jquery-circle-progress/}
*
* @author Rostyslav Bryzgunov <kottenator@gmail.com>
* @version 1.2.2
* @licence MIT
* @preserve
*/
!function(i){if("function"==typeof define&&define.amd)define(["jquery"],i);else if("object"==typeof module&&module.exports){var t=require("jquery");i(t),module.exports=t}else i(jQuery)}(function(i){function t(i){this.init(i)}t.prototype={value:0,size:100,startAngle:-Math.PI,thickness:"auto",fill:{gradient:["#3aeabb","#fdd250"]},emptyFill:"rgba(0, 0, 0, .1)",animation:{duration:1200,easing:"circleProgressEasing"},animationStartValue:0,reverse:!1,lineCap:"butt",insertMode:"prepend",constructor:t,el:null,canvas:null,ctx:null,radius:0,arcFill:null,lastFrameValue:0,init:function(t){i.extend(this,t),this.radius=this.size/2,this.initWidget(),this.initFill(),this.draw(),this.el.trigger("circle-inited")},initWidget:function(){this.canvas||(this.canvas=i("<canvas>")["prepend"==this.insertMode?"prependTo":"appendTo"](this.el)[0]);var t=this.canvas;if(t.width=this.size,t.height=this.size,this.ctx=t.getContext("2d"),window.devicePixelRatio>1){var e=window.devicePixelRatio;t.style.width=t.style.height=this.size+"px",t.width=t.height=this.size*e,this.ctx.scale(e,e)}},initFill:function(){function t(){var t=i("<canvas>")[0];t.width=e.size,t.height=e.size,t.getContext("2d").drawImage(g,0,0,r,r),e.arcFill=e.ctx.createPattern(t,"no-repeat"),e.drawFrame(e.lastFrameValue)}var e=this,a=this.fill,n=this.ctx,r=this.size;if(!a)throw Error("The fill is not specified!");if("string"==typeof a&&(a={color:a}),a.color&&(this.arcFill=a.color),a.gradient){var s=a.gradient;if(1==s.length)this.arcFill=s[0];else if(s.length>1){for(var l=a.gradientAngle||0,o=a.gradientDirection||[r/2*(1-Math.cos(l)),r/2*(1+Math.sin(l)),r/2*(1+Math.cos(l)),r/2*(1-Math.sin(l))],h=n.createLinearGradient.apply(n,o),c=0;c<s.length;c++){var d=s[c],u=c/(s.length-1);i.isArray(d)&&(u=d[1],d=d[0]),h.addColorStop(u,d)}this.arcFill=h}}if(a.image){var g;a.image instanceof Image?g=a.image:(g=new Image,g.src=a.image),g.complete?t():g.onload=t}},draw:function(){this.animation?this.drawAnimated(this.value):this.drawFrame(this.value)},drawFrame:function(i){this.lastFrameValue=i,this.ctx.clearRect(0,0,this.size,this.size),this.drawEmptyArc(i),this.drawArc(i)},drawArc:function(i){if(0!==i){var t=this.ctx,e=this.radius,a=this.getThickness(),n=this.startAngle;t.save(),t.beginPath(),this.reverse?t.arc(e,e,e-a/2,n-2*Math.PI*i,n):t.arc(e,e,e-a/2,n,n+2*Math.PI*i),t.lineWidth=a,t.lineCap=this.lineCap,t.strokeStyle=this.arcFill,t.stroke(),t.restore()}},drawEmptyArc:function(i){var t=this.ctx,e=this.radius,a=this.getThickness(),n=this.startAngle;i<1&&(t.save(),t.beginPath(),i<=0?t.arc(e,e,e-a/2,0,2*Math.PI):this.reverse?t.arc(e,e,e-a/2,n,n-2*Math.PI*i):t.arc(e,e,e-a/2,n+2*Math.PI*i,n),t.lineWidth=a,t.strokeStyle=this.emptyFill,t.stroke(),t.restore())},drawAnimated:function(t){var e=this,a=this.el,n=i(this.canvas);n.stop(!0,!1),a.trigger("circle-animation-start"),n.css({animationProgress:0}).animate({animationProgress:1},i.extend({},this.animation,{step:function(i){var n=e.animationStartValue*(1-i)+t*i;e.drawFrame(n),a.trigger("circle-animation-progress",[i,n])}})).promise().always(function(){a.trigger("circle-animation-end")})},getThickness:function(){return i.isNumeric(this.thickness)?this.thickness:this.size/14},getValue:function(){return this.value},setValue:function(i){this.animation&&(this.animationStartValue=this.lastFrameValue),this.value=i,this.draw()}},i.circleProgress={defaults:t.prototype},i.easing.circleProgressEasing=function(i){return i<.5?(i=2*i,.5*i*i*i):(i=2-2*i,1-.5*i*i*i)},i.fn.circleProgress=function(e,a){var n="circle-progress",r=this.data(n);if("widget"==e){if(!r)throw Error('Calling "widget" method on not initialized instance is forbidden');return r.canvas}if("value"==e){if(!r)throw Error('Calling "value" method on not initialized instance is forbidden');if("undefined"==typeof a)return r.getValue();var s=arguments[1];return this.each(function(){i(this).data(n).setValue(s)})}return this.each(function(){var a=i(this),r=a.data(n),s=i.isPlainObject(e)?e:{};if(r)r.init(s);else{var l=i.extend({},a.data());"string"==typeof l.fill&&(l.fill=JSON.parse(l.fill)),"string"==typeof l.animation&&(l.animation=JSON.parse(l.animation)),s=i.extend(l,s),s.el=a,r=new t(s),a.data(n,r)}})}});
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+3829
View File
File diff suppressed because it is too large Load Diff