carga
carga
This commit is contained in:
418
static/assets/js/init/chartjs-init.js
Normal file
418
static/assets/js/init/chartjs-init.js
Normal file
@@ -0,0 +1,418 @@
|
||||
( function ( $ ) {
|
||||
"use strict";
|
||||
|
||||
//Team chart
|
||||
var ctx = document.getElementById( "team-chart" );
|
||||
ctx.height = 150;
|
||||
var myChart = new Chart( ctx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: [ "2012", "2013", "2014", "2015", "2016", "2017", "2018" ],
|
||||
type: 'line',
|
||||
defaultFontFamily: 'Montserrat',
|
||||
datasets: [ {
|
||||
data: [ 0, 7, 3, 5, 2, 8, 6 ],
|
||||
label: "Expense",
|
||||
backgroundColor: 'rgba(0,200,155,.35)',
|
||||
borderColor: 'rgba(0,200,155,0.60)',
|
||||
borderWidth: 3.5,
|
||||
pointStyle: 'circle',
|
||||
pointRadius: 5,
|
||||
pointBorderColor: 'transparent',
|
||||
pointBackgroundColor: 'rgba(0,200,155,0.60)',
|
||||
},
|
||||
{
|
||||
data: [ 0, 6, 3, 4, 3, 7, 10 ],
|
||||
label: "Profit",
|
||||
backgroundColor: 'rgba(0,194,146,.25)',
|
||||
borderColor: 'rgba(0,194,146,0.5)',
|
||||
borderWidth: 3.5,
|
||||
pointStyle: 'circle',
|
||||
pointRadius: 5,
|
||||
pointBorderColor: 'transparent',
|
||||
pointBackgroundColor: 'rgba(0,194,146,0.5)',
|
||||
}, ]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
tooltips: {
|
||||
mode: 'index',
|
||||
titleFontSize: 12,
|
||||
titleFontColor: '#000',
|
||||
bodyFontColor: '#000',
|
||||
backgroundColor: '#fff',
|
||||
titleFontFamily: 'Montserrat',
|
||||
bodyFontFamily: 'Montserrat',
|
||||
cornerRadius: 3,
|
||||
intersect: false,
|
||||
},
|
||||
legend: {
|
||||
display: false,
|
||||
position: 'top',
|
||||
labels: {
|
||||
usePointStyle: true,
|
||||
fontFamily: 'Montserrat',
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
scales: {
|
||||
xAxes: [ {
|
||||
display: true,
|
||||
gridLines: {
|
||||
display: false,
|
||||
drawBorder: false
|
||||
},
|
||||
scaleLabel: {
|
||||
display: false,
|
||||
labelString: 'Month'
|
||||
}
|
||||
} ],
|
||||
yAxes: [ {
|
||||
display: true,
|
||||
gridLines: {
|
||||
display: false,
|
||||
drawBorder: false
|
||||
},
|
||||
scaleLabel: {
|
||||
display: true,
|
||||
labelString: 'Value'
|
||||
}
|
||||
} ]
|
||||
},
|
||||
title: {
|
||||
display: false,
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
//Sales chart
|
||||
var ctx = document.getElementById( "sales-chart" );
|
||||
ctx.height = 150;
|
||||
var myChart = new Chart( ctx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: [ "2012", "2013", "2014", "2015", "2016", "2017", "2018" ],
|
||||
type: 'line',
|
||||
defaultFontFamily: 'Montserrat',
|
||||
datasets: [ {
|
||||
label: "Foods",
|
||||
data: [ 0, 30, 15, 110, 50, 63, 120 ],
|
||||
backgroundColor: 'transparent',
|
||||
borderColor: 'rgba(220,53,69,0.75)',
|
||||
borderWidth: 3,
|
||||
pointStyle: 'circle',
|
||||
pointRadius: 5,
|
||||
pointBorderColor: 'transparent',
|
||||
pointBackgroundColor: 'rgba(220,53,69,0.75)',
|
||||
}, {
|
||||
label: "Electronics",
|
||||
data: [ 0, 50, 40, 80, 35, 99, 80 ],
|
||||
backgroundColor: 'transparent',
|
||||
borderColor: 'rgba(40,167,69,0.75)',
|
||||
borderWidth: 3,
|
||||
pointStyle: 'circle',
|
||||
pointRadius: 5,
|
||||
pointBorderColor: 'transparent',
|
||||
pointBackgroundColor: 'rgba(40,167,69,0.75)',
|
||||
} ]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
|
||||
tooltips: {
|
||||
mode: 'index',
|
||||
titleFontSize: 12,
|
||||
titleFontColor: '#000',
|
||||
bodyFontColor: '#000',
|
||||
backgroundColor: '#fff',
|
||||
titleFontFamily: 'Montserrat',
|
||||
bodyFontFamily: 'Montserrat',
|
||||
cornerRadius: 3,
|
||||
intersect: false,
|
||||
},
|
||||
legend: {
|
||||
display: false,
|
||||
labels: {
|
||||
usePointStyle: true,
|
||||
fontFamily: 'Montserrat',
|
||||
},
|
||||
},
|
||||
scales: {
|
||||
xAxes: [ {
|
||||
display: true,
|
||||
gridLines: {
|
||||
display: false,
|
||||
drawBorder: false
|
||||
},
|
||||
scaleLabel: {
|
||||
display: false,
|
||||
labelString: 'Month'
|
||||
}
|
||||
} ],
|
||||
yAxes: [ {
|
||||
display: true,
|
||||
gridLines: {
|
||||
display: false,
|
||||
drawBorder: false
|
||||
},
|
||||
scaleLabel: {
|
||||
display: true,
|
||||
labelString: 'Value'
|
||||
}
|
||||
} ]
|
||||
},
|
||||
title: {
|
||||
display: false,
|
||||
text: 'Normal Legend'
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//line chart
|
||||
var ctx = document.getElementById( "lineChart" );
|
||||
ctx.height = 150;
|
||||
var myChart = new Chart( ctx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: [ "January", "February", "March", "April", "May", "June", "July" ],
|
||||
datasets: [
|
||||
{
|
||||
label: "My First dataset",
|
||||
borderColor: "rgba(0,0,0,.09)",
|
||||
borderWidth: "1",
|
||||
backgroundColor: "rgba(0,0,0,.07)",
|
||||
data: [ 20, 47, 35, 43, 65, 45, 35 ]
|
||||
},
|
||||
{
|
||||
label: "My Second dataset",
|
||||
borderColor: "rgba(0, 194, 146, 0.9)",
|
||||
borderWidth: "1",
|
||||
backgroundColor: "rgba(0, 194, 146, 0.5)",
|
||||
pointHighlightStroke: "rgba(26,179,148,1)",
|
||||
data: [ 16, 32, 18, 27, 42, 33, 44 ]
|
||||
}
|
||||
]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
tooltips: {
|
||||
mode: 'index',
|
||||
intersect: false
|
||||
},
|
||||
hover: {
|
||||
mode: 'nearest',
|
||||
intersect: true
|
||||
}
|
||||
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
//bar chart
|
||||
var ctx = document.getElementById( "barChart" );
|
||||
// ctx.height = 200;
|
||||
var myChart = new Chart( ctx, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul" ],
|
||||
datasets: [
|
||||
{
|
||||
label: "My First dataset",
|
||||
data: [ 65, 59, 80, 81, 56, 55, 45 ],
|
||||
borderColor: "rgba(0, 194, 146, 0.9)",
|
||||
borderWidth: "0",
|
||||
backgroundColor: "rgba(0, 194, 146, 0.5)"
|
||||
},
|
||||
{
|
||||
label: "My Second dataset",
|
||||
data: [ 28, 48, 40, 19, 86, 27, 76 ],
|
||||
borderColor: "rgba(0,0,0,0.09)",
|
||||
borderWidth: "0",
|
||||
backgroundColor: "rgba(0,0,0,0.07)"
|
||||
}
|
||||
]
|
||||
},
|
||||
options: {
|
||||
scales: {
|
||||
yAxes: [ {
|
||||
ticks: {
|
||||
beginAtZero: true
|
||||
}
|
||||
} ]
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
//radar chart
|
||||
var ctx = document.getElementById( "radarChart" );
|
||||
ctx.height = 160;
|
||||
var myChart = new Chart( ctx, {
|
||||
type: 'radar',
|
||||
data: {
|
||||
labels: [ [ "Eating", "Dinner" ], [ "Drinking", "Water" ], "Sleeping", [ "Designing", "Graphics" ], "Coding", "Cycling", "Running" ],
|
||||
datasets: [
|
||||
{
|
||||
label: "My First dataset",
|
||||
data: [ 65, 70, 66, 45, 5, 55, 40 ],
|
||||
borderColor: "rgba(0, 194, 146, 0.6)",
|
||||
borderWidth: "1",
|
||||
backgroundColor: "rgba(0, 194, 146, 0.4)"
|
||||
},
|
||||
{
|
||||
label: "My Second dataset",
|
||||
data: [ 28, 5, 55, 19, 63, 27, 68 ],
|
||||
borderColor: "rgba(0, 194, 146, 0.7",
|
||||
borderWidth: "1",
|
||||
backgroundColor: "rgba(0, 194, 146, 0.5)"
|
||||
}
|
||||
]
|
||||
},
|
||||
options: {
|
||||
legend: {
|
||||
position: 'top'
|
||||
},
|
||||
scale: {
|
||||
ticks: {
|
||||
beginAtZero: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//pie chart
|
||||
var ctx = document.getElementById( "pieChart" );
|
||||
ctx.height = 300;
|
||||
var myChart = new Chart( ctx, {
|
||||
type: 'pie',
|
||||
data: {
|
||||
datasets: [ {
|
||||
data: [ 45, 25, 20, 10 ],
|
||||
backgroundColor: [
|
||||
"rgba(0, 194, 146,0.9)",
|
||||
"rgba(0, 194, 146,0.7)",
|
||||
"rgba(0, 194, 146,0.5)",
|
||||
"rgba(0,0,0,0.07)"
|
||||
],
|
||||
hoverBackgroundColor: [
|
||||
"rgba(0, 194, 146,0.9)",
|
||||
"rgba(0, 194, 146,0.7)",
|
||||
"rgba(0, 194, 146,0.5)",
|
||||
"rgba(0,0,0,0.07)"
|
||||
]
|
||||
|
||||
} ],
|
||||
labels: [
|
||||
"green",
|
||||
"green",
|
||||
"green"
|
||||
]
|
||||
},
|
||||
options: {
|
||||
responsive: true
|
||||
}
|
||||
} );
|
||||
|
||||
//doughut chart
|
||||
var ctx = document.getElementById( "doughutChart" );
|
||||
ctx.height = 150;
|
||||
var myChart = new Chart( ctx, {
|
||||
type: 'doughnut',
|
||||
data: {
|
||||
datasets: [ {
|
||||
data: [ 35, 40, 20, 5 ],
|
||||
backgroundColor: [
|
||||
"rgba(0, 194, 146,0.9)",
|
||||
"rgba(0, 194, 146,0.7)",
|
||||
"rgba(0, 194, 146,0.5)",
|
||||
"rgba(0,0,0,0.07)"
|
||||
],
|
||||
hoverBackgroundColor: [
|
||||
"rgba(0, 194, 146,0.9)",
|
||||
"rgba(0, 194, 146,0.7)",
|
||||
"rgba(0, 194, 146,0.5)",
|
||||
"rgba(0,0,0,0.07)"
|
||||
]
|
||||
|
||||
} ],
|
||||
labels: [
|
||||
"green",
|
||||
"green",
|
||||
"green",
|
||||
"green"
|
||||
]
|
||||
},
|
||||
options: {
|
||||
responsive: true
|
||||
}
|
||||
} );
|
||||
|
||||
//polar chart
|
||||
var ctx = document.getElementById( "polarChart" );
|
||||
ctx.height = 150;
|
||||
var myChart = new Chart( ctx, {
|
||||
type: 'polarArea',
|
||||
data: {
|
||||
datasets: [ {
|
||||
data: [ 15, 18, 10, 7, 19],
|
||||
backgroundColor: [
|
||||
"rgba(0, 194, 146,0.9)",
|
||||
"rgba(0, 194, 146,0.8)",
|
||||
"rgba(0, 194, 146,0.7)",
|
||||
"rgba(0,0,0,0.2)",
|
||||
"rgba(0, 194, 146,0.5)"
|
||||
]
|
||||
|
||||
} ],
|
||||
labels: [
|
||||
"green",
|
||||
"green",
|
||||
"green",
|
||||
"green"
|
||||
]
|
||||
},
|
||||
options: {
|
||||
responsive: true
|
||||
}
|
||||
} );
|
||||
|
||||
// single bar chart
|
||||
var ctx = document.getElementById( "singelBarChart" );
|
||||
ctx.height = 150;
|
||||
var myChart = new Chart( ctx, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: [ "Sun", "Mon", "Tu", "Wed", "Th", "Fri", "Sat" ],
|
||||
datasets: [
|
||||
{
|
||||
label: "My First dataset",
|
||||
data: [ 55, 50, 75, 80, 56, 55, 60 ],
|
||||
borderColor: "rgba(0, 194, 146, 0.9)",
|
||||
borderWidth: "0",
|
||||
backgroundColor: "rgba(0, 194, 146, 0.5)"
|
||||
}
|
||||
]
|
||||
},
|
||||
options: {
|
||||
scales: {
|
||||
yAxes: [ {
|
||||
ticks: {
|
||||
beginAtZero: true
|
||||
}
|
||||
} ]
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
|
||||
|
||||
} )( jQuery );
|
||||
53
static/assets/js/init/datatables-init.js
Normal file
53
static/assets/js/init/datatables-init.js
Normal file
@@ -0,0 +1,53 @@
|
||||
(function ($) {
|
||||
// "use strict";
|
||||
|
||||
|
||||
/* Data Table
|
||||
-------------*/
|
||||
|
||||
|
||||
|
||||
|
||||
$('#bootstrap-data-table').DataTable({
|
||||
lengthMenu: [[10, 20, 50, -1], [10, 20, 50, "All"]],
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#bootstrap-data-table-export').DataTable({
|
||||
dom: 'lBfrtip',
|
||||
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]],
|
||||
buttons: [
|
||||
'copy', 'csv', 'excel', 'pdf', 'print'
|
||||
]
|
||||
});
|
||||
|
||||
$('#row-select').DataTable( {
|
||||
initComplete: function () {
|
||||
this.api().columns().every( function () {
|
||||
var column = this;
|
||||
var select = $('<select class="form-control"><option value=""></option></select>')
|
||||
.appendTo( $(column.footer()).empty() )
|
||||
.on( 'change', function () {
|
||||
var val = $.fn.dataTable.util.escapeRegex(
|
||||
$(this).val()
|
||||
);
|
||||
|
||||
column
|
||||
.search( val ? '^'+val+'$' : '', true, false )
|
||||
.draw();
|
||||
} );
|
||||
|
||||
column.data().unique().sort().each( function ( d, j ) {
|
||||
select.append( '<option value="'+d+'">'+d+'</option>' )
|
||||
} );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})(jQuery);
|
||||
379
static/assets/js/init/flot-chart-init.js
Normal file
379
static/assets/js/init/flot-chart-init.js
Normal file
@@ -0,0 +1,379 @@
|
||||
(function($){
|
||||
|
||||
"use strict"; // Start of use strict
|
||||
|
||||
var SufeeAdmin = {
|
||||
|
||||
cpuLoad: function(){
|
||||
|
||||
var data = [],
|
||||
totalPoints = 300;
|
||||
|
||||
function getRandomData() {
|
||||
|
||||
if ( data.length > 0 )
|
||||
data = data.slice( 1 );
|
||||
|
||||
// Do a random walk
|
||||
|
||||
while ( data.length < totalPoints ) {
|
||||
|
||||
var prev = data.length > 0 ? data[ data.length - 1 ] : 50,
|
||||
y = prev + Math.random() * 10 - 5;
|
||||
|
||||
if ( y < 0 ) {
|
||||
y = 0;
|
||||
} else if ( y > 100 ) {
|
||||
y = 100;
|
||||
}
|
||||
|
||||
data.push( y );
|
||||
}
|
||||
|
||||
// Zip the generated y values with the x values
|
||||
|
||||
var res = [];
|
||||
for ( var i = 0; i < data.length; ++i ) {
|
||||
res.push( [ i, data[ i ] ] )
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
// Set up the control widget
|
||||
|
||||
var updateInterval = 30;
|
||||
$( "#updateInterval" ).val( updateInterval ).change( function () {
|
||||
var v = $( this ).val();
|
||||
if ( v && !isNaN( +v ) ) {
|
||||
updateInterval = +v;
|
||||
if ( updateInterval < 1 ) {
|
||||
updateInterval = 1;
|
||||
} else if ( updateInterval > 3000 ) {
|
||||
updateInterval = 3000;
|
||||
}
|
||||
$( this ).val( "" + updateInterval );
|
||||
}
|
||||
} );
|
||||
|
||||
var plot = $.plot( "#cpu-load", [ getRandomData() ], {
|
||||
series: {
|
||||
shadowSize: 0 // Drawing is faster without shadows
|
||||
},
|
||||
yaxis: {
|
||||
min: 0,
|
||||
max: 100
|
||||
},
|
||||
xaxis: {
|
||||
show: false
|
||||
},
|
||||
colors: [ "#00c292" ],
|
||||
grid: {
|
||||
color: "transparent",
|
||||
hoverable: true,
|
||||
borderWidth: 0,
|
||||
backgroundColor: 'transparent'
|
||||
},
|
||||
tooltip: true,
|
||||
tooltipOpts: {
|
||||
content: "Y: %y",
|
||||
defaultTheme: false
|
||||
}
|
||||
|
||||
|
||||
} );
|
||||
|
||||
function update() {
|
||||
|
||||
plot.setData( [ getRandomData() ] );
|
||||
|
||||
// Since the axes don't change, we don't need to call plot.setupGrid()
|
||||
|
||||
plot.draw();
|
||||
setTimeout( update, updateInterval );
|
||||
}
|
||||
|
||||
update();
|
||||
|
||||
},
|
||||
|
||||
lineFlot: function(){
|
||||
|
||||
var sin = [],
|
||||
cos = [];
|
||||
|
||||
for ( var i = 0; i < 10; i += 0.1 ) {
|
||||
sin.push( [ i, Math.sin( i ) ] );
|
||||
cos.push( [ i, Math.cos( i ) ] );
|
||||
}
|
||||
|
||||
var plot = $.plot( "#flot-line", [
|
||||
{
|
||||
data: sin,
|
||||
label: "sin(x)"
|
||||
},
|
||||
{
|
||||
data: cos,
|
||||
label: "cos(x)"
|
||||
}
|
||||
], {
|
||||
series: {
|
||||
lines: {
|
||||
show: true
|
||||
},
|
||||
points: {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
yaxis: {
|
||||
min: -1.2,
|
||||
max: 1.2
|
||||
},
|
||||
colors: [ "#00c292", "#F44336" ],
|
||||
grid: {
|
||||
color: "#fff",
|
||||
hoverable: true,
|
||||
borderWidth: 0,
|
||||
backgroundColor: 'transparent'
|
||||
},
|
||||
tooltip: true,
|
||||
tooltipOpts: {
|
||||
content: "'%s' of %x.1 is %y.4",
|
||||
shifts: {
|
||||
x: -65,
|
||||
y: 25
|
||||
}
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
pieFlot: function(){
|
||||
|
||||
var data = [
|
||||
{
|
||||
label: " Data 1",
|
||||
data: 2,
|
||||
color: "#8fc9fb"
|
||||
},
|
||||
{
|
||||
label: " Data 2",
|
||||
data: 4,
|
||||
color: "#007BFF"
|
||||
},
|
||||
{
|
||||
label: " Data 3",
|
||||
data: 7,
|
||||
color: "#00c292"
|
||||
},
|
||||
{
|
||||
label: " Data 4",
|
||||
data: 15,
|
||||
color: "#F44336"
|
||||
},
|
||||
{
|
||||
label: " Data 5",
|
||||
data: 10,
|
||||
color: "#32c39f"
|
||||
}
|
||||
];
|
||||
|
||||
var plotObj = $.plot( $( "#flot-pie" ), data, {
|
||||
series: {
|
||||
pie: {
|
||||
show: true,
|
||||
radius: 1,
|
||||
label: {
|
||||
show: false,
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
hoverable: true
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
content: "%p.0%, %s, n=%n", // show percentages, rounding to 2 decimal places
|
||||
shifts: {
|
||||
x: 20,
|
||||
y: 0
|
||||
},
|
||||
defaultTheme: false
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
line2Flot: function(){
|
||||
|
||||
// first chart
|
||||
var chart1Options = {
|
||||
series: {
|
||||
lines: {
|
||||
show: true
|
||||
},
|
||||
points: {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
xaxis: {
|
||||
mode: "time",
|
||||
timeformat: "%m/%d",
|
||||
minTickSize: [ 1, "day" ]
|
||||
},
|
||||
grid: {
|
||||
hoverable: true
|
||||
},
|
||||
legend: {
|
||||
show: false
|
||||
},
|
||||
grid: {
|
||||
color: "#fff",
|
||||
hoverable: true,
|
||||
borderWidth: 0,
|
||||
backgroundColor: 'transparent'
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
content: "y: %y"
|
||||
}
|
||||
};
|
||||
var chart1Data = {
|
||||
label: "chart1",
|
||||
color: "#007BFF",
|
||||
data: [
|
||||
[ 1354521600000, 6322 ],
|
||||
[ 1354840000000, 6340 ],
|
||||
[ 1355223600000, 6368 ],
|
||||
[ 1355306400000, 6374 ],
|
||||
[ 1355487300000, 6388 ],
|
||||
[ 1355571900000, 6400 ]
|
||||
]
|
||||
};
|
||||
$.plot( $( "#chart1" ), [ chart1Data ], chart1Options );
|
||||
},
|
||||
|
||||
barFlot: function(){
|
||||
|
||||
// second chart
|
||||
var flotBarOptions = {
|
||||
series: {
|
||||
bars: {
|
||||
show: true,
|
||||
barWidth: 43200000
|
||||
}
|
||||
},
|
||||
xaxis: {
|
||||
mode: "time",
|
||||
timeformat: "%m/%d",
|
||||
minTickSize: [ 1, "day" ]
|
||||
},
|
||||
grid: {
|
||||
hoverable: true
|
||||
},
|
||||
legend: {
|
||||
show: false
|
||||
},
|
||||
grid: {
|
||||
color: "#fff",
|
||||
hoverable: true,
|
||||
borderWidth: 0,
|
||||
backgroundColor: 'transparent'
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
content: "x: %x, y: %y"
|
||||
}
|
||||
};
|
||||
var flotBarData = {
|
||||
label: "flotBar",
|
||||
color: "#007BFF",
|
||||
data: [
|
||||
[ 1354921600000, 1000 ],
|
||||
[ 1355040000000, 1500 ],
|
||||
[ 1355223600000, 2000 ],
|
||||
[ 1355306400000, 2500 ],
|
||||
[ 1355487300000, 3000 ],
|
||||
[ 1355571900000, 4000 ]
|
||||
]
|
||||
};
|
||||
$.plot( $( "#flotBar" ), [ flotBarData ], flotBarOptions );
|
||||
|
||||
},
|
||||
|
||||
plotting: function(){
|
||||
|
||||
var d1 = [ [ 20, 20 ], [ 30, 34 ], [ 42, 60 ], [ 54, 20 ], [ 80, 90 ] ];
|
||||
|
||||
//flot options
|
||||
var options = {
|
||||
legend: {
|
||||
show: false
|
||||
},
|
||||
series: {
|
||||
label: "Curved Lines Test",
|
||||
curvedLines: {
|
||||
active: true,
|
||||
nrSplinePoints: 20
|
||||
}
|
||||
},
|
||||
|
||||
grid: {
|
||||
color: "#fff",
|
||||
hoverable: true,
|
||||
borderWidth: 0,
|
||||
backgroundColor: 'transparent'
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
content: "%s | x: %x; y: %y"
|
||||
},
|
||||
yaxes: [ {
|
||||
min: 10,
|
||||
max: 90
|
||||
}, {
|
||||
position: 'right'
|
||||
} ]
|
||||
};
|
||||
|
||||
//plotting
|
||||
$.plot( $( "#flotCurve" ), [
|
||||
{
|
||||
data: d1,
|
||||
lines: {
|
||||
show: true,
|
||||
fill: true,
|
||||
fillColor: "rgba(0,123,255,.15)",
|
||||
lineWidth: 3
|
||||
},
|
||||
//curve the line (old pre 1.0.0 plotting function)
|
||||
curvedLines: {
|
||||
apply: true,
|
||||
show: true,
|
||||
fill: true,
|
||||
fillColor: "rgba(0,123,255,.15)",
|
||||
|
||||
}
|
||||
}, {
|
||||
data: d1,
|
||||
points: {
|
||||
show: true,
|
||||
fill: true,
|
||||
fillColor: "rgba(0,123,255,.15)",
|
||||
}
|
||||
}
|
||||
], options );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
SufeeAdmin.cpuLoad();
|
||||
SufeeAdmin.lineFlot();
|
||||
SufeeAdmin.pieFlot();
|
||||
SufeeAdmin.line2Flot();
|
||||
SufeeAdmin.barFlot();
|
||||
SufeeAdmin.plotting();
|
||||
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
193
static/assets/js/init/fullcalendar-init.js
Normal file
193
static/assets/js/init/fullcalendar-init.js
Normal file
@@ -0,0 +1,193 @@
|
||||
|
||||
!function($) {
|
||||
"use strict";
|
||||
|
||||
var CalendarApp = function() {
|
||||
this.$body = $("body")
|
||||
this.$modal = $('#event-modal'),
|
||||
this.$event = ('#external-events div.external-event'),
|
||||
this.$calendar = $('#calendar'),
|
||||
this.$saveCategoryBtn = $('.save-category'),
|
||||
this.$categoryForm = $('#add-category form'),
|
||||
this.$extEvents = $('#external-events'),
|
||||
this.$calendarObj = null
|
||||
};
|
||||
|
||||
|
||||
/* on drop */
|
||||
CalendarApp.prototype.onDrop = function (eventObj, date) {
|
||||
var $this = this;
|
||||
// retrieve the dropped element's stored Event Object
|
||||
var originalEventObject = eventObj.data('eventObject');
|
||||
var $categoryClass = eventObj.attr('data-class');
|
||||
// we need to copy it, so that multiple events don't have a reference to the same object
|
||||
var copiedEventObject = $.extend({}, originalEventObject);
|
||||
// assign it the date that was reported
|
||||
copiedEventObject.start = date;
|
||||
if ($categoryClass)
|
||||
copiedEventObject['className'] = [$categoryClass];
|
||||
// render the event on the calendar
|
||||
$this.$calendar.fullCalendar('renderEvent', copiedEventObject, true);
|
||||
// is the "remove after drop" checkbox checked?
|
||||
if ($('#drop-remove').is(':checked')) {
|
||||
// if so, remove the element from the "Draggable Events" list
|
||||
eventObj.remove();
|
||||
}
|
||||
},
|
||||
/* on click on event */
|
||||
CalendarApp.prototype.onEventClick = function (calEvent, jsEvent, view) {
|
||||
var $this = this;
|
||||
var form = $("<form></form>");
|
||||
form.append("<label>Change event name</label>");
|
||||
form.append("<div class='input-group'><input class='form-control' type=text value='" + calEvent.title + "' /><span class='input-group-btn'><button type='submit' class='btn btn-success waves-effect waves-light'><i class='fa fa-check'></i> Save</button></span></div>");
|
||||
$this.$modal.modal({
|
||||
backdrop: 'static'
|
||||
});
|
||||
$this.$modal.find('.delete-event').show().end().find('.save-event').hide().end().find('.modal-body').empty().prepend(form).end().find('.delete-event').unbind('click').click(function () {
|
||||
$this.$calendarObj.fullCalendar('removeEvents', function (ev) {
|
||||
return (ev._id == calEvent._id);
|
||||
});
|
||||
$this.$modal.modal('hide');
|
||||
});
|
||||
$this.$modal.find('form').on('submit', function () {
|
||||
calEvent.title = form.find("input[type=text]").val();
|
||||
$this.$calendarObj.fullCalendar('updateEvent', calEvent);
|
||||
$this.$modal.modal('hide');
|
||||
return false;
|
||||
});
|
||||
},
|
||||
/* on select */
|
||||
CalendarApp.prototype.onSelect = function (start, end, allDay) {
|
||||
var $this = this;
|
||||
$this.$modal.modal({
|
||||
backdrop: 'static'
|
||||
});
|
||||
var form = $("<form></form>");
|
||||
form.append("<div class='row'></div>");
|
||||
form.find(".row")
|
||||
.append("<div class='col-md-6'><div class='form-group'><label class='control-label'>Event Name</label><input class='form-control' placeholder='Insert Event Name' type='text' name='title'/></div></div>")
|
||||
.append("<div class='col-md-6'><div class='form-group'><label class='control-label'>Category</label><select class='form-control' name='category'></select></div></div>")
|
||||
.find("select[name='category']")
|
||||
.append("<option value='bg-danger'>Danger</option>")
|
||||
.append("<option value='bg-success'>Success</option>")
|
||||
.append("<option value='bg-dark'>Dark</option>")
|
||||
.append("<option value='bg-primary'>Primary</option>")
|
||||
.append("<option value='bg-pink'>Pink</option>")
|
||||
.append("<option value='bg-info'>Info</option>")
|
||||
.append("<option value='bg-warning'>Warning</option></div></div>");
|
||||
$this.$modal.find('.delete-event').hide().end().find('.save-event').show().end().find('.modal-body').empty().prepend(form).end().find('.save-event').unbind('click').click(function () {
|
||||
form.submit();
|
||||
});
|
||||
$this.$modal.find('form').on('submit', function () {
|
||||
var title = form.find("input[name='title']").val();
|
||||
var beginning = form.find("input[name='beginning']").val();
|
||||
var ending = form.find("input[name='ending']").val();
|
||||
var categoryClass = form.find("select[name='category'] option:checked").val();
|
||||
if (title !== null && title.length != 0) {
|
||||
$this.$calendarObj.fullCalendar('renderEvent', {
|
||||
title: title,
|
||||
start:start,
|
||||
end: end,
|
||||
allDay: false,
|
||||
className: categoryClass
|
||||
}, true);
|
||||
$this.$modal.modal('hide');
|
||||
}
|
||||
else{
|
||||
alert('You have to give a title to your event');
|
||||
}
|
||||
return false;
|
||||
|
||||
});
|
||||
$this.$calendarObj.fullCalendar('unselect');
|
||||
},
|
||||
CalendarApp.prototype.enableDrag = function() {
|
||||
//init events
|
||||
$(this.$event).each(function () {
|
||||
// create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
|
||||
// it doesn't need to have a start or end
|
||||
var eventObject = {
|
||||
title: $.trim($(this).text()) // use the element's text as the event title
|
||||
};
|
||||
// store the Event Object in the DOM element so we can get to it later
|
||||
$(this).data('eventObject', eventObject);
|
||||
// make the event draggable using jQuery UI
|
||||
$(this).draggable({
|
||||
zIndex: 999,
|
||||
revert: true, // will cause the event to go back to its
|
||||
revertDuration: 0 // original position after the drag
|
||||
});
|
||||
});
|
||||
}
|
||||
/* Initializing */
|
||||
CalendarApp.prototype.init = function() {
|
||||
this.enableDrag();
|
||||
/* Initialize the calendar */
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
var form = '';
|
||||
var today = new Date($.now());
|
||||
|
||||
var defaultEvents = [{
|
||||
title: 'Hey!',
|
||||
start: new Date($.now() + 158000000),
|
||||
className: 'bg-dark'
|
||||
}, {
|
||||
title: 'See John Deo',
|
||||
start: today,
|
||||
end: today,
|
||||
className: 'bg-danger'
|
||||
}, {
|
||||
title: 'Buy a Theme',
|
||||
start: new Date($.now() + 338000000),
|
||||
className: 'bg-primary'
|
||||
}];
|
||||
|
||||
var $this = this;
|
||||
$this.$calendarObj = $this.$calendar.fullCalendar({
|
||||
slotDuration: '00:15:00', /* If we want to split day time each 15minutes */
|
||||
minTime: '08:00:00',
|
||||
maxTime: '19:00:00',
|
||||
defaultView: 'month',
|
||||
handleWindowResize: true,
|
||||
height: $(window).height() - 200,
|
||||
header: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'month,agendaWeek,agendaDay'
|
||||
},
|
||||
events: defaultEvents,
|
||||
editable: true,
|
||||
droppable: true, // this allows things to be dropped onto the calendar !!!
|
||||
eventLimit: true, // allow "more" link when too many events
|
||||
selectable: true,
|
||||
drop: function(date) { $this.onDrop($(this), date); },
|
||||
select: function (start, end, allDay) { $this.onSelect(start, end, allDay); },
|
||||
eventClick: function(calEvent, jsEvent, view) { $this.onEventClick(calEvent, jsEvent, view); }
|
||||
|
||||
});
|
||||
|
||||
//on new event
|
||||
this.$saveCategoryBtn.on('click', function(){
|
||||
var categoryName = $this.$categoryForm.find("input[name='category-name']").val();
|
||||
var categoryColor = $this.$categoryForm.find("select[name='category-color']").val();
|
||||
if (categoryName !== null && categoryName.length != 0) {
|
||||
$this.$extEvents.append('<div class="external-event bg-' + categoryColor + '" data-class="bg-' + categoryColor + '" style="position: relative;"><i class="fa fa-move"></i>' + categoryName + '</div>')
|
||||
$this.enableDrag();
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
//init CalendarApp
|
||||
$.CalendarApp = new CalendarApp, $.CalendarApp.Constructor = CalendarApp
|
||||
|
||||
}(window.jQuery),
|
||||
|
||||
//initializing CalendarApp
|
||||
function($) {
|
||||
"use strict";
|
||||
$.CalendarApp.init()
|
||||
}(window.jQuery);
|
||||
246
static/assets/js/init/gmap-init.js
Normal file
246
static/assets/js/init/gmap-init.js
Normal file
@@ -0,0 +1,246 @@
|
||||
(function($){
|
||||
|
||||
var map;
|
||||
$(document).ready(function(){
|
||||
map = new GMaps({
|
||||
el: '#basic-map',
|
||||
lat: -12.043333,
|
||||
lng: -77.028333,
|
||||
zoomControl : true,
|
||||
zoomControlOpt: {
|
||||
style : 'SMALL',
|
||||
position: 'TOP_LEFT'
|
||||
},
|
||||
panControl : false,
|
||||
streetViewControl : false,
|
||||
mapTypeControl: false,
|
||||
overviewMapControl: false
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
var map, infoWindow;
|
||||
$(document).ready(function(){
|
||||
infoWindow = new google.maps.InfoWindow({});
|
||||
map = new GMaps({
|
||||
el: '#map-2',
|
||||
zoom: 11,
|
||||
lat: 41.850033,
|
||||
lng: -87.6500523
|
||||
});
|
||||
map.loadFromFusionTables({
|
||||
query: {
|
||||
select: '\'Geocodable address\'',
|
||||
from: '1mZ53Z70NsChnBMm-qEYmSDOvLXgrreLTkQUvvg'
|
||||
},
|
||||
suppressInfoWindows: true,
|
||||
events: {
|
||||
click: function(point){
|
||||
infoWindow.setContent('You clicked here!');
|
||||
infoWindow.setPosition(point.latLng);
|
||||
infoWindow.open(map.map);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
var map, rectangle, polygon, circle;
|
||||
$(document).ready(function(){
|
||||
map = new GMaps({
|
||||
el: '#map-3',
|
||||
lat: -12.043333,
|
||||
lng: -77.028333
|
||||
});
|
||||
var bounds = [[-12.030397656836609,-77.02373871559225],[-12.034804866577001,-77.01154422636042]];
|
||||
rectangle = map.drawRectangle({
|
||||
bounds: bounds,
|
||||
strokeColor: '#BBD8E9',
|
||||
strokeOpacity: 1,
|
||||
strokeWeight: 3,
|
||||
fillColor: '#BBD8E9',
|
||||
fillOpacity: 0.6
|
||||
});
|
||||
|
||||
var paths = [[-12.040397656836609,-77.03373871559225],[-12.040248585302038,-77.03993927003302],[-12.050047116528843,-77.02448169303511],[-12.044804866577001,-77.02154422636042]];
|
||||
polygon = map.drawPolygon({
|
||||
paths: paths,
|
||||
strokeColor: '#25D359',
|
||||
strokeOpacity: 1,
|
||||
strokeWeight: 3,
|
||||
fillColor: '#25D359',
|
||||
fillOpacity: 0.6
|
||||
});
|
||||
var lat = -12.040504866577001;
|
||||
var lng = -77.02024422636042;
|
||||
circle = map.drawCircle({
|
||||
lat: lat,
|
||||
lng: lng,
|
||||
radius: 350,
|
||||
strokeColor: '#432070',
|
||||
strokeOpacity: 1,
|
||||
strokeWeight: 3,
|
||||
fillColor: '#432070',
|
||||
fillOpacity: 0.6
|
||||
});
|
||||
for(var i in paths){
|
||||
bounds.push(paths[i]);
|
||||
}
|
||||
var b = [];
|
||||
for(var i in bounds){
|
||||
latlng = new google.maps.LatLng(bounds[i][0], bounds[i][1]);
|
||||
b.push(latlng);
|
||||
}
|
||||
for(var i in paths){
|
||||
latlng = new google.maps.LatLng(paths[i][0], paths[i][1]);
|
||||
b.push(latlng);
|
||||
}
|
||||
map.fitLatLngBounds(b);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var map;
|
||||
$(document).ready(function(){
|
||||
map = new GMaps({
|
||||
el: '#map-4',
|
||||
lat: -12.043333,
|
||||
lng: -77.028333
|
||||
});
|
||||
//locations request
|
||||
map.getElevations({
|
||||
locations : [[-12.040397656836609,-77.03373871559225], [-12.050047116528843,-77.02448169303511], [-12.044804866577001,-77.02154422636042]],
|
||||
callback : function (result, status){
|
||||
if (status == google.maps.ElevationStatus.OK) {
|
||||
for (var i in result){
|
||||
map.addMarker({
|
||||
lat: result[i].location.lat(),
|
||||
lng: result[i].location.lng(),
|
||||
title: 'Marker with InfoWindow',
|
||||
infoWindow: {
|
||||
content: '<p>The elevation is '+result[i].elevation+' in meters</p>'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var map;
|
||||
$(document).ready(function(){
|
||||
var map = new GMaps({
|
||||
el: '#map-5',
|
||||
lat: -12.043333,
|
||||
lng: -77.028333
|
||||
});
|
||||
|
||||
GMaps.geolocate({
|
||||
success: function(position){
|
||||
map.setCenter(position.coords.latitude, position.coords.longitude);
|
||||
},
|
||||
error: function(error){
|
||||
alert('Geolocation failed: '+error.message);
|
||||
},
|
||||
not_supported: function(){
|
||||
alert("Your browser does not support geolocation");
|
||||
},
|
||||
always: function(){
|
||||
alert("Done!");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var map, infoWindow;
|
||||
$(document).ready(function(){
|
||||
infoWindow = new google.maps.InfoWindow({});
|
||||
map = new GMaps({
|
||||
el: '#map-6',
|
||||
zoom: 12,
|
||||
lat: 40.65,
|
||||
lng: -73.95
|
||||
});
|
||||
map.loadFromKML({
|
||||
url: 'https://api.flickr.com/services/feeds/geo/?g=322338@N20&lang=en-us&format=feed-georss',
|
||||
suppressInfoWindows: true,
|
||||
events: {
|
||||
click: function(point){
|
||||
infoWindow.setContent(point.featureData.infoWindowHtml);
|
||||
infoWindow.setPosition(point.latLng);
|
||||
infoWindow.open(map.map);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var map;
|
||||
$(function () {
|
||||
map = new GMaps({
|
||||
el: "#map-7",
|
||||
lat: -12.043333,
|
||||
lng: -77.028333,
|
||||
zoom: 3
|
||||
});
|
||||
|
||||
map.addLayer('weather', {
|
||||
clickable: false
|
||||
});
|
||||
map.addLayer('clouds');
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
map = new GMaps({
|
||||
el: '#map-8',
|
||||
zoom: 16,
|
||||
lat: -12.043333,
|
||||
lng: -77.028333,
|
||||
click: function(e){
|
||||
alert('click');
|
||||
},
|
||||
dragend: function(e){
|
||||
alert('dragend');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
})(jQuery);
|
||||
100
static/assets/js/init/peitychart-init.js
Normal file
100
static/assets/js/init/peitychart-init.js
Normal file
@@ -0,0 +1,100 @@
|
||||
(function($){
|
||||
|
||||
"use strict"; // Start of use strict
|
||||
|
||||
$(function() {
|
||||
"use strict";
|
||||
// Just the defaults.
|
||||
$("span.pie").peity("pie",{
|
||||
width: '50',
|
||||
height: '50'
|
||||
})
|
||||
|
||||
$('span.donut').peity('donut',{
|
||||
width: '50',
|
||||
height: '50'
|
||||
})
|
||||
|
||||
|
||||
$(".peity-line").peity("line",{
|
||||
width: '300',
|
||||
height: '100'
|
||||
})
|
||||
|
||||
$(".bar").peity("bar",{
|
||||
width: '300',
|
||||
height: '100'
|
||||
})
|
||||
|
||||
$(".bar-colours-1").peity("bar", {
|
||||
fill: ["red", "green", "blue"],
|
||||
width: '100',
|
||||
height: '100'
|
||||
})
|
||||
|
||||
$(".bar-colours-2").peity("bar", {
|
||||
fill: function(value) {
|
||||
return value > 0 ? "green" : "red"
|
||||
},
|
||||
width: '100',
|
||||
height: '100'
|
||||
})
|
||||
|
||||
$(".bar-colours-3").peity("bar", {
|
||||
fill: function(_, i, all) {
|
||||
var g = parseInt((i / all.length) * 255)
|
||||
return "rgb(255, " + g + ", 0)"
|
||||
},
|
||||
width: '100',
|
||||
height: '100'
|
||||
})
|
||||
|
||||
$(".pie-colours-1").peity("pie", {
|
||||
fill: ["cyan", "magenta", "yellow", "black"],
|
||||
width: '100',
|
||||
height: '100'
|
||||
})
|
||||
|
||||
$(".pie-colours-2").peity("pie", {
|
||||
fill: function(_, i, all) {
|
||||
var g = parseInt((i / all.length) * 255)
|
||||
return "rgb(255, " + g + ", 0)"
|
||||
},
|
||||
width: '100',
|
||||
height: '100'
|
||||
})
|
||||
|
||||
// Using data attributes
|
||||
$(".data-attributes span").peity("donut")
|
||||
|
||||
// Evented example.
|
||||
$("select").change(function() {
|
||||
var text = $(this).val() + "/" + 5
|
||||
|
||||
$(this)
|
||||
.siblings("span.graph")
|
||||
.text(text)
|
||||
.change()
|
||||
|
||||
$("#notice").text("Chart updated: " + text)
|
||||
}).change()
|
||||
|
||||
$("span.graph").peity("pie")
|
||||
|
||||
// Updating charts.
|
||||
var updatingChart = $(".updating-chart").peity("line", { width: "100%",height:100 })
|
||||
|
||||
setInterval(function() {
|
||||
var random = Math.round(Math.random() * 10)
|
||||
var values = updatingChart.text().split(",")
|
||||
values.shift()
|
||||
values.push(random)
|
||||
|
||||
updatingChart
|
||||
.text(values.join(","))
|
||||
.change()
|
||||
}, 1000)
|
||||
})
|
||||
|
||||
|
||||
})(jQuery);
|
||||
223
static/assets/js/init/vector-init.js
Normal file
223
static/assets/js/init/vector-init.js
Normal file
@@ -0,0 +1,223 @@
|
||||
( function ( $ ) {
|
||||
"use strict";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
jQuery( '#vmap' ).vectorMap( {
|
||||
map: 'world_en',
|
||||
backgroundColor: null,
|
||||
color: '#ffffff',
|
||||
hoverOpacity: 0.7,
|
||||
selectedColor: '#1de9b6',
|
||||
enableZoom: true,
|
||||
showTooltip: true,
|
||||
values: sample_data,
|
||||
scaleColors: [ '#1de9b6', '#03a9f5' ],
|
||||
normalizeFunction: 'polynomial'
|
||||
} );
|
||||
|
||||
jQuery( '#vmap2' ).vectorMap( {
|
||||
map: 'dz_fr',
|
||||
color: '#007BFF',
|
||||
borderColor: '#fff',
|
||||
backgroundColor: '#fff',
|
||||
borderOpacity: 1,
|
||||
enableZoom: true,
|
||||
showTooltip: true
|
||||
} );
|
||||
|
||||
jQuery( '#vmap3' ).vectorMap( {
|
||||
map: 'argentina_en',
|
||||
color: '#007BFF',
|
||||
borderColor: '#fff',
|
||||
backgroundColor: '#fff',
|
||||
onRegionClick: function ( element, code, region ) {
|
||||
var message = 'You clicked "' + region + '" which has the code: ' + code.toUpperCase();
|
||||
|
||||
alert( message );
|
||||
}
|
||||
} );
|
||||
|
||||
jQuery( '#vmap4' ).vectorMap( {
|
||||
map: 'brazil_br',
|
||||
color: '#007BFF',
|
||||
borderColor: '#fff',
|
||||
backgroundColor: '#fff',
|
||||
onRegionClick: function ( element, code, region ) {
|
||||
var message = 'You clicked "' + region + '" which has the code: ' + code.toUpperCase();
|
||||
|
||||
alert( message );
|
||||
}
|
||||
} );
|
||||
|
||||
jQuery( '#vmap5' ).vectorMap( {
|
||||
map: 'france_fr',
|
||||
color: '#007BFF',
|
||||
borderColor: '#fff',
|
||||
backgroundColor: '#fff',
|
||||
enableZoom: true,
|
||||
showTooltip: true
|
||||
} );
|
||||
|
||||
jQuery( '#vmap6' ).vectorMap( {
|
||||
map: 'germany_en',
|
||||
color: '#007BFF',
|
||||
borderColor: '#fff',
|
||||
backgroundColor: '#fff',
|
||||
onRegionClick: function ( element, code, region ) {
|
||||
var message = 'You clicked "' + region + '" which has the code: ' + code.toUpperCase();
|
||||
|
||||
alert( message );
|
||||
}
|
||||
} );
|
||||
|
||||
jQuery( '#vmap7' ).vectorMap( {
|
||||
map: 'greece',
|
||||
color: '#007BFF',
|
||||
borderColor: '#fff',
|
||||
backgroundColor: '#fff',
|
||||
onRegionClick: function ( element, code, region ) {
|
||||
var message = 'You clicked "' + region + '" which has the code: ' + code.toUpperCase();
|
||||
|
||||
alert( message );
|
||||
}
|
||||
} );
|
||||
|
||||
jQuery( '#vmap8' ).vectorMap( {
|
||||
map: 'iran_ir',
|
||||
onRegionClick: function ( element, code, region ) {
|
||||
var message = 'You clicked "' + region + '" which has the code: ' + code.toUpperCase();
|
||||
|
||||
alert( message );
|
||||
}
|
||||
} );
|
||||
|
||||
jQuery( '#vmap9' ).vectorMap( {
|
||||
map: 'iraq',
|
||||
color: '#007BFF',
|
||||
borderColor: '#fff',
|
||||
backgroundColor: '#fff',
|
||||
onRegionClick: function ( element, code, region ) {
|
||||
var message = 'You clicked "' + region + '" which has the code: ' + code.toUpperCase();
|
||||
|
||||
alert( message );
|
||||
}
|
||||
} );
|
||||
|
||||
jQuery( '#vmap10' ).vectorMap( {
|
||||
map: 'russia_en',
|
||||
color: '#007BFF',
|
||||
borderColor: '#fff',
|
||||
backgroundColor: '#fff',
|
||||
hoverOpacity: 0.7,
|
||||
selectedColor: '#999999',
|
||||
enableZoom: true,
|
||||
showTooltip: true,
|
||||
scaleColors: [ '#C8EEFF', '#006491' ],
|
||||
normalizeFunction: 'polynomial'
|
||||
} );
|
||||
|
||||
jQuery( '#vmap11' ).vectorMap( {
|
||||
map: 'tunisia',
|
||||
color: '#007BFF',
|
||||
borderColor: '#fff',
|
||||
backgroundColor: '#fff',
|
||||
onRegionClick: function ( element, code, region ) {
|
||||
var message = 'You clicked "' + region + '" which has the code: ' + code.toUpperCase();
|
||||
|
||||
alert( message );
|
||||
}
|
||||
} );
|
||||
|
||||
jQuery( '#vmap12' ).vectorMap( {
|
||||
map: 'europe_en',
|
||||
color: '#007BFF',
|
||||
borderColor: '#fff',
|
||||
backgroundColor: '#fff',
|
||||
enableZoom: true,
|
||||
showTooltip: true
|
||||
} );
|
||||
|
||||
jQuery( '#vmap13' ).vectorMap( {
|
||||
map: 'usa_en',
|
||||
color: '#007BFF',
|
||||
borderColor: '#fff',
|
||||
backgroundColor: '#fff',
|
||||
enableZoom: true,
|
||||
showTooltip: true,
|
||||
selectedColor: null,
|
||||
hoverColor: null,
|
||||
colors: {
|
||||
mo: '#001BFF',
|
||||
fl: '#001BFF',
|
||||
or: '#001BFF'
|
||||
},
|
||||
onRegionClick: function ( event, code, region ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
} );
|
||||
|
||||
jQuery( '#vmap14' ).vectorMap( {
|
||||
map: 'turkey',
|
||||
color: '#007BFF',
|
||||
borderColor: '#fff',
|
||||
backgroundColor: '#fff',
|
||||
onRegionClick: function ( element, code, region ) {
|
||||
var message = 'You clicked "' + region + '" which has the code: ' + code.toUpperCase();
|
||||
alert( message );
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
|
||||
} )( jQuery );
|
||||
|
||||
|
||||
|
||||
var map;
|
||||
|
||||
jQuery( document ).ready( function () {
|
||||
|
||||
// Store currentRegion
|
||||
var currentRegion = 'fl';
|
||||
|
||||
// List of Regions we'll let clicks through for
|
||||
var enabledRegions = [ 'mo', 'fl', 'or' ];
|
||||
|
||||
map = jQuery( '#vmap15' ).vectorMap( {
|
||||
map: 'usa_en',
|
||||
color: '#007BFF',
|
||||
borderColor: '#fff',
|
||||
backgroundColor: '#fff',
|
||||
enableZoom: true,
|
||||
showTooltip: true,
|
||||
selectedColor: '#001BFF',
|
||||
selectedRegions: [ 'fl' ],
|
||||
hoverColor: null,
|
||||
colors: {
|
||||
mo: '#001BFF',
|
||||
fl: '#001BFF',
|
||||
or: '#001BFF'
|
||||
},
|
||||
onRegionClick: function ( event, code, region ) {
|
||||
// Check if this is an Enabled Region, and not the current selected on
|
||||
if ( enabledRegions.indexOf( code ) === -1 || currentRegion === code ) {
|
||||
// Not an Enabled Region
|
||||
event.preventDefault();
|
||||
} else {
|
||||
// Enabled Region. Update Newly Selected Region.
|
||||
currentRegion = code;
|
||||
}
|
||||
},
|
||||
onRegionSelect: function ( event, code, region ) {
|
||||
console.log( map.selectedRegions );
|
||||
},
|
||||
onLabelShow: function ( event, label, code ) {
|
||||
if ( enabledRegions.indexOf( code ) === -1 ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
} );
|
||||
} );
|
||||
140
static/assets/js/init/weather-init.js
Normal file
140
static/assets/js/init/weather-init.js
Normal file
@@ -0,0 +1,140 @@
|
||||
(function ($) {
|
||||
//"use strict";
|
||||
|
||||
function loadWeather(location, woeid) {
|
||||
$.simpleWeather({
|
||||
location: location,
|
||||
woeid: woeid,
|
||||
unit: 'f',
|
||||
success: function (weather) {
|
||||
html = '<div class="top">';
|
||||
html += '<i class="wi wi-yahoo-' + weather.code + '"></i>';
|
||||
html += '<div class="currently">' + weather.currently + '</div>';
|
||||
html += '<div class="updates">' + weather.forecast[0].day + ', ' + weather.forecast[0].date+ '</div>';
|
||||
html += '</div>';
|
||||
|
||||
|
||||
html += '<div class="middle">';
|
||||
html += '<div class="city">' + weather.city + ' <span> '+ weather.region + '</span></div>';
|
||||
html += '<div class="temp">' + weather.alt.temp + '<span>°C</span> </div>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="nextdays">';
|
||||
|
||||
html += '<div class="days day2"><span class="d">' + weather.forecast[1].day + '</span> <span class="h">' + weather.forecast[1].alt.high + '° </span> <span class="h">' + weather.forecast[1].alt.low + '° </div>';
|
||||
html += '<div class="days day3"><span class="d">' + weather.forecast[2].day + '</span> <span class="h">' + weather.forecast[2].alt.high + '° </span> <span class="h">' + weather.forecast[2].alt.low + '° </div>';
|
||||
html += '<div class="days day4"><span class="d">' + weather.forecast[3].day + '</span> <span class="h">' + weather.forecast[3].alt.high + '° </span> <span class="h">' + weather.forecast[3].alt.low + '° </div>';
|
||||
html += '<div class="days day5"><span class="d">' + weather.forecast[4].day + '</span> <span class="h">' + weather.forecast[4].alt.high + '° </span> <span class="h">' + weather.forecast[4].alt.low + '° </div>';
|
||||
html += '<div class="days day1"><span class="d">' + weather.forecast[5].day + '</span> <span class="h">' + weather.forecast[5].alt.high + '° </span> <span class="h">' + weather.forecast[5].alt.low + '° </div>';
|
||||
html += '</div>';
|
||||
|
||||
$("#weather-one").html(html);
|
||||
},
|
||||
error: function (error) {
|
||||
$("#weather-one").html('<p>' + error + '</p>');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// init
|
||||
loadWeather('New York City', '');
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
||||
(function ($) {
|
||||
//"use strict";
|
||||
|
||||
function loadWeather(location, woeid) {
|
||||
$.simpleWeather({
|
||||
location: location,
|
||||
woeid: woeid,
|
||||
unit: 'f',
|
||||
success: function (weather) {
|
||||
|
||||
html = '<i class="wi wi-yahoo-' + weather.code + '"></i><h2> ' + weather.temp + '°' + weather.units.temp + '</h2>';
|
||||
html += '<div class="city">' + weather.city + ', ' + weather.region + '</div>';
|
||||
html += '<div class="currently">' + weather.currently + '</div>';
|
||||
html += '<div class="celcious">' + weather.alt.temp + '°C</div>';
|
||||
|
||||
$("#weather-two").html(html);
|
||||
},
|
||||
error: function (error) {
|
||||
$("#weather-two").html('<p>' + error + '</p>');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// init
|
||||
loadWeather('New York City', '');
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
||||
|
||||
(function ($) {
|
||||
//"use strict";
|
||||
|
||||
function loadWeather(location, woeid) {
|
||||
$.simpleWeather({
|
||||
location: location,
|
||||
woeid: woeid,
|
||||
unit: 'f',
|
||||
success: function (weather) {
|
||||
|
||||
html = '<i class="wi wi-yahoo-' + weather.code + '"></i><h2> ' + weather.temp + '°' + weather.units.temp + '</h2>';
|
||||
html += '<div class="city">' + weather.city + ', ' + weather.region + '</div>';
|
||||
html += '<div class="currently">' + weather.currently + '</div>';
|
||||
html += '<div class="celcious">' + weather.alt.temp + '°C</div>';
|
||||
|
||||
$("#weather-three").html(html);
|
||||
},
|
||||
error: function (error) {
|
||||
$("#weather-three").html('<p>' + error + '</p>');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// init
|
||||
loadWeather('Sydney', '');
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
||||
(function ($) {
|
||||
//"use strict";
|
||||
|
||||
function loadWeather(location, woeid) {
|
||||
$.simpleWeather({
|
||||
location: location,
|
||||
woeid: woeid,
|
||||
unit: 'f',
|
||||
success: function (weather) {
|
||||
|
||||
html = '<i class="wi wi-yahoo-' + weather.code + '"></i><h2> ' + weather.temp + '°' + weather.units.temp + '</h2>';
|
||||
html += '<div class="city">' + weather.city + ', ' + weather.region + '</div>';
|
||||
html += '<div class="currently">' + weather.currently + '</div>';
|
||||
html += '<div class="celcious">' + weather.alt.temp + '°C</div>';
|
||||
|
||||
$("#weather-four").html(html);
|
||||
},
|
||||
error: function (error) {
|
||||
$("#weather-four").html('<p>' + error + '</p>');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// init
|
||||
loadWeather('New York', '');
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user