jQuery(function($) {
// show tooltips only when not touchscreen
if (!('ontouchstart' in window)) $('[data-toggle="tooltip"]').tooltip({container: 'body'})
// display the message only 2 times
var displayed = parseInt(localStorage.getItem('welcome.classic.ace') || '0');
if (displayed < 2) {
localStorage.setItem('welcome.classic.ace', displayed + 1)
$.aceToaster.add({
placement: 'tc',
body: "
\
\
\
\
\
\
Welcome to Ace!
\
A lightweight, feature-rich, customizable and easy to use admin template!
\
\
\
",
width: 500,
delay: 10,
//sticky: true,
progress: 'position-tl bgc-success-tp1 pt-3px',
progressReverse: true,
close: false,
//belowNav: true,
className: 'bgc-white overflow-hidden border-0 p-0 radius-0',
bodyClass: 'border-1 border-t-0 brc-secondary-l2 text-dark-tp3 text-120 p-2',
headerClass: 'd-none'
})
}
//////////////////////////////////////////////////
// Sortable task list
Sortable.create(document.getElementById('tasks'), {
draggable: ".task-item",
filter: "label.checkbox",
preventOnFilter: false,
animation: 200,
ghostClass: "bgc-yellow-l1", // Class name for the drop placeholder
chosenClass: "", // Class name for the chosen item
dragClass: "", // Class name for the dragging item
})
// toggle tasks checkbox on/off
$('#tasks input[type=checkbox]').on('change', function() {
$(this).closest('#tasks > div').toggleClass('bgc-secondary-l4', this.checked).find('label').toggleClass('line-through text-grey-d2', this.checked);
})
//////////////////////////////////////////////////
//draw charts
// make sure no animation is displayed according to user preferences
var _animate = !AceApp.Util.isReducedMotion()
// Traffic Sources piechart
var trafficSourceCanvas = document.getElementById('traffic-source-chart');
var trafficSourcePieChart = new Chart(trafficSourceCanvas, {
type: 'doughnut',
data: {
datasets: [{
label: 'Traffic Sources',
data: [40.7, 27.5, 9.3, 19.6, 4.9],
backgroundColor: [
"#4ca5ae",
"#f18e5d",
"#ea789d",
"#22c1e4",
"#e2e3e4"
],
}],
labels: [
'Social Networks',
'Search Engines',
'Ad Campaings',
'Direct Traffic',
'Other'
]
},
options: {
responsive: true,
cutoutPercentage: 70,
legend: {
display: false
},
animation: {
animateRotate: true,
duration: _animate ? 1000 : false
},
tooltips: {
enabled: true,
cornerRadius: 0,
bodyFontColor: '#fff',
bodyFontSize: 14,
fontStyle: 'bold',
backgroundColor: 'rgba(34, 34, 34, 0.73)',
borderWidth: 0,
caretSize: 5,
xPadding: 12,
yPadding: 12,
callbacks: {
label: function(tooltipItem, data) {
return ' ' + data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index] + '%'
}
}
}
}
})
// place the legends
$(trafficSourceCanvas)
.parent().after("