preparing to push to heroku

This commit is contained in:
Jackk Goh
2018-03-23 09:55:42 +08:00
parent 6d879e9016
commit d1a0997c19
5856 changed files with 1 additions and 0 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+672
View File
@@ -0,0 +1,672 @@
jQuery(document).ready(function() {
// ECHARTS
require.config({
paths: {
echarts: '../assets/global/plugins/echarts/'
}
});
// DEMOS
require(
[
'echarts',
'echarts/chart/bar',
'echarts/chart/chord',
'echarts/chart/eventRiver',
'echarts/chart/force',
'echarts/chart/funnel',
'echarts/chart/gauge',
'echarts/chart/heatmap',
'echarts/chart/k',
'echarts/chart/line',
'echarts/chart/map',
'echarts/chart/pie',
'echarts/chart/radar',
'echarts/chart/scatter',
'echarts/chart/tree',
'echarts/chart/treemap',
'echarts/chart/venn',
'echarts/chart/wordCloud'
],
function(ec) {
//--- BAR ---
var myChart = ec.init(document.getElementById('echarts_bar'));
myChart.setOption({
tooltip: {
trigger: 'axis'
},
legend: {
data: ['Cost', 'Expenses']
},
toolbox: {
show: true,
feature: {
mark: {
show: true
},
dataView: {
show: true,
readOnly: false
},
magicType: {
show: true,
type: ['line', 'bar']
},
restore: {
show: true
},
saveAsImage: {
show: true
}
}
},
calculable: true,
xAxis: [{
type: 'category',
data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
}],
yAxis: [{
type: 'value',
splitArea: {
show: true
}
}],
series: [{
name: 'Cost',
type: 'bar',
data: [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
}, {
name: 'Expenses',
type: 'bar',
data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
}]
});
// --- LINE ---
var myChart2 = ec.init(document.getElementById('echarts_line'));
myChart2.setOption({
title: {
text: 'Weekly Weather',
subtext: 'Lorem ipsum'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['High', 'Low']
},
toolbox: {
show: true,
feature: {
mark: {
show: true
},
dataView: {
show: true,
readOnly: false
},
magicType: {
show: true,
type: ['line', 'bar']
},
restore: {
show: true
},
saveAsImage: {
show: true
}
}
},
calculable: true,
xAxis: [{
type: 'category',
boundaryGap: false,
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
}],
yAxis: [{
type: 'value',
axisLabel: {
formatter: '{value} °C'
}
}],
series: [{
name: 'High',
type: 'line',
data: [11, 11, 15, 13, 12, 13, 10],
markPoint: {
data: [{
type: 'max',
name: 'Max'
}, {
type: 'min',
name: 'Min'
}]
},
markLine: {
data: [{
type: 'average',
name: 'Mean'
}]
}
}, {
name: 'Low',
type: 'line',
data: [1, -2, 2, 5, 3, 2, 0],
markPoint: {
data: [{
name: 'Lowest',
value: -2,
xAxis: 1,
yAxis: -1.5
}]
},
markLine: {
data: [{
type: 'average',
name: 'Mean'
}]
}
}]
});
// -- SCATTER --
var myChart3 = ec.init(document.getElementById('echarts_scatter'));
myChart3.setOption({
tooltip: {
trigger: 'item'
},
toolbox: {
show: true,
feature: {
mark: {
show: true
},
dataZoom: {
show: true
},
dataView: {
show: true,
readOnly: false
},
restore: {
show: true
},
saveAsImage: {
show: true
}
}
},
dataRange: {
min: 0,
max: 100,
y: 'center',
text: ['High', 'Low'],
color: ['lightgreen', 'yellow'],
calculable: true
},
xAxis: [{
type: 'value',
scale: true
}],
yAxis: [{
type: 'value',
position: 'right',
scale: true
}],
animation: false,
series: [{
name: 'scatter1',
type: 'scatter',
symbolSize: 5,
data: (function() {
var d = [];
var len = 500;
var value;
while (len--) {
value = (Math.random() * 100).toFixed(2) - 0;
d.push([
(Math.random() * value + value).toFixed(2) - 0, (Math.random() * value).toFixed(2) - 0,
value
]);
}
return d;
})()
}]
});
// -- CANDLESTICK --
var myChart4 = ec.init(document.getElementById('echarts_candle'));
myChart4.setOption({
tooltip: {
trigger: 'axis',
formatter: function(params) {
var res = params[0].seriesName + ' ' + params[0].name;
res += '<br/> Opening : ' + params[0].value[0] + ' Highest : ' + params[0].value[3];
res += '<br/> Closing : ' + params[0].value[1] + ' Lowest : ' + params[0].value[2];
return res;
}
},
legend: {
data: ['Composite Index']
},
toolbox: {
show: true,
feature: {
mark: {
show: true
},
dataZoom: {
show: true
},
dataView: {
show: true,
readOnly: false
},
restore: {
show: true
},
saveAsImage: {
show: true
}
}
},
dataZoom: {
show: true,
realtime: true,
start: 0,
end: 50
},
xAxis: [{
type: 'category',
boundaryGap: true,
axisTick: {
onGap: false
},
splitLine: {
show: false
},
data: [
"2013/1/24", "2013/1/25", "2013/1/28", "2013/1/29", "2013/1/30",
"2013/1/31", "2013/2/1", "2013/2/4", "2013/2/5", "2013/2/6",
"2013/2/7", "2013/2/8", "2013/2/18", "2013/2/19", "2013/2/20",
"2013/2/21", "2013/2/22", "2013/2/25", "2013/2/26", "2013/2/27",
"2013/2/28", "2013/3/1", "2013/3/4", "2013/3/5", "2013/3/6",
"2013/3/7", "2013/3/8", "2013/3/11", "2013/3/12", "2013/3/13",
"2013/3/14", "2013/3/15", "2013/3/18", "2013/3/19", "2013/3/20",
"2013/3/21", "2013/3/22", "2013/3/25", "2013/3/26", "2013/3/27",
"2013/3/28", "2013/3/29", "2013/4/1", "2013/4/2", "2013/4/3",
"2013/4/8", "2013/4/9", "2013/4/10", "2013/4/11", "2013/4/12",
"2013/4/15", "2013/4/16", "2013/4/17", "2013/4/18", "2013/4/19",
"2013/4/22", "2013/4/23", "2013/4/24", "2013/4/25", "2013/4/26",
"2013/5/2", "2013/5/3", "2013/5/6", "2013/5/7", "2013/5/8",
"2013/5/9", "2013/5/10", "2013/5/13", "2013/5/14", "2013/5/15",
"2013/5/16", "2013/5/17", "2013/5/20", "2013/5/21", "2013/5/22",
"2013/5/23", "2013/5/24", "2013/5/27", "2013/5/28", "2013/5/29",
"2013/5/30", "2013/5/31", "2013/6/3", "2013/6/4", "2013/6/5",
"2013/6/6", "2013/6/7", "2013/6/13"
]
}],
yAxis: [{
type: 'value',
scale: true,
boundaryGap: [0.01, 0.01]
}],
series: [{
name: 'Composite Index',
type: 'k',
barMaxWidth: 20,
itemStyle: {
normal: {
color: 'red', // Bar Colors
color0: 'lightgreen',
lineStyle: {
width: 2,
color: 'orange',
color0: 'green'
}
},
emphasis: {
color: 'black',
color0: 'white'
}
},
data: [ // Opening, Closing, Min, Max
{
value: [2320.26, 2302.6, 2287.3, 2362.94],
itemStyle: {
normal: {
color0: 'blue', // Opening Fill color
lineStyle: {
width: 3,
color0: 'blue' // Opening Border color
}
},
emphasis: {
color0: 'blue' // Opening Fill color
}
}
},
[2300, 2291.3, 2288.26, 2308.38],
[2295.35, 2346.5, 2295.35, 2346.92],
[2347.22, 2358.98, 2337.35, 2363.8],
[2360.75, 2382.48, 2347.89, 2383.76],
[2383.43, 2385.42, 2371.23, 2391.82],
[2377.41, 2419.02, 2369.57, 2421.15],
[2425.92, 2428.15, 2417.58, 2440.38],
[2411, 2433.13, 2403.3, 2437.42],
[2432.68, 2434.48, 2427.7, 2441.73],
[2430.69, 2418.53, 2394.22, 2433.89],
[2416.62, 2432.4, 2414.4, 2443.03],
[2441.91, 2421.56, 2415.43, 2444.8],
[2420.26, 2382.91, 2373.53, 2427.07],
[2383.49, 2397.18, 2370.61, 2397.94],
[2378.82, 2325.95, 2309.17, 2378.82],
[2322.94, 2314.16, 2308.76, 2330.88],
[2320.62, 2325.82, 2315.01, 2338.78],
[2313.74, 2293.34, 2289.89, 2340.71],
[2297.77, 2313.22, 2292.03, 2324.63],
[2322.32, 2365.59, 2308.92, 2366.16],
[2364.54, 2359.51, 2330.86, 2369.65],
[2332.08, 2273.4, 2259.25, 2333.54],
[2274.81, 2326.31, 2270.1, 2328.14],
[2333.61, 2347.18, 2321.6, 2351.44],
[2340.44, 2324.29, 2304.27, 2352.02],
[2326.42, 2318.61, 2314.59, 2333.67],
[2314.68, 2310.59, 2296.58, 2320.96],
[2309.16, 2286.6, 2264.83, 2333.29],
[2282.17, 2263.97, 2253.25, 2286.33],
[2255.77, 2270.28, 2253.31, 2276.22],
[2269.31, 2278.4, 2250, 2312.08],
[2267.29, 2240.02, 2239.21, 2276.05],
[2244.26, 2257.43, 2232.02, 2261.31],
[2257.74, 2317.37, 2257.42, 2317.86],
[2318.21, 2324.24, 2311.6, 2330.81],
[2321.4, 2328.28, 2314.97, 2332],
[2334.74, 2326.72, 2319.91, 2344.89],
[2318.58, 2297.67, 2281.12, 2319.99],
[2299.38, 2301.26, 2289, 2323.48],
[2273.55, 2236.3, 2232.91, 2273.55],
[2238.49, 2236.62, 2228.81, 2246.87],
[2229.46, 2234.4, 2227.31, 2243.95],
[2234.9, 2227.74, 2220.44, 2253.42],
[2232.69, 2225.29, 2217.25, 2241.34],
[2196.24, 2211.59, 2180.67, 2212.59],
[2215.47, 2225.77, 2215.47, 2234.73],
[2224.93, 2226.13, 2212.56, 2233.04],
[2236.98, 2219.55, 2217.26, 2242.48],
[2218.09, 2206.78, 2204.44, 2226.26],
[2199.91, 2181.94, 2177.39, 2204.99],
[2169.63, 2194.85, 2165.78, 2196.43],
[2195.03, 2193.8, 2178.47, 2197.51],
[2181.82, 2197.6, 2175.44, 2206.03],
[2201.12, 2244.64, 2200.58, 2250.11],
[2236.4, 2242.17, 2232.26, 2245.12],
[2242.62, 2184.54, 2182.81, 2242.62],
[2187.35, 2218.32, 2184.11, 2226.12],
[2213.19, 2199.31, 2191.85, 2224.63],
[2203.89, 2177.91, 2173.86, 2210.58],
[2170.78, 2174.12, 2161.14, 2179.65],
[2179.05, 2205.5, 2179.05, 2222.81],
[2212.5, 2231.17, 2212.5, 2236.07],
[2227.86, 2235.57, 2219.44, 2240.26],
[2242.39, 2246.3, 2235.42, 2255.21],
[2246.96, 2232.97, 2221.38, 2247.86],
[2228.82, 2246.83, 2225.81, 2247.67],
[2247.68, 2241.92, 2231.36, 2250.85],
[2238.9, 2217.01, 2205.87, 2239.93],
[2217.09, 2224.8, 2213.58, 2225.19],
[2221.34, 2251.81, 2210.77, 2252.87],
[2249.81, 2282.87, 2248.41, 2288.09],
[2286.33, 2299.99, 2281.9, 2309.39],
[2297.11, 2305.11, 2290.12, 2305.3],
[2303.75, 2302.4, 2292.43, 2314.18],
[2293.81, 2275.67, 2274.1, 2304.95],
[2281.45, 2288.53, 2270.25, 2292.59],
[2286.66, 2293.08, 2283.94, 2301.7],
[2293.4, 2321.32, 2281.47, 2322.1],
[2323.54, 2324.02, 2321.17, 2334.33],
[2316.25, 2317.75, 2310.49, 2325.72],
[2320.74, 2300.59, 2299.37, 2325.53],
[2300.21, 2299.25, 2294.11, 2313.43],
[2297.1, 2272.42, 2264.76, 2297.1],
[2270.71, 2270.93, 2260.87, 2276.86],
[2264.43, 2242.11, 2240.07, 2266.69],
[2242.26, 2210.9, 2205.07, 2250.63],
[2190.1, 2148.35, 2126.22, 2190.1]
],
markPoint: {
symbol: 'star',
//symbolSize:20,
itemStyle: {
normal: {
label: {
position: 'top'
}
}
},
data: [{
name: 'Highest',
value: 2444.8,
xAxis: '2013/2/18',
yAxis: 2466
}]
}
}]
});
// -- PIE --
var myChart5 = ec.init(document.getElementById('echarts_pie'));
myChart5.setOption({
tooltip: {
show: true,
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
orient: 'vertical',
x: 'left',
data: ['All', 'Marketing', 'Search', 'EDM', 'Partnership', 'Video', 'Social', 'Google', 'Bing', 'Others']
},
toolbox: {
show: true,
feature: {
mark: {
show: true
},
dataView: {
show: true,
readOnly: false
},
restore: {
show: true
},
saveAsImage: {
show: true
}
}
},
calculable: true,
series: [{
name: 'Source',
type: 'pie',
center: ['35%', 200],
radius: 80,
itemStyle: {
normal: {
label: {
position: 'inner',
formatter: function(params) {
return (params.percent - 0).toFixed(0) + '%'
}
},
labelLine: {
show: false
}
},
emphasis: {
label: {
show: true,
formatter: "{b}\n{d}%"
}
}
},
data: [{
value: 335,
name: 'All'
}, {
value: 679,
name: 'Marketing'
}, {
value: 1548,
name: 'Search'
}]
}, {
name: 'Source',
type: 'pie',
center: ['35%', 200],
radius: [110, 140],
data: [{
value: 335,
name: 'All'
}, {
value: 310,
name: 'EDM'
}, {
value: 234,
name: 'Partnership'
}, {
value: 135,
name: 'Video'
}, {
value: 1048,
name: 'Social',
itemStyle: {
normal: {
color: (function() {
var zrColor = require('zrender/tool/color');
return zrColor.getRadialGradient(
300, 200, 110, 300, 200, 140, [
[0, 'rgba(255,255,0,1)'],
[1, 'rgba(30,144,250,1)']
]
)
})(),
label: {
textStyle: {
color: 'rgba(30,144,255,0.8)',
align: 'center',
baseline: 'middle',
fontFamily: 'Open Sans',
fontSize: 30,
fontWeight: '700'
}
},
labelLine: {
length: 40,
lineStyle: {
color: '#f0f',
width: 3,
type: 'dotted'
}
}
}
}
}, {
value: 251,
name: 'Google'
}, {
value: 102,
name: 'Bing',
itemStyle: {
normal: {
label: {
show: false
},
labelLine: {
show: false
}
},
emphasis: {
label: {
show: true
},
labelLine: {
show: true,
length: 50
}
}
}
}, {
value: 147,
name: 'Others'
}]
}, {
name: 'Source',
type: 'pie',
clockWise: true,
startAngle: 135,
center: ['75%', 200],
radius: [80, 120],
itemStyle:  {
normal: {
label: {
show: false
},
labelLine: {
show: false
}
},
emphasis: {
color: (function() {
var zrColor = require('zrender/tool/color');
return zrColor.getRadialGradient(
650, 200, 80, 650, 200, 120, [
[0, 'rgba(255,255,0,1)'],
[1, 'rgba(255,0,0,1)']
]
)
})(),
label: {
show: true,
position: 'center',
formatter: "{d}%",
textStyle: {
color: 'red',
fontSize: '30',
fontFamily: 'Open Sans',
fontWeight: 'bold'
}
}
}
},
data: [{
value: 335,
name: 'All'
}, {
value: 310,
name: 'EDM'
}, {
value: 234,
name: 'Partnership'
}, {
value: 135,
name: 'Video'
}, {
value: 1548,
name: 'Search'
}],
markPoint: {
symbol: 'star',
data: [{
name: 'Max',
value: 1548,
x: '80%',
y: 50,
symbolSize: 32
}]
}
}]
});
}
);
});
File diff suppressed because one or more lines are too long
+969
View File
@@ -0,0 +1,969 @@
var ChartsFlotcharts = function() {
return {
//main function to initiate the module
init: function() {
App.addResizeHandler(function() {
ChartsFlotcharts.initPieCharts();
});
},
initCharts: function() {
if (!jQuery.plot) {
return;
}
var data = [];
var totalPoints = 250;
// random data generator for plot charts
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;
var y = prev + Math.random() * 10 - 5;
if (y < 0) y = 0;
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;
}
//Basic Chart
function chart1() {
if ($('#chart_1').size() != 1) {
return;
}
var d1 = [];
for (var i = 0; i < Math.PI * 2; i += 0.25)
d1.push([i, Math.sin(i)]);
var d2 = [];
for (var i = 0; i < Math.PI * 2; i += 0.25)
d2.push([i, Math.cos(i)]);
var d3 = [];
for (var i = 0; i < Math.PI * 2; i += 0.1)
d3.push([i, Math.tan(i)]);
$.plot($("#chart_1"), [{
label: "sin(x)",
data: d1,
lines: {
lineWidth: 1,
},
shadowSize: 0
}, {
label: "cos(x)",
data: d2,
lines: {
lineWidth: 1,
},
shadowSize: 0
}, {
label: "tan(x)",
data: d3,
lines: {
lineWidth: 1,
},
shadowSize: 0
}], {
series: {
lines: {
show: true,
},
points: {
show: true,
fill: true,
radius: 3,
lineWidth: 1
}
},
xaxis: {
tickColor: "#eee",
ticks: [0, [Math.PI / 2, "\u03c0/2"],
[Math.PI, "\u03c0"],
[Math.PI * 3 / 2, "3\u03c0/2"],
[Math.PI * 2, "2\u03c0"]
]
},
yaxis: {
tickColor: "#eee",
ticks: 10,
min: -2,
max: 2
},
grid: {
borderColor: "#eee",
borderWidth: 1
}
});
}
//Interactive Chart
function chart2() {
if ($('#chart_2').size() != 1) {
return;
}
function randValue() {
return (Math.floor(Math.random() * (1 + 40 - 20))) + 20;
}
var pageviews = [
[1, randValue()],
[2, randValue()],
[3, 2 + randValue()],
[4, 3 + randValue()],
[5, 5 + randValue()],
[6, 10 + randValue()],
[7, 15 + randValue()],
[8, 20 + randValue()],
[9, 25 + randValue()],
[10, 30 + randValue()],
[11, 35 + randValue()],
[12, 25 + randValue()],
[13, 15 + randValue()],
[14, 20 + randValue()],
[15, 45 + randValue()],
[16, 50 + randValue()],
[17, 65 + randValue()],
[18, 70 + randValue()],
[19, 85 + randValue()],
[20, 80 + randValue()],
[21, 75 + randValue()],
[22, 80 + randValue()],
[23, 75 + randValue()],
[24, 70 + randValue()],
[25, 65 + randValue()],
[26, 75 + randValue()],
[27, 80 + randValue()],
[28, 85 + randValue()],
[29, 90 + randValue()],
[30, 95 + randValue()]
];
var visitors = [
[1, randValue() - 5],
[2, randValue() - 5],
[3, randValue() - 5],
[4, 6 + randValue()],
[5, 5 + randValue()],
[6, 20 + randValue()],
[7, 25 + randValue()],
[8, 36 + randValue()],
[9, 26 + randValue()],
[10, 38 + randValue()],
[11, 39 + randValue()],
[12, 50 + randValue()],
[13, 51 + randValue()],
[14, 12 + randValue()],
[15, 13 + randValue()],
[16, 14 + randValue()],
[17, 15 + randValue()],
[18, 15 + randValue()],
[19, 16 + randValue()],
[20, 17 + randValue()],
[21, 18 + randValue()],
[22, 19 + randValue()],
[23, 20 + randValue()],
[24, 21 + randValue()],
[25, 14 + randValue()],
[26, 24 + randValue()],
[27, 25 + randValue()],
[28, 26 + randValue()],
[29, 27 + randValue()],
[30, 31 + randValue()]
];
var plot = $.plot($("#chart_2"), [{
data: pageviews,
label: "Unique Visits",
lines: {
lineWidth: 1,
},
shadowSize: 0
}, {
data: visitors,
label: "Page Views",
lines: {
lineWidth: 1,
},
shadowSize: 0
}], {
series: {
lines: {
show: true,
lineWidth: 2,
fill: true,
fillColor: {
colors: [{
opacity: 0.05
}, {
opacity: 0.01
}]
}
},
points: {
show: true,
radius: 3,
lineWidth: 1
},
shadowSize: 2
},
grid: {
hoverable: true,
clickable: true,
tickColor: "#eee",
borderColor: "#eee",
borderWidth: 1
},
colors: ["#d12610", "#37b7f3", "#52e136"],
xaxis: {
ticks: 11,
tickDecimals: 0,
tickColor: "#eee",
},
yaxis: {
ticks: 11,
tickDecimals: 0,
tickColor: "#eee",
}
});
function showTooltip(x, y, contents) {
$('<div id="tooltip">' + contents + '</div>').css({
position: 'absolute',
display: 'none',
top: y + 5,
left: x + 15,
border: '1px solid #333',
padding: '4px',
color: '#fff',
'border-radius': '3px',
'background-color': '#333',
opacity: 0.80
}).appendTo("body").fadeIn(200);
}
var previousPoint = null;
$("#chart_2").bind("plothover", function(event, pos, item) {
$("#x").text(pos.x.toFixed(2));
$("#y").text(pos.y.toFixed(2));
if (item) {
if (previousPoint != item.dataIndex) {
previousPoint = item.dataIndex;
$("#tooltip").remove();
var x = item.datapoint[0].toFixed(2),
y = item.datapoint[1].toFixed(2);
showTooltip(item.pageX, item.pageY, item.series.label + " of " + x + " = " + y);
}
} else {
$("#tooltip").remove();
previousPoint = null;
}
});
}
//Tracking Curves
function chart3() {
if ($('#chart_3').size() != 1) {
return;
}
//tracking curves:
var sin = [],
cos = [];
for (var i = 0; i < 14; i += 0.1) {
sin.push([i, Math.sin(i)]);
cos.push([i, Math.cos(i)]);
}
plot = $.plot($("#chart_3"), [{
data: sin,
label: "sin(x) = -0.00",
lines: {
lineWidth: 1,
},
shadowSize: 0
}, {
data: cos,
label: "cos(x) = -0.00",
lines: {
lineWidth: 1,
},
shadowSize: 0
}], {
series: {
lines: {
show: true
}
},
crosshair: {
mode: "x"
},
grid: {
hoverable: true,
autoHighlight: false,
tickColor: "#eee",
borderColor: "#eee",
borderWidth: 1
},
yaxis: {
min: -1.2,
max: 1.2
}
});
var legends = $("#chart_3 .legendLabel");
legends.each(function() {
// fix the widths so they don't jump around
$(this).css('width', $(this).width());
});
var updateLegendTimeout = null;
var latestPosition = null;
function updateLegend() {
updateLegendTimeout = null;
var pos = latestPosition;
var axes = plot.getAxes();
if (pos.x < axes.xaxis.min || pos.x > axes.xaxis.max || pos.y < axes.yaxis.min || pos.y > axes.yaxis.max) return;
var i, j, dataset = plot.getData();
for (i = 0; i < dataset.length; ++i) {
var series = dataset[i];
// find the nearest points, x-wise
for (j = 0; j < series.data.length; ++j)
if (series.data[j][0] > pos.x) break;
// now interpolate
var y, p1 = series.data[j - 1],
p2 = series.data[j];
if (p1 == null) y = p2[1];
else if (p2 == null) y = p1[1];
else y = p1[1] + (p2[1] - p1[1]) * (pos.x - p1[0]) / (p2[0] - p1[0]);
legends.eq(i).text(series.label.replace(/=.*/, "= " + y.toFixed(2)));
}
}
$("#chart_3").bind("plothover", function(event, pos, item) {
latestPosition = pos;
if (!updateLegendTimeout) updateLegendTimeout = setTimeout(updateLegend, 50);
});
}
//Dynamic Chart
function chart4() {
if ($('#chart_4').size() != 1) {
return;
}
//server load
var options = {
series: {
shadowSize: 1
},
lines: {
show: true,
lineWidth: 0.5,
fill: true,
fillColor: {
colors: [{
opacity: 0.1
}, {
opacity: 1
}]
}
},
yaxis: {
min: 0,
max: 100,
tickColor: "#eee",
tickFormatter: function(v) {
return v + "%";
}
},
xaxis: {
show: false,
},
colors: ["#6ef146"],
grid: {
tickColor: "#eee",
borderWidth: 0,
}
};
var updateInterval = 30;
var plot = $.plot($("#chart_4"), [getRandomData()], options);
function update() {
plot.setData([getRandomData()]);
plot.draw();
setTimeout(update, updateInterval);
}
update();
}
//bars with controls
function chart5() {
if ($('#chart_5').size() != 1) {
return;
}
var d1 = [];
for (var i = 0; i <= 10; i += 1)
d1.push([i, parseInt(Math.random() * 30)]);
var d2 = [];
for (var i = 0; i <= 10; i += 1)
d2.push([i, parseInt(Math.random() * 30)]);
var d3 = [];
for (var i = 0; i <= 10; i += 1)
d3.push([i, parseInt(Math.random() * 30)]);
var stack = 0,
bars = true,
lines = false,
steps = false;
function plotWithOptions() {
$.plot($("#chart_5"),
[{
label: "sales",
data: d1,
lines: {
lineWidth: 1,
},
shadowSize: 0
}, {
label: "tax",
data: d2,
lines: {
lineWidth: 1,
},
shadowSize: 0
}, {
label: "profit",
data: d3,
lines: {
lineWidth: 1,
},
shadowSize: 0
}]
, {
series: {
stack: stack,
lines: {
show: lines,
fill: true,
steps: steps,
lineWidth: 0, // in pixels
},
bars: {
show: bars,
barWidth: 0.5,
lineWidth: 0, // in pixels
shadowSize: 0,
align: 'center'
}
},
grid: {
tickColor: "#eee",
borderColor: "#eee",
borderWidth: 1
}
}
);
}
$(".stackControls input").click(function(e) {
e.preventDefault();
stack = $(this).val() == "With stacking" ? true : null;
plotWithOptions();
});
$(".graphControls input").click(function(e) {
e.preventDefault();
bars = $(this).val().indexOf("Bars") != -1;
lines = $(this).val().indexOf("Lines") != -1;
steps = $(this).val().indexOf("steps") != -1;
plotWithOptions();
});
plotWithOptions();
}
//graph
chart1();
chart2();
chart3();
chart4();
chart5();
},
initBarCharts: function() {
// bar chart:
var data = GenerateSeries(0);
function GenerateSeries(added) {
var data = [];
var start = 100 + added;
var end = 200 + added;
for (i = 1; i <= 20; i++) {
var d = Math.floor(Math.random() * (end - start + 1) + start);
data.push([i, d]);
start++;
end++;
}
return data;
}
var options = {
series: {
bars: {
show: true
}
},
bars: {
barWidth: 0.8,
lineWidth: 0, // in pixels
shadowSize: 0,
align: 'left'
},
grid: {
tickColor: "#eee",
borderColor: "#eee",
borderWidth: 1
}
};
if ($('#chart_1_1_1').size() !== 0) {
$.plot($("#chart_1_1_1"), [{
data: data,
lines: {
lineWidth: 1,
},
shadowSize: 0
}], options);
}
// horizontal bar chart:
var data1 = [
[10, 10],
[20, 20],
[30, 30],
[40, 40],
[50, 50]
];
var options = {
series: {
bars: {
show: true
}
},
bars: {
horizontal: true,
barWidth: 6,
lineWidth: 0, // in pixels
shadowSize: 0,
align: 'left'
},
grid: {
tickColor: "#eee",
borderColor: "#eee",
borderWidth: 1
}
};
if ($('#chart_1_2').size() !== 0) {
$.plot($("#chart_1_2"), [data1], options);
}
},
initPieCharts: function() {
var data = [];
var series = Math.floor(Math.random() * 10) + 1;
series = series < 5 ? 5 : series;
for (var i = 0; i < series; i++) {
data[i] = {
label: "Series" + (i + 1),
data: Math.floor(Math.random() * 100) + 1
};
}
// DEFAULT
if ($('#pie_chart').size() !== 0) {
$.plot($("#pie_chart"), data, {
series: {
pie: {
show: true
}
}
});
}
// GRAPH 1
if ($('#pie_chart_1').size() !== 0) {
$.plot($("#pie_chart_1"), data, {
series: {
pie: {
show: true
}
},
legend: {
show: false
}
});
}
// GRAPH 2
if ($('#pie_chart_2').size() !== 0) {
$.plot($("#pie_chart_2"), data, {
series: {
pie: {
show: true,
radius: 1,
label: {
show: true,
radius: 1,
formatter: function(label, series) {
return '<div style="font-size:8pt;text-align:center;padding:2px;color:white;">' + label + '<br/>' + Math.round(series.percent) + '%</div>';
},
background: {
opacity: 0.8
}
}
}
},
legend: {
show: false
}
});
}
// GRAPH 3
if ($('#pie_chart_3').size() !== 0) {
$.plot($("#pie_chart_3"), data, {
series: {
pie: {
show: true,
radius: 1,
label: {
show: true,
radius: 3 / 4,
formatter: function(label, series) {
return '<div style="font-size:8pt;text-align:center;padding:2px;color:white;">' + label + '<br/>' + Math.round(series.percent) + '%</div>';
},
background: {
opacity: 0.5
}
}
}
},
legend: {
show: false
}
});
}
// GRAPH 4
if ($('#pie_chart_4').size() !== 0) {
$.plot($("#pie_chart_4"), data, {
series: {
pie: {
show: true,
radius: 1,
label: {
show: true,
radius: 3 / 4,
formatter: function(label, series) {
return '<div style="font-size:8pt;text-align:center;padding:2px;color:white;">' + label + '<br/>' + Math.round(series.percent) + '%</div>';
},
background: {
opacity: 0.5,
color: '#000'
}
}
}
},
legend: {
show: false
}
});
}
// GRAPH 5
if ($('#pie_chart_5').size() !== 0) {
$.plot($("#pie_chart_5"), data, {
series: {
pie: {
show: true,
radius: 3 / 4,
label: {
show: true,
radius: 3 / 4,
formatter: function(label, series) {
return '<div style="font-size:8pt;text-align:center;padding:2px;color:white;">' + label + '<br/>' + Math.round(series.percent) + '%</div>';
},
background: {
opacity: 0.5,
color: '#000'
}
}
}
},
legend: {
show: false
}
});
}
// GRAPH 6
if ($('#pie_chart_6').size() !== 0) {
$.plot($("#pie_chart_6"), data, {
series: {
pie: {
show: true,
radius: 1,
label: {
show: true,
radius: 2 / 3,
formatter: function(label, series) {
return '<div style="font-size:8pt;text-align:center;padding:2px;color:white;">' + label + '<br/>' + Math.round(series.percent) + '%</div>';
},
threshold: 0.1
}
}
},
legend: {
show: false
}
});
}
// GRAPH 7
if ($('#pie_chart_7').size() !== 0) {
$.plot($("#pie_chart_7"), data, {
series: {
pie: {
show: true,
combine: {
color: '#999',
threshold: 0.1
}
}
},
legend: {
show: false
}
});
}
// GRAPH 8
if ($('#pie_chart_8').size() !== 0) {
$.plot($("#pie_chart_8"), data, {
series: {
pie: {
show: true,
radius: 300,
label: {
show: true,
formatter: function(label, series) {
return '<div style="font-size:8pt;text-align:center;padding:2px;color:white;">' + label + '<br/>' + Math.round(series.percent) + '%</div>';
},
threshold: 0.1
}
}
},
legend: {
show: false
}
});
}
// GRAPH 9
if ($('#pie_chart_9').size() !== 0) {
$.plot($("#pie_chart_9"), data, {
series: {
pie: {
show: true,
radius: 1,
tilt: 0.5,
label: {
show: true,
radius: 1,
formatter: function(label, series) {
return '<div style="font-size:8pt;text-align:center;padding:2px;color:white;">' + label + '<br/>' + Math.round(series.percent) + '%</div>';
},
background: {
opacity: 0.8
}
},
combine: {
color: '#999',
threshold: 0.1
}
}
},
legend: {
show: false
}
});
}
// DONUT
if ($('#donut').size() !== 0) {
$.plot($("#donut"), data, {
series: {
pie: {
innerRadius: 0.5,
show: true
}
}
});
}
// INTERACTIVE
if ($('#interactive').size() !== 0) {
$.plot($("#interactive"), data, {
series: {
pie: {
show: true
}
},
grid: {
hoverable: true,
clickable: true
}
});
$("#interactive").bind("plothover", pieHover);
$("#interactive").bind("plotclick", pieClick);
}
function pieHover(event, pos, obj) {
if (!obj)
return;
percent = parseFloat(obj.series.percent).toFixed(2);
$("#hover").html('<span style="font-weight: bold; color: ' + obj.series.color + '">' + obj.series.label + ' (' + percent + '%)</span>');
}
function pieClick(event, pos, obj) {
if (!obj)
return;
percent = parseFloat(obj.series.percent).toFixed(2);
alert('' + obj.series.label + ': ' + percent + '%');
}
},
initAxisLabelsPlugin: function() {
var d1 = [];
for (var i = 0; i < Math.PI * 2; i += 0.25)
d1.push([i, Math.sin(i)]);
var d2 = [];
for (var i = 0; i < Math.PI * 2; i += 0.25)
d2.push([i, Math.cos(i)]);
var d3 = [];
for (var i = 0; i < Math.PI * 2; i += 0.1)
d3.push([i, Math.tan(i)]);
var options = {
axisLabels: {
show: true
},
xaxes: [{
axisLabel: 'hor label',
tickColor: "#eee",
}],
yaxes: [{
position: 'left',
axisLabel: 'ver label',
tickColor: "#eee",
}, {
position: 'right',
axisLabel: 'bleem'
}],
grid: {
borderColor: "#eee",
borderWidth: 1
}
};
$.plot($("#chart_1_1"),
[{
label: "sin(x)",
data: d1,
lines: {
lineWidth: 1,
},
shadowSize: 0
}, {
label: "cos(x)",
data: d2,
lines: {
lineWidth: 1,
},
shadowSize: 0
}, {
label: "tan(x)",
data: d3,
lines: {
lineWidth: 1,
},
shadowSize: 0
}],
options
);
}
};
}();
jQuery(document).ready(function() {
ChartsFlotcharts.init();
ChartsFlotcharts.initCharts();
ChartsFlotcharts.initPieCharts();
ChartsFlotcharts.initBarCharts();
ChartsFlotcharts.initAxisLabelsPlugin();
});
File diff suppressed because one or more lines are too long
+179
View File
@@ -0,0 +1,179 @@
var ChartsFlowchart = function() {
var handleDemo1 = function() {
var flow = '';
flow += 'st=>start: Start:>http://keenthemes.com[blank]' + "\n";
flow += 'e=>end:>http://keenthemes.com' + "\n";
flow += 'op1=>operation: My Operation' + "\n";
flow += 'sub1=>subroutine: My Subroutine' + "\n";;
flow += 'cond=>condition: Yes' + "\n";
flow += 'or No?:>http://keenthemes.com' + "\n";
flow += 'io=>inputoutput: catch something...' + "\n";
flow += 'st->op1->cond' + "\n";
flow += 'cond(yes)->io->e' + "\n";
flow += 'cond(no)->sub1(right)->op1';
var diagram = flowchart.parse(flow);
diagram.drawSVG('diagram_1', {
'x': 0,
'y': 0,
'line-width': 3,
'line-length': 50,
'text-margin': 10,
'font-size': 14,
'font-color': 'black',
'line-color': 'black',
'element-color': 'black',
'fill': 'white',
'yes-text': 'yes',
'no-text': 'no',
'arrow-end': 'block',
'scale': 1,
// style symbol types
'symbols': {
'start': {
'font-color': 'red',
'element-color': 'green',
'fill': 'yellow'
},
'end': {
'class': 'end-element'
}
},
// even flowstate support ;-)
'flowstate': {
'past': {
'fill': '#CCCCCC',
'font-size': 12
},
'current': {
'fill': 'yellow',
'font-color': 'red',
'font-weight': 'bold'
},
'future': {
'fill': '#FFFF99'
},
'request': {
'fill': 'blue'
},
'invalid': {
'fill': '#444444'
},
'approved': {
'fill': '#58C4A3',
'font-size': 12,
'yes-text': 'APPROVED',
'no-text': 'n/a'
},
'rejected': {
'fill': '#C45879',
'font-size': 12,
'yes-text': 'n/a',
'no-text': 'REJECTED'
}
}
});
}
var handleDemo2 = function() {
var flow = '';
flow += 'st=>start: Start:>http://keenthemes.com[blank]' + "\n";
flow += 'st=>start: Start|past:>http://keenthemes.com[blank]' + "\n";
flow += 'e=>end: End|future:>http://keenthemes.com' + "\n";
flow += 'op1=>operation: My Operation|past' + "\n";
flow += 'op2=>operation: Stuff|current' + "\n";
flow += 'sub1=>subroutine: My Subroutine|invalid' + "\n";
flow += 'cond=>condition: Yes' + "\n";
flow += 'or No?|approved:>http://keenthemes.com' + "\n";
flow += 'c2=>condition: Good idea|rejected' + "\n";
flow += 'io=>inputoutput: catch something...|future' + "\n";
flow += 'st->op1(right)->cond' + "\n";
flow += 'cond(yes, right)->c2' + "\n";
flow += 'cond(no)->sub1(left)->op1' + "\n";
flow += 'c2(yes)->io->e' + "\n";
flow += 'c2(no)->op2->e' + "\n";
var diagram = flowchart.parse(flow);
diagram.drawSVG('diagram_2', {
'x': 0,
'y': 0,
'line-width': 3,
'line-length': 50,
'text-margin': 10,
'font-size': 14,
'font-color': 'black',
'line-color': 'black',
'element-color': 'black',
'fill': 'white',
'yes-text': 'yes',
'no-text': 'no',
'arrow-end': 'block',
'scale': 1,
// style symbol types
'symbols': {
'start': {
'font-color': 'red',
'element-color': 'green',
'fill': 'yellow'
},
'end': {
'class': 'end-element'
}
},
// even flowstate support ;-)
'flowstate': {
'past': {
'fill': '#CCCCCC',
'font-size': 12
},
'current': {
'fill': 'yellow',
'font-color': 'red',
'font-weight': 'bold'
},
'future': {
'fill': '#FFFF99'
},
'request': {
'fill': 'blue'
},
'invalid': {
'fill': '#444444'
},
'approved': {
'fill': '#58C4A3',
'font-size': 12,
'yes-text': 'APPROVED',
'no-text': 'n/a'
},
'rejected': {
'fill': '#C45879',
'font-size': 12,
'yes-text': 'n/a',
'no-text': 'REJECTED'
}
}
});
}
return {
init: function() {
handleDemo1();
handleDemo2();
}
};
}();
jQuery(document).ready(function() {
ChartsFlowchart.init();
});
+1
View File
@@ -0,0 +1 @@
var ChartsFlowchart=function(){var e=function(){var e="";e+="st=>start: Start:>http://keenthemes.com[blank]\n",e+="e=>end:>http://keenthemes.com\n",e+="op1=>operation: My Operation\n",e+="sub1=>subroutine: My Subroutine\n",e+="cond=>condition: Yes\n",e+="or No?:>http://keenthemes.com\n",e+="io=>inputoutput: catch something...\n",e+="st->op1->cond\n",e+="cond(yes)->io->e\n",e+="cond(no)->sub1(right)->op1";var t=flowchart.parse(e);t.drawSVG("diagram_1",{x:0,y:0,"line-width":3,"line-length":50,"text-margin":10,"font-size":14,"font-color":"black","line-color":"black","element-color":"black",fill:"white","yes-text":"yes","no-text":"no","arrow-end":"block",scale:1,symbols:{start:{"font-color":"red","element-color":"green",fill:"yellow"},end:{"class":"end-element"}},flowstate:{past:{fill:"#CCCCCC","font-size":12},current:{fill:"yellow","font-color":"red","font-weight":"bold"},future:{fill:"#FFFF99"},request:{fill:"blue"},invalid:{fill:"#444444"},approved:{fill:"#58C4A3","font-size":12,"yes-text":"APPROVED","no-text":"n/a"},rejected:{fill:"#C45879","font-size":12,"yes-text":"n/a","no-text":"REJECTED"}}})},t=function(){var e="";e+="st=>start: Start:>http://keenthemes.com[blank]\n",e+="st=>start: Start|past:>http://keenthemes.com[blank]\n",e+="e=>end: End|future:>http://keenthemes.com\n",e+="op1=>operation: My Operation|past\n",e+="op2=>operation: Stuff|current\n",e+="sub1=>subroutine: My Subroutine|invalid\n",e+="cond=>condition: Yes\n",e+="or No?|approved:>http://keenthemes.com\n",e+="c2=>condition: Good idea|rejected\n",e+="io=>inputoutput: catch something...|future\n",e+="st->op1(right)->cond\n",e+="cond(yes, right)->c2\n",e+="cond(no)->sub1(left)->op1\n",e+="c2(yes)->io->e\n",e+="c2(no)->op2->e\n";var t=flowchart.parse(e);t.drawSVG("diagram_2",{x:0,y:0,"line-width":3,"line-length":50,"text-margin":10,"font-size":14,"font-color":"black","line-color":"black","element-color":"black",fill:"white","yes-text":"yes","no-text":"no","arrow-end":"block",scale:1,symbols:{start:{"font-color":"red","element-color":"green",fill:"yellow"},end:{"class":"end-element"}},flowstate:{past:{fill:"#CCCCCC","font-size":12},current:{fill:"yellow","font-color":"red","font-weight":"bold"},future:{fill:"#FFFF99"},request:{fill:"blue"},invalid:{fill:"#444444"},approved:{fill:"#58C4A3","font-size":12,"yes-text":"APPROVED","no-text":"n/a"},rejected:{fill:"#C45879","font-size":12,"yes-text":"n/a","no-text":"REJECTED"}}})};return{init:function(){e(),t()}}}();jQuery(document).ready(function(){ChartsFlowchart.init()});
+204
View File
@@ -0,0 +1,204 @@
// GOOGLE CHARTS INIT
google.load('visualization', '1', {
packages: ['corechart', 'bar', 'line']
});
google.load("visualization", "1.1", {
packages: ["gantt"]
});
google.setOnLoadCallback(drawChart);
// GOOGLE COLUMN CHART 1
function drawChart() {
// COLUMN CHART
var data = new google.visualization.DataTable();
data.addColumn('timeofday', 'Time of Day');
data.addColumn('number', 'Motivation Level');
data.addColumn('number', 'Energy Level');
data.addRows([
[{
v: [8, 0, 0],
f: '8 am'
}, 1, .25],
[{
v: [9, 0, 0],
f: '9 am'
}, 2, .5],
[{
v: [10, 0, 0],
f: '10 am'
}, 3, 1],
[{
v: [11, 0, 0],
f: '11 am'
}, 4, 2.25],
[{
v: [12, 0, 0],
f: '12 pm'
}, 5, 2.25],
[{
v: [13, 0, 0],
f: '1 pm'
}, 6, 3],
[{
v: [14, 0, 0],
f: '2 pm'
}, 7, 4],
[{
v: [15, 0, 0],
f: '3 pm'
}, 8, 5.25],
[{
v: [16, 0, 0],
f: '4 pm'
}, 9, 7.5],
[{
v: [17, 0, 0],
f: '5 pm'
}, 10, 10],
]);
var options = {
title: 'Motivation and Energy Level Throughout the Day',
focusTarget: 'category',
hAxis: {
title: 'Time of Day',
format: 'h:mm a',
viewWindow: {
min: [7, 30, 0],
max: [17, 30, 0]
},
},
vAxis: {
title: 'Rating (scale of 1-10)'
}
};
var chart = new google.visualization.ColumnChart(document.getElementById('gchart_col_1'));
chart.draw(data, options);
var chart = new google.visualization.ColumnChart(document.getElementById('gchart_col_2'));
chart.draw(data, options);
// LINE CHART
var data = new google.visualization.DataTable();
data.addColumn('number', 'Day');
data.addColumn('number', 'Guardians of the Galaxy');
data.addColumn('number', 'The Avengers');
data.addColumn('number', 'Transformers: Age of Extinction');
data.addRows([
[1, 37.8, 80.8, 41.8],
[2, 30.9, 69.5, 32.4],
[3, 25.4, 57, 25.7],
[4, 11.7, 18.8, 10.5],
[5, 11.9, 17.6, 10.4],
[6, 8.8, 13.6, 7.7],
[7, 7.6, 12.3, 9.6],
[8, 12.3, 29.2, 10.6],
[9, 16.9, 42.9, 14.8],
[10, 12.8, 30.9, 11.6],
[11, 5.3, 7.9, 4.7],
[12, 6.6, 8.4, 5.2],
[13, 4.8, 6.3, 3.6],
[14, 4.2, 6.2, 3.4]
]);
var options = {
chart: {
title: 'Box Office Earnings in First Two Weeks of Opening',
subtitle: 'in millions of dollars (USD)'
}
};
var chart = new google.charts.Line(document.getElementById('gchart_line_1'));
chart.draw(data, options);
// PIE CHART
var data = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
['Work', 11],
['Eat', 2],
['Commute', 2],
['Watch TV', 2],
['Sleep', 7]
]);
var options = {
title: 'My Daily Activities'
};
var chart = new google.visualization.PieChart(document.getElementById('gchart_pie_1'));
chart.draw(data, options);
var options = {
pieHole: 0.4
};
var chart = new google.visualization.PieChart(document.getElementById('gchart_pie_2'));
chart.draw(data, options);
// GANTT CHART
var data = new google.visualization.DataTable();
data.addColumn('string', 'Task ID');
data.addColumn('string', 'Task Name');
data.addColumn('string', 'Resource');
data.addColumn('date', 'Start Date');
data.addColumn('date', 'End Date');
data.addColumn('number', 'Duration');
data.addColumn('number', 'Percent Complete');
data.addColumn('string', 'Dependencies');
data.addRows([
['2014Spring', 'Spring 2014', 'spring',
new Date(2014, 2, 22), new Date(2014, 5, 20), null, 100, null
],
['2014Summer', 'Summer 2014', 'summer',
new Date(2014, 5, 21), new Date(2014, 8, 20), null, 100, null
],
['2014Autumn', 'Autumn 2014', 'autumn',
new Date(2014, 8, 21), new Date(2014, 11, 20), null, 100, null
],
['2014Winter', 'Winter 2014', 'winter',
new Date(2014, 11, 21), new Date(2015, 2, 21), null, 100, null
],
['2015Spring', 'Spring 2015', 'spring',
new Date(2015, 2, 22), new Date(2015, 5, 20), null, 50, null
],
['2015Summer', 'Summer 2015', 'summer',
new Date(2015, 5, 21), new Date(2015, 8, 20), null, 0, null
],
['2015Autumn', 'Autumn 2015', 'autumn',
new Date(2015, 8, 21), new Date(2015, 11, 20), null, 0, null
],
['2015Winter', 'Winter 2015', 'winter',
new Date(2015, 11, 21), new Date(2016, 2, 21), null, 0, null
],
['Football', 'Football Season', 'sports',
new Date(2014, 8, 4), new Date(2015, 1, 1), null, 100, null
],
['Baseball', 'Baseball Season', 'sports',
new Date(2015, 2, 31), new Date(2015, 9, 20), null, 14, null
],
['Basketball', 'Basketball Season', 'sports',
new Date(2014, 9, 28), new Date(2015, 5, 20), null, 86, null
],
['Hockey', 'Hockey Season', 'sports',
new Date(2014, 9, 8), new Date(2015, 5, 21), null, 89, null
]
]);
var options = {
height: 400,
gantt: {
trackHeight: 30
}
};
var chart = new google.visualization.GanttChart(document.getElementById('gchart_gantt'));
chart.draw(data, options);
}
+1
View File
@@ -0,0 +1 @@
function drawChart(){var e=new google.visualization.DataTable;e.addColumn("timeofday","Time of Day"),e.addColumn("number","Motivation Level"),e.addColumn("number","Energy Level"),e.addRows([[{v:[8,0,0],f:"8 am"},1,.25],[{v:[9,0,0],f:"9 am"},2,.5],[{v:[10,0,0],f:"10 am"},3,1],[{v:[11,0,0],f:"11 am"},4,2.25],[{v:[12,0,0],f:"12 pm"},5,2.25],[{v:[13,0,0],f:"1 pm"},6,3],[{v:[14,0,0],f:"2 pm"},7,4],[{v:[15,0,0],f:"3 pm"},8,5.25],[{v:[16,0,0],f:"4 pm"},9,7.5],[{v:[17,0,0],f:"5 pm"},10,10]]);var a={title:"Motivation and Energy Level Throughout the Day",focusTarget:"category",hAxis:{title:"Time of Day",format:"h:mm a",viewWindow:{min:[7,30,0],max:[17,30,0]}},vAxis:{title:"Rating (scale of 1-10)"}},n=new google.visualization.ColumnChart(document.getElementById("gchart_col_1"));n.draw(e,a);var n=new google.visualization.ColumnChart(document.getElementById("gchart_col_2"));n.draw(e,a);var e=new google.visualization.DataTable;e.addColumn("number","Day"),e.addColumn("number","Guardians of the Galaxy"),e.addColumn("number","The Avengers"),e.addColumn("number","Transformers: Age of Extinction"),e.addRows([[1,37.8,80.8,41.8],[2,30.9,69.5,32.4],[3,25.4,57,25.7],[4,11.7,18.8,10.5],[5,11.9,17.6,10.4],[6,8.8,13.6,7.7],[7,7.6,12.3,9.6],[8,12.3,29.2,10.6],[9,16.9,42.9,14.8],[10,12.8,30.9,11.6],[11,5.3,7.9,4.7],[12,6.6,8.4,5.2],[13,4.8,6.3,3.6],[14,4.2,6.2,3.4]]);var a={chart:{title:"Box Office Earnings in First Two Weeks of Opening",subtitle:"in millions of dollars (USD)"}},n=new google.charts.Line(document.getElementById("gchart_line_1"));n.draw(e,a);var e=google.visualization.arrayToDataTable([["Task","Hours per Day"],["Work",11],["Eat",2],["Commute",2],["Watch TV",2],["Sleep",7]]),a={title:"My Daily Activities"},n=new google.visualization.PieChart(document.getElementById("gchart_pie_1"));n.draw(e,a);var a={pieHole:.4},n=new google.visualization.PieChart(document.getElementById("gchart_pie_2"));n.draw(e,a);var e=new google.visualization.DataTable;e.addColumn("string","Task ID"),e.addColumn("string","Task Name"),e.addColumn("string","Resource"),e.addColumn("date","Start Date"),e.addColumn("date","End Date"),e.addColumn("number","Duration"),e.addColumn("number","Percent Complete"),e.addColumn("string","Dependencies"),e.addRows([["2014Spring","Spring 2014","spring",new Date(2014,2,22),new Date(2014,5,20),null,100,null],["2014Summer","Summer 2014","summer",new Date(2014,5,21),new Date(2014,8,20),null,100,null],["2014Autumn","Autumn 2014","autumn",new Date(2014,8,21),new Date(2014,11,20),null,100,null],["2014Winter","Winter 2014","winter",new Date(2014,11,21),new Date(2015,2,21),null,100,null],["2015Spring","Spring 2015","spring",new Date(2015,2,22),new Date(2015,5,20),null,50,null],["2015Summer","Summer 2015","summer",new Date(2015,5,21),new Date(2015,8,20),null,0,null],["2015Autumn","Autumn 2015","autumn",new Date(2015,8,21),new Date(2015,11,20),null,0,null],["2015Winter","Winter 2015","winter",new Date(2015,11,21),new Date(2016,2,21),null,0,null],["Football","Football Season","sports",new Date(2014,8,4),new Date(2015,1,1),null,100,null],["Baseball","Baseball Season","sports",new Date(2015,2,31),new Date(2015,9,20),null,14,null],["Basketball","Basketball Season","sports",new Date(2014,9,28),new Date(2015,5,20),null,86,null],["Hockey","Hockey Season","sports",new Date(2014,9,8),new Date(2015,5,21),null,89,null]]);var a={height:400,gantt:{trackHeight:30}},n=new google.visualization.GanttChart(document.getElementById("gchart_gantt"));n.draw(e,a)}google.load("visualization","1",{packages:["corechart","bar","line"]}),google.load("visualization","1.1",{packages:["gantt"]}),google.setOnLoadCallback(drawChart);
+403
View File
@@ -0,0 +1,403 @@
jQuery(document).ready(function() {
// HIGHCHARTS DEMOS
// LINE CHART 1
$('#highchart_1').highcharts({
chart : {
style: {
fontFamily: 'Open Sans'
}
},
title: {
text: 'Monthly Average Temperature',
x: -20 //center
},
subtitle: {
text: 'Source: WorldClimate.com',
x: -20
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
yAxis: {
title: {
text: 'Temperature (°C)'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
valueSuffix: '°C'
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
},
series: [{
name: 'Tokyo',
data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
}, {
name: 'New York',
data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5]
}, {
name: 'Berlin',
data: [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0]
}, {
name: 'London',
data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
}]
});
// LINE CHART 2
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=usdeur.json&callback=?', function (data) {
$('#highchart_2').highcharts({
chart: {
zoomType: 'x',
style: {
fontFamily: 'Open Sans'
}
},
title: {
text: 'USD to EUR exchange rate over time'
},
subtitle: {
text: document.ontouchstart === undefined ?
'Click and drag in the plot area to zoom in' : 'Pinch the chart to zoom in'
},
xAxis: {
type: 'datetime'
},
yAxis: {
title: {
text: 'Exchange rate'
}
},
legend: {
enabled: false
},
plotOptions: {
area: {
fillColor: {
linearGradient: {
x1: 0,
y1: 0,
x2: 0,
y2: 1
},
stops: [
[0, Highcharts.getOptions().colors[0]],
[1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
]
},
marker: {
radius: 2
},
lineWidth: 1,
states: {
hover: {
lineWidth: 1
}
},
threshold: null
}
},
series: [{
type: 'area',
name: 'USD to EUR',
data: data
}]
});
});
// AREA CHART
$('#highchart_3').highcharts({
chart: {
type: 'area',
style: {
fontFamily: 'Open Sans'
}
},
title: {
text: 'Historic and Estimated Worldwide Population Growth by Region'
},
subtitle: {
text: 'Source: Wikipedia.org'
},
xAxis: {
categories: ['1750', '1800', '1850', '1900', '1950', '1999', '2050'],
tickmarkPlacement: 'on',
title: {
enabled: false
}
},
yAxis: {
title: {
text: 'Billions'
},
labels: {
formatter: function () {
return this.value / 1000;
}
}
},
tooltip: {
shared: true,
valueSuffix: ' millions'
},
plotOptions: {
area: {
stacking: 'normal',
lineColor: '#666666',
lineWidth: 1,
marker: {
lineWidth: 1,
lineColor: '#666666'
}
}
},
series: [{
name: 'Asia',
data: [502, 635, 809, 947, 1402, 3634, 5268]
}, {
name: 'Africa',
data: [106, 107, 111, 133, 221, 767, 1766]
}, {
name: 'Europe',
data: [163, 203, 276, 408, 547, 729, 628]
}, {
name: 'America',
data: [18, 31, 54, 156, 339, 818, 1201]
}, {
name: 'Oceania',
data: [2, 2, 2, 6, 13, 30, 46]
}]
});
// BAR CHART
// Age categories
var categories = ['0-4', '5-9', '10-14', '15-19',
'20-24', '25-29', '30-34', '35-39', '40-44',
'45-49', '50-54', '55-59', '60-64', '65-69',
'70-74', '75-79', '80-84', '85-89', '90-94',
'95-99', '100 + '];
$('#highchart_4').highcharts({
chart: {
type: 'bar',
style: {
fontFamily: 'Open Sans'
}
},
title: {
text: 'Population pyramid for Germany, 2015'
},
subtitle: {
text: 'Source: <a href="http://populationpyramid.net/germany/2015/">Population Pyramids of the World from 1950 to 2100</a>'
},
xAxis: [{
categories: categories,
reversed: false,
labels: {
step: 1
}
}, { // mirror axis on right side
opposite: true,
reversed: false,
categories: categories,
linkedTo: 0,
labels: {
step: 1
}
}],
yAxis: {
title: {
text: null
},
labels: {
formatter: function () {
return Math.abs(this.value) + '%';
}
}
},
plotOptions: {
series: {
stacking: 'normal'
}
},
tooltip: {
formatter: function () {
return '<b>' + this.series.name + ', age ' + this.point.category + '</b><br/>' +
'Population: ' + Highcharts.numberFormat(Math.abs(this.point.y), 0);
}
},
series: [{
name: 'Male',
data: [-2.2, -2.2, -2.3, -2.5, -2.7, -3.1, -3.2,
-3.0, -3.2, -4.3, -4.4, -3.6, -3.1, -2.4,
-2.5, -2.3, -1.2, -0.6, -0.2, -0.0, -0.0]
}, {
name: 'Female',
data: [2.1, 2.0, 2.2, 2.4, 2.6, 3.0, 3.1, 2.9,
3.1, 4.1, 4.3, 3.6, 3.4, 2.6, 2.9, 2.9,
1.8, 1.2, 0.6, 0.1, 0.0]
}]
});
// DONUT CHART
var colors = Highcharts.getOptions().colors,
categories = ['MSIE', 'Firefox', 'Chrome', 'Safari', 'Opera'],
data = [{
y: 56.33,
color: colors[0],
drilldown: {
name: 'MSIE versions',
categories: ['MSIE 6.0', 'MSIE 7.0', 'MSIE 8.0', 'MSIE 9.0', 'MSIE 10.0', 'MSIE 11.0'],
data: [1.06, 0.5, 17.2, 8.11, 5.33, 24.13],
color: colors[0]
}
}, {
y: 10.38,
color: colors[1],
drilldown: {
name: 'Firefox versions',
categories: ['Firefox v31', 'Firefox v32', 'Firefox v33', 'Firefox v35', 'Firefox v36', 'Firefox v37', 'Firefox v38'],
data: [0.33, 0.15, 0.22, 1.27, 2.76, 2.32, 2.31, 1.02],
color: colors[1]
}
}, {
y: 24.03,
color: colors[2],
drilldown: {
name: 'Chrome versions',
categories: ['Chrome v30.0', 'Chrome v31.0', 'Chrome v32.0', 'Chrome v33.0', 'Chrome v34.0',
'Chrome v35.0', 'Chrome v36.0', 'Chrome v37.0', 'Chrome v38.0', 'Chrome v39.0', 'Chrome v40.0', 'Chrome v41.0', 'Chrome v42.0', 'Chrome v43.0'
],
data: [0.14, 1.24, 0.55, 0.19, 0.14, 0.85, 2.53, 0.38, 0.6, 2.96, 5, 4.32, 3.68, 1.45],
color: colors[2]
}
}, {
y: 4.77,
color: colors[3],
drilldown: {
name: 'Safari versions',
categories: ['Safari v5.0', 'Safari v5.1', 'Safari v6.1', 'Safari v6.2', 'Safari v7.0', 'Safari v7.1', 'Safari v8.0'],
data: [0.3, 0.42, 0.29, 0.17, 0.26, 0.77, 2.56],
color: colors[3]
}
}, {
y: 0.91,
color: colors[4],
drilldown: {
name: 'Opera versions',
categories: ['Opera v12.x', 'Opera v27', 'Opera v28', 'Opera v29'],
data: [0.34, 0.17, 0.24, 0.16],
color: colors[4]
}
}, {
y: 0.2,
color: colors[5],
drilldown: {
name: 'Proprietary or Undetectable',
categories: [],
data: [],
color: colors[5]
}
}],
browserData = [],
versionsData = [],
i,
j,
dataLen = data.length,
drillDataLen,
brightness;
// Build the data arrays
for (i = 0; i < dataLen; i += 1) {
// add browser data
browserData.push({
name: categories[i],
y: data[i].y,
color: data[i].color
});
// add version data
drillDataLen = data[i].drilldown.data.length;
for (j = 0; j < drillDataLen; j += 1) {
brightness = 0.2 - (j / drillDataLen) / 5;
versionsData.push({
name: data[i].drilldown.categories[j],
y: data[i].drilldown.data[j],
color: Highcharts.Color(data[i].color).brighten(brightness).get()
});
}
}
// Create the chart
$('#highchart_5').highcharts({
chart: {
type: 'pie',
style: {
fontFamily: 'Open Sans'
}
},
title: {
text: 'Browser market share, January, 2015 to May, 2015'
},
subtitle: {
text: 'Source: <a href="http://netmarketshare.com/">netmarketshare.com</a>'
},
yAxis: {
title: {
text: 'Total percent market share'
}
},
plotOptions: {
pie: {
shadow: false,
center: ['50%', '50%']
}
},
tooltip: {
valueSuffix: '%'
},
series: [{
name: 'Browsers',
data: browserData,
size: '60%',
dataLabels: {
formatter: function () {
return this.y > 5 ? this.point.name : null;
},
color: '#ffffff',
distance: -30
}
}, {
name: 'Versions',
data: versionsData,
size: '80%',
innerSize: '60%',
dataLabels: {
formatter: function () {
// display only if larger than 1
return this.y > 1 ? '<b>' + this.point.name + ':</b> ' + this.y + '%' : null;
}
}
}]
});
});
File diff suppressed because one or more lines are too long
+200
View File
@@ -0,0 +1,200 @@
jQuery(document).ready(function() {
// HIGHMAPS DEMOS
// MAP BUBBLE
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=world-population.json&callback=?', function (data) {
var mapData = Highcharts.geojson(Highcharts.maps['custom/world']);
// Correct UK to GB in data
$.each(data, function () {
if (this.code === 'UK') {
this.code = 'GB';
}
});
$('#highmaps_1').highcharts('Map', {
chart : {
style: {
fontFamily: 'Open Sans'
}
},
title: {
text: 'World population 2013 by country'
},
subtitle : {
text : 'Demo of Highcharts map with bubbles'
},
legend: {
enabled: false
},
mapNavigation: {
enabled: true,
buttonOptions: {
verticalAlign: 'bottom'
}
},
series : [{
name: 'Countries',
mapData: mapData,
color: '#E0E0E0',
enableMouseTracking: false
}, {
type: 'mapbubble',
mapData: mapData,
name: 'Population 2013',
joinBy: ['iso-a2', 'code'],
data: data,
minSize: 4,
maxSize: '12%',
tooltip: {
pointFormat: '{point.code}: {point.z} thousands'
}
}]
});
});
// HEAT MAP
$('#highmaps_2').highcharts({
data: {
csv: document.getElementById('csv').innerHTML
},
chart: {
type: 'heatmap',
inverted: true,
style: {
fontFamily: 'Open Sans'
}
},
title: {
text: 'Highcharts heat map',
align: 'left'
},
subtitle: {
text: 'Temperature variation by day and hour through May 2015',
align: 'left'
},
xAxis: {
tickPixelInterval: 50,
min: Date.UTC(2015, 4, 1),
max: Date.UTC(2015, 4, 30)
},
yAxis: {
title: {
text: null
},
labels: {
format: '{value}:00'
},
minPadding: 0,
maxPadding: 0,
startOnTick: false,
endOnTick: false,
tickPositions: [0, 6, 12, 18, 24],
tickWidth: 1,
min: 0,
max: 23
},
colorAxis: {
stops: [
[0, '#3060cf'],
[0.5, '#fffbbc'],
[0.9, '#c4463a']
],
min: -5
},
series: [{
borderWidth: 0,
colsize: 24 * 36e5, // one day
tooltip: {
headerFormat: 'Temperature<br/>',
pointFormat: '{point.x:%e %b, %Y} {point.y}:00: <b>{point.value} ℃</b>'
}
}]
});
// TIMEZONE MAP
// Instanciate the map
$('#highmaps_3').highcharts('Map', {
chart: {
spacingBottom: 20,
style: {
fontFamily: 'Open Sans'
}
},
title : {
text : 'Europe time zones'
},
legend: {
enabled: true
},
plotOptions: {
map: {
allAreas: false,
joinBy: ['iso-a2', 'code'],
dataLabels: {
enabled: true,
color: 'white',
formatter: function () {
if (this.point.properties && this.point.properties.labelrank.toString() < 5) {
return this.point.properties['iso-a2'];
}
},
format: null,
style: {
fontWeight: 'bold'
}
},
mapData: Highcharts.maps['custom/europe'],
tooltip: {
headerFormat: '',
pointFormat: '{point.name}: <b>{series.name}</b>'
}
}
},
series : [{
name: 'UTC',
data: $.map(['IE', 'IS', 'GB', 'PT'], function (code) {
return { code: code };
})
}, {
name: 'UTC + 1',
data: $.map(['NO', 'SE', 'DK', 'DE', 'NL', 'BE', 'LU', 'ES', 'FR', 'PL', 'CZ', 'AT', 'CH', 'LI', 'SK', 'HU',
'SI', 'IT', 'SM', 'HR', 'BA', 'YF', 'ME', 'AL', 'MK'], function (code) {
return { code: code };
})
}, {
name: 'UTC + 2',
data: $.map(['FI', 'EE', 'LV', 'LT', 'BY', 'UA', 'MD', 'RO', 'BG', 'GR', 'TR', 'CY'], function (code) {
return { code: code };
})
}, {
name: 'UTC + 3',
data: $.map(['RU'], function (code) {
return { code: code };
})
}]
});
});
+1
View File
@@ -0,0 +1 @@
jQuery(document).ready(function(){$.getJSON("http://www.highcharts.com/samples/data/jsonp.php?filename=world-population.json&callback=?",function(t){var a=Highcharts.geojson(Highcharts.maps["custom/world"]);$.each(t,function(){"UK"===this.code&&(this.code="GB")}),$("#highmaps_1").highcharts("Map",{chart:{style:{fontFamily:"Open Sans"}},title:{text:"World population 2013 by country"},subtitle:{text:"Demo of Highcharts map with bubbles"},legend:{enabled:!1},mapNavigation:{enabled:!0,buttonOptions:{verticalAlign:"bottom"}},series:[{name:"Countries",mapData:a,color:"#E0E0E0",enableMouseTracking:!1},{type:"mapbubble",mapData:a,name:"Population 2013",joinBy:["iso-a2","code"],data:t,minSize:4,maxSize:"12%",tooltip:{pointFormat:"{point.code}: {point.z} thousands"}}]})}),$("#highmaps_2").highcharts({data:{csv:document.getElementById("csv").innerHTML},chart:{type:"heatmap",inverted:!0,style:{fontFamily:"Open Sans"}},title:{text:"Highcharts heat map",align:"left"},subtitle:{text:"Temperature variation by day and hour through May 2015",align:"left"},xAxis:{tickPixelInterval:50,min:Date.UTC(2015,4,1),max:Date.UTC(2015,4,30)},yAxis:{title:{text:null},labels:{format:"{value}:00"},minPadding:0,maxPadding:0,startOnTick:!1,endOnTick:!1,tickPositions:[0,6,12,18,24],tickWidth:1,min:0,max:23},colorAxis:{stops:[[0,"#3060cf"],[.5,"#fffbbc"],[.9,"#c4463a"]],min:-5},series:[{borderWidth:0,colsize:864e5,tooltip:{headerFormat:"Temperature<br/>",pointFormat:"{point.x:%e %b, %Y} {point.y}:00: <b>{point.value} ℃</b>"}}]}),$("#highmaps_3").highcharts("Map",{chart:{spacingBottom:20,style:{fontFamily:"Open Sans"}},title:{text:"Europe time zones"},legend:{enabled:!0},plotOptions:{map:{allAreas:!1,joinBy:["iso-a2","code"],dataLabels:{enabled:!0,color:"white",formatter:function(){if(this.point.properties&&this.point.properties.labelrank.toString()<5)return this.point.properties["iso-a2"]},format:null,style:{fontWeight:"bold"}},mapData:Highcharts.maps["custom/europe"],tooltip:{headerFormat:"",pointFormat:"{point.name}: <b>{series.name}</b>"}}},series:[{name:"UTC",data:$.map(["IE","IS","GB","PT"],function(t){return{code:t}})},{name:"UTC + 1",data:$.map(["NO","SE","DK","DE","NL","BE","LU","ES","FR","PL","CZ","AT","CH","LI","SK","HU","SI","IT","SM","HR","BA","YF","ME","AL","MK"],function(t){return{code:t}})},{name:"UTC + 2",data:$.map(["FI","EE","LV","LT","BY","UA","MD","RO","BG","GR","TR","CY"],function(t){return{code:t}})},{name:"UTC + 3",data:$.map(["RU"],function(t){return{code:t}})}]})});
+286
View File
@@ -0,0 +1,286 @@
jQuery(document).ready(function() {
// HIGHSTOCK DEMOS
// COMPARE MULTIPLE SERIES
var seriesOptions = [],
seriesCounter = 0,
names = ['MSFT', 'AAPL', 'GOOG'],
// create the chart when all data is loaded
createChart = function () {
$('#highstock_1').highcharts('StockChart', {
chart : {
style: {
fontFamily: 'Open Sans'
}
},
rangeSelector: {
selected: 4
},
yAxis: {
labels: {
formatter: function () {
return (this.value > 0 ? ' + ' : '') + this.value + '%';
}
},
plotLines: [{
value: 0,
width: 2,
color: 'silver'
}]
},
plotOptions: {
series: {
compare: 'percent'
}
},
tooltip: {
pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.change}%)<br/>',
valueDecimals: 2
},
series: seriesOptions
});
};
$.each(names, function (i, name) {
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=' + name.toLowerCase() + '-c.json&callback=?', function (data) {
seriesOptions[i] = {
name: name,
data: data
};
// As we're loading the data asynchronously, we don't know what order it will arrive. So
// we keep a counter and create the chart when all the data is loaded.
seriesCounter += 1;
if (seriesCounter === names.length) {
createChart();
}
});
});
// CANDLESTICK CHART
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-ohlcv.json&callback=?', function (data) {
// split the data set into ohlc and volume
var ohlc = [],
volume = [],
dataLength = data.length,
// set the allowed units for data grouping
groupingUnits = [[
'week', // unit name
[1] // allowed multiples
], [
'month',
[1, 2, 3, 4, 6]
]],
i = 0;
for (i; i < dataLength; i += 1) {
ohlc.push([
data[i][0], // the date
data[i][1], // open
data[i][2], // high
data[i][3], // low
data[i][4] // close
]);
volume.push([
data[i][0], // the date
data[i][5] // the volume
]);
}
// create the chart
$('#highstock_2').highcharts('StockChart', {
chart : {
style: {
fontFamily: 'Open Sans'
}
},
rangeSelector: {
selected: 1
},
title: {
text: 'AAPL Historical'
},
yAxis: [{
labels: {
align: 'right',
x: -3
},
title: {
text: 'OHLC'
},
height: '60%',
lineWidth: 2
}, {
labels: {
align: 'right',
x: -3
},
title: {
text: 'Volume'
},
top: '65%',
height: '35%',
offset: 0,
lineWidth: 2
}],
series: [{
type: 'candlestick',
name: 'AAPL',
data: ohlc,
dataGrouping: {
units: groupingUnits
}
}, {
type: 'column',
name: 'Volume',
data: volume,
yAxis: 1,
dataGrouping: {
units: groupingUnits
}
}]
});
});
// OHLC CHART
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-ohlc.json&callback=?', function (data) {
// create the chart
$('#highstock_3').highcharts('StockChart', {
chart : {
style: {
fontFamily: 'Open Sans'
}
},
rangeSelector : {
selected : 2
},
title : {
text : 'AAPL Stock Price'
},
series : [{
type : 'ohlc',
name : 'AAPL Stock Price',
data : data,
dataGrouping : {
units : [[
'week', // unit name
[1] // allowed multiples
], [
'month',
[1, 2, 3, 4, 6]
]]
}
}]
});
});
// LINE CHART WITH FLAGS
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=usdeur.json&callback=?', function (data) {
var year = new Date(data[data.length - 1][0]).getFullYear(); // Get year of last data point
// Create the chart
$('#highstock_4').highcharts('StockChart', {
chart : {
style: {
fontFamily: 'Open Sans'
}
},
rangeSelector: {
selected: 1
},
title: {
text: 'USD to EUR exchange rate'
},
yAxis: {
title: {
text: 'Exchange rate'
}
},
series: [{
name: 'USD to EUR',
data: data,
id: 'dataseries',
tooltip: {
valueDecimals: 4
}
}, {
type: 'flags',
data: [{
x: Date.UTC(year, 1, 22),
title: 'A',
text: 'Shape: "squarepin"'
}, {
x: Date.UTC(year, 3, 28),
title: 'A',
text: 'Shape: "squarepin"'
}],
onSeries: 'dataseries',
shape: 'squarepin',
width: 16
}, {
type: 'flags',
data: [{
x: Date.UTC(year, 2, 1),
title: 'B',
text: 'Shape: "circlepin"'
}, {
x: Date.UTC(year, 3, 1),
title: 'B',
text: 'Shape: "circlepin"'
}],
shape: 'circlepin',
width: 16
}, {
type: 'flags',
data: [{
x: Date.UTC(year, 2, 10),
title: 'C',
text: 'Shape: "flag"'
}, {
x: Date.UTC(year, 3, 11),
title: 'C',
text: 'Shape: "flag"'
}],
color: Highcharts.getOptions().colors[0], // same as onSeries
fillColor: Highcharts.getOptions().colors[0],
onSeries: 'dataseries',
width: 16,
style: { // text style
color: 'white'
},
states: {
hover: {
fillColor: '#395C84' // darker
}
}
}]
});
});
});
+1
View File
@@ -0,0 +1 @@
jQuery(document).ready(function(){var t=[],e=0,a=["MSFT","AAPL","GOOG"],i=function(){$("#highstock_1").highcharts("StockChart",{chart:{style:{fontFamily:"Open Sans"}},rangeSelector:{selected:4},yAxis:{labels:{formatter:function(){return(this.value>0?" + ":"")+this.value+"%"}},plotLines:[{value:0,width:2,color:"silver"}]},plotOptions:{series:{compare:"percent"}},tooltip:{pointFormat:'<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.change}%)<br/>',valueDecimals:2},series:t})};$.each(a,function(s,l){$.getJSON("http://www.highcharts.com/samples/data/jsonp.php?filename="+l.toLowerCase()+"-c.json&callback=?",function(o){t[s]={name:l,data:o},e+=1,e===a.length&&i()})}),$.getJSON("http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-ohlcv.json&callback=?",function(t){var e=[],a=[],i=t.length,s=[["week",[1]],["month",[1,2,3,4,6]]],l=0;for(l;l<i;l+=1)e.push([t[l][0],t[l][1],t[l][2],t[l][3],t[l][4]]),a.push([t[l][0],t[l][5]]);$("#highstock_2").highcharts("StockChart",{chart:{style:{fontFamily:"Open Sans"}},rangeSelector:{selected:1},title:{text:"AAPL Historical"},yAxis:[{labels:{align:"right",x:-3},title:{text:"OHLC"},height:"60%",lineWidth:2},{labels:{align:"right",x:-3},title:{text:"Volume"},top:"65%",height:"35%",offset:0,lineWidth:2}],series:[{type:"candlestick",name:"AAPL",data:e,dataGrouping:{units:s}},{type:"column",name:"Volume",data:a,yAxis:1,dataGrouping:{units:s}}]})}),$.getJSON("http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-ohlc.json&callback=?",function(t){$("#highstock_3").highcharts("StockChart",{chart:{style:{fontFamily:"Open Sans"}},rangeSelector:{selected:2},title:{text:"AAPL Stock Price"},series:[{type:"ohlc",name:"AAPL Stock Price",data:t,dataGrouping:{units:[["week",[1]],["month",[1,2,3,4,6]]]}}]})}),$.getJSON("http://www.highcharts.com/samples/data/jsonp.php?filename=usdeur.json&callback=?",function(t){var e=new Date(t[t.length-1][0]).getFullYear();$("#highstock_4").highcharts("StockChart",{chart:{style:{fontFamily:"Open Sans"}},rangeSelector:{selected:1},title:{text:"USD to EUR exchange rate"},yAxis:{title:{text:"Exchange rate"}},series:[{name:"USD to EUR",data:t,id:"dataseries",tooltip:{valueDecimals:4}},{type:"flags",data:[{x:Date.UTC(e,1,22),title:"A",text:'Shape: "squarepin"'},{x:Date.UTC(e,3,28),title:"A",text:'Shape: "squarepin"'}],onSeries:"dataseries",shape:"squarepin",width:16},{type:"flags",data:[{x:Date.UTC(e,2,1),title:"B",text:'Shape: "circlepin"'},{x:Date.UTC(e,3,1),title:"B",text:'Shape: "circlepin"'}],shape:"circlepin",width:16},{type:"flags",data:[{x:Date.UTC(e,2,10),title:"C",text:'Shape: "flag"'},{x:Date.UTC(e,3,11),title:"C",text:'Shape: "flag"'}],color:Highcharts.getOptions().colors[0],fillColor:Highcharts.getOptions().colors[0],onSeries:"dataseries",width:16,style:{color:"white"},states:{hover:{fillColor:"#395C84"}}}]})})});
+74
View File
@@ -0,0 +1,74 @@
jQuery(document).ready(function() {
// MORRIS CHARTS DEMOS
// LINE CHART
new Morris.Line({
// ID of the element in which to draw the chart.
element: 'morris_chart_1',
// Chart data records -- each entry in this array corresponds to a point on
// the chart.
data: [
{ y: '2006', a: 100, b: 90 },
{ y: '2007', a: 75, b: 65 },
{ y: '2008', a: 50, b: 40 },
{ y: '2009', a: 75, b: 65 },
{ y: '2010', a: 50, b: 40 },
{ y: '2011', a: 75, b: 65 },
{ y: '2012', a: 100, b: 90 }
],
// The name of the data record attribute that contains x-values.
xkey: 'y',
// A list of names of data record attributes that contain y-values.
ykeys: ['a', 'b'],
// Labels for the ykeys -- will be displayed when you hover over the
// chart.
labels: ['Values A', 'Values B']
});
// AREA CHART
new Morris.Area({
element: 'morris_chart_2',
data: [
{ y: '2006', a: 100, b: 90 },
{ y: '2007', a: 75, b: 65 },
{ y: '2008', a: 50, b: 40 },
{ y: '2009', a: 75, b: 65 },
{ y: '2010', a: 50, b: 40 },
{ y: '2011', a: 75, b: 65 },
{ y: '2012', a: 100, b: 90 }
],
xkey: 'y',
ykeys: ['a', 'b'],
labels: ['Series A', 'Series B']
});
// BAR CHART
new Morris.Bar({
element: 'morris_chart_3',
data: [
{ y: '2006', a: 100, b: 90 },
{ y: '2007', a: 75, b: 65 },
{ y: '2008', a: 50, b: 40 },
{ y: '2009', a: 75, b: 65 },
{ y: '2010', a: 50, b: 40 },
{ y: '2011', a: 75, b: 65 },
{ y: '2012', a: 100, b: 90 }
],
xkey: 'y',
ykeys: ['a', 'b'],
labels: ['Series A', 'Series B']
});
// PIE CHART
new Morris.Donut({
element: 'morris_chart_4',
data: [
{label: "Download Sales", value: 12},
{label: "In-Store Sales", value: 30},
{label: "Mail-Order Sales", value: 20}
]
});
});
+1
View File
@@ -0,0 +1 @@
jQuery(document).ready(function(){new Morris.Line({element:"morris_chart_1",data:[{y:"2006",a:100,b:90},{y:"2007",a:75,b:65},{y:"2008",a:50,b:40},{y:"2009",a:75,b:65},{y:"2010",a:50,b:40},{y:"2011",a:75,b:65},{y:"2012",a:100,b:90}],xkey:"y",ykeys:["a","b"],labels:["Values A","Values B"]}),new Morris.Area({element:"morris_chart_2",data:[{y:"2006",a:100,b:90},{y:"2007",a:75,b:65},{y:"2008",a:50,b:40},{y:"2009",a:75,b:65},{y:"2010",a:50,b:40},{y:"2011",a:75,b:65},{y:"2012",a:100,b:90}],xkey:"y",ykeys:["a","b"],labels:["Series A","Series B"]}),new Morris.Bar({element:"morris_chart_3",data:[{y:"2006",a:100,b:90},{y:"2007",a:75,b:65},{y:"2008",a:50,b:40},{y:"2009",a:75,b:65},{y:"2010",a:50,b:40},{y:"2011",a:75,b:65},{y:"2012",a:100,b:90}],xkey:"y",ykeys:["a","b"],labels:["Series A","Series B"]}),new Morris.Donut({element:"morris_chart_4",data:[{label:"Download Sales",value:12},{label:"In-Store Sales",value:30},{label:"Mail-Order Sales",value:20}]})});
+28
View File
@@ -0,0 +1,28 @@
var ComingSoon = function () {
return {
//main function to initiate the module
init: function () {
var austDay = new Date();
austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 26);
$('#defaultCountdown').countdown({until: austDay});
$('#year').text(austDay.getFullYear());
$.backstretch([
"../assets/pages/media/bg/1.jpg",
"../assets/pages/media/bg/2.jpg",
"../assets/pages/media/bg/3.jpg",
"../assets/pages/media/bg/4.jpg"
], {
fade: 1000,
duration: 10000
});
}
};
}();
jQuery(document).ready(function() {
ComingSoon.init();
});
+1
View File
@@ -0,0 +1 @@
var ComingSoon=function(){return{init:function(){var e=new Date;e=new Date(e.getFullYear()+1,0,26),$("#defaultCountdown").countdown({until:e}),$("#year").text(e.getFullYear()),$.backstretch(["../assets/pages/media/bg/1.jpg","../assets/pages/media/bg/2.jpg","../assets/pages/media/bg/3.jpg","../assets/pages/media/bg/4.jpg"],{fade:1e3,duration:1e4})}}}();jQuery(document).ready(function(){ComingSoon.init()});
@@ -0,0 +1,46 @@
var ComponentsBootstrapMaxlength = function () {
var handleBootstrapMaxlength = function() {
$('#maxlength_defaultconfig').maxlength({
limitReachedClass: "label label-danger",
})
$('#maxlength_thresholdconfig').maxlength({
limitReachedClass: "label label-danger",
threshold: 20
});
$('#maxlength_alloptions').maxlength({
alwaysShow: true,
warningClass: "label label-success",
limitReachedClass: "label label-danger",
separator: ' out of ',
preText: 'You typed ',
postText: ' chars available.',
validate: true
});
$('#maxlength_textarea').maxlength({
limitReachedClass: "label label-danger",
alwaysShow: true
});
$('#maxlength_placement').maxlength({
limitReachedClass: "label label-danger",
alwaysShow: true,
placement: App.isRTL() ? 'top-right' : 'top-left'
});
}
return {
//main function to initiate the module
init: function () {
handleBootstrapMaxlength();
}
};
}();
jQuery(document).ready(function() {
ComponentsBootstrapMaxlength.init();
});
@@ -0,0 +1 @@
var ComponentsBootstrapMaxlength=function(){var a=function(){$("#maxlength_defaultconfig").maxlength({limitReachedClass:"label label-danger"}),$("#maxlength_thresholdconfig").maxlength({limitReachedClass:"label label-danger",threshold:20}),$("#maxlength_alloptions").maxlength({alwaysShow:!0,warningClass:"label label-success",limitReachedClass:"label label-danger",separator:" out of ",preText:"You typed ",postText:" chars available.",validate:!0}),$("#maxlength_textarea").maxlength({limitReachedClass:"label label-danger",alwaysShow:!0}),$("#maxlength_placement").maxlength({limitReachedClass:"label label-danger",alwaysShow:!0,placement:App.isRTL()?"top-right":"top-left"})};return{init:function(){a()}}}();jQuery(document).ready(function(){ComponentsBootstrapMaxlength.init()});
@@ -0,0 +1,71 @@
var ComponentsBootstrapMultiselect = function () {
return {
//main function to initiate the module
init: function () {
$('.mt-multiselect').each(function(){
var btn_class = $(this).attr('class');
var clickable_groups = ($(this).data('clickable-groups')) ? $(this).data('clickable-groups') : false ;
var collapse_groups = ($(this).data('collapse-groups')) ? $(this).data('collapse-groups') : false ;
var drop_right = ($(this).data('drop-right')) ? $(this).data('drop-right') : false ;
var drop_up = ($(this).data('drop-up')) ? $(this).data('drop-up') : false ;
var select_all = ($(this).data('select-all')) ? $(this).data('select-all') : false ;
var width = ($(this).data('width')) ? $(this).data('width') : '' ;
var height = ($(this).data('height')) ? $(this).data('height') : '' ;
var filter = ($(this).data('filter')) ? $(this).data('filter') : false ;
// advanced functions
var onchange_function = function(option, checked, select) {
alert('Changed option ' + $(option).val() + '.');
}
var dropdownshow_function = function(event) {
alert('Dropdown shown.');
}
var dropdownhide_function = function(event) {
alert('Dropdown Hidden.');
}
// init advanced functions
var onchange = ($(this).data('action-onchange') == true) ? onchange_function : '';
var dropdownshow = ($(this).data('action-dropdownshow') == true) ? dropdownshow_function : '';
var dropdownhide = ($(this).data('action-dropdownhide') == true) ? dropdownhide_function : '';
// template functions
// init variables
var li_template;
if ($(this).attr('multiple')){
li_template = '<li class="mt-checkbox-list"><a href="javascript:void(0);"><label class="mt-checkbox"> <span></span></label></a></li>';
} else {
li_template = '<li><a href="javascript:void(0);"><label></label></a></li>';
}
// init multiselect
$(this).multiselect({
enableClickableOptGroups: clickable_groups,
enableCollapsibleOptGroups: collapse_groups,
disableIfEmpty: true,
enableFiltering: filter,
includeSelectAllOption: select_all,
dropRight: drop_right,
buttonWidth: width,
maxHeight: height,
onChange: onchange,
onDropdownShow: dropdownshow,
onDropdownHide: dropdownhide,
buttonClass: btn_class,
//optionClass: function(element) { return "mt-checkbox"; },
//optionLabel: function(element) { console.log(element); return $(element).html() + '<span></span>'; },
/*templates: {
li: li_template,
}*/
});
});
}
};
}();
jQuery(document).ready(function() {
ComponentsBootstrapMultiselect.init();
});
@@ -0,0 +1 @@
var ComponentsBootstrapMultiselect=function(){return{init:function(){$(".mt-multiselect").each(function(){var t,a=$(this).attr("class"),i=!!$(this).data("clickable-groups")&&$(this).data("clickable-groups"),l=!!$(this).data("collapse-groups")&&$(this).data("collapse-groups"),o=!!$(this).data("drop-right")&&$(this).data("drop-right"),e=(!!$(this).data("drop-up")&&$(this).data("drop-up"),!!$(this).data("select-all")&&$(this).data("select-all")),s=$(this).data("width")?$(this).data("width"):"",n=$(this).data("height")?$(this).data("height"):"",d=!!$(this).data("filter")&&$(this).data("filter"),h=function(t,a,i){alert("Changed option "+$(t).val()+".")},r=function(t){alert("Dropdown shown.")},c=function(t){alert("Dropdown Hidden.")},p=1==$(this).data("action-onchange")?h:"",u=1==$(this).data("action-dropdownshow")?r:"",b=1==$(this).data("action-dropdownhide")?c:"";t=$(this).attr("multiple")?'<li class="mt-checkbox-list"><a href="javascript:void(0);"><label class="mt-checkbox"> <span></span></label></a></li>':'<li><a href="javascript:void(0);"><label></label></a></li>',$(this).multiselect({enableClickableOptGroups:i,enableCollapsibleOptGroups:l,disableIfEmpty:!0,enableFiltering:d,includeSelectAllOption:e,dropRight:o,buttonWidth:s,maxHeight:n,onChange:p,onDropdownShow:u,onDropdownHide:b,buttonClass:a})})}}}();jQuery(document).ready(function(){ComponentsBootstrapMultiselect.init()});
@@ -0,0 +1,26 @@
var ComponentsBootstrapSelectSplitter = function() {
var selectSplitter = function() {
$('#select_selectsplitter1').selectsplitter({
selectSize: 4
});
$('#select_selectsplitter2').selectsplitter({
selectSize: 6
});
$('#select_selectsplitter3').selectsplitter({
selectSize: 5
});
}
return {
//main function to initiate the module
init: function() {
selectSplitter();
}
};
}();
jQuery(document).ready(function() {
ComponentsBootstrapSelectSplitter.init();
});
@@ -0,0 +1 @@
var ComponentsBootstrapSelectSplitter=function(){var e=function(){$("#select_selectsplitter1").selectsplitter({selectSize:4}),$("#select_selectsplitter2").selectsplitter({selectSize:6}),$("#select_selectsplitter3").selectsplitter({selectSize:5})};return{init:function(){e()}}}();jQuery(document).ready(function(){ComponentsBootstrapSelectSplitter.init()});
@@ -0,0 +1,23 @@
var ComponentsBootstrapSelect = function () {
var handleBootstrapSelect = function() {
$('.bs-select').selectpicker({
iconBase: 'fa',
tickIcon: 'fa-check'
});
}
return {
//main function to initiate the module
init: function () {
handleBootstrapSelect();
}
};
}();
if (App.isAngularJsApp() === false) {
jQuery(document).ready(function() {
ComponentsBootstrapSelect.init();
});
}
@@ -0,0 +1 @@
var ComponentsBootstrapSelect=function(){var n=function(){$(".bs-select").selectpicker({iconBase:"fa",tickIcon:"fa-check"})};return{init:function(){n()}}}();App.isAngularJsApp()===!1&&jQuery(document).ready(function(){ComponentsBootstrapSelect.init()});
@@ -0,0 +1,32 @@
var ComponentsBootstrapSwitch = function () {
var handleBootstrapSwitch = function() {
$('.switch-radio1').on('switch-change', function () {
$('.switch-radio1').bootstrapSwitch('toggleRadioState');
});
// or
$('.switch-radio1').on('switch-change', function () {
$('.switch-radio1').bootstrapSwitch('toggleRadioStateAllowUncheck');
});
// or
$('.switch-radio1').on('switch-change', function () {
$('.switch-radio1').bootstrapSwitch('toggleRadioStateAllowUncheck', false);
});
}
return {
//main function to initiate the module
init: function () {
handleBootstrapSwitch();
}
};
}();
jQuery(document).ready(function() {
ComponentsBootstrapSwitch.init();
});
@@ -0,0 +1 @@
var ComponentsBootstrapSwitch=function(){var t=function(){$(".switch-radio1").on("switch-change",function(){$(".switch-radio1").bootstrapSwitch("toggleRadioState")}),$(".switch-radio1").on("switch-change",function(){$(".switch-radio1").bootstrapSwitch("toggleRadioStateAllowUncheck")}),$(".switch-radio1").on("switch-change",function(){$(".switch-radio1").bootstrapSwitch("toggleRadioStateAllowUncheck",!1)})};return{init:function(){t()}}}();jQuery(document).ready(function(){ComponentsBootstrapSwitch.init()});
@@ -0,0 +1,123 @@
var ComponentsBootstrapTagsinput = function() {
var handleDemo1 = function() {
var elt = $('#object_tagsinput');
elt.tagsinput({
itemValue: 'value',
itemText: 'text',
});
$('#object_tagsinput_add').on('click', function(){
elt.tagsinput('add', {
"value": $('#object_tagsinput_value').val(),
"text": $('#object_tagsinput_city').val(),
"continent": $('#object_tagsinput_continent').val()
});
});
elt.tagsinput('add', { "value": 1 , "text": "Amsterdam" , "continent": "Europe" });
elt.tagsinput('add', { "value": 4 , "text": "Washington" , "continent": "America" });
elt.tagsinput('add', { "value": 7 , "text": "Sydney" , "continent": "Australia" });
elt.tagsinput('add', { "value": 10, "text": "Beijing" , "continent": "Asia" });
elt.tagsinput('add', { "value": 13, "text": "Cairo" , "continent": "Africa" });
}
var handleDemo2 = function() {
var elt = $('#state_tagsinput');
elt.tagsinput({
tagClass: function(item) {
switch (item.continent) {
case 'Europe':
return 'label label-primary';
case 'America':
return 'label label-danger label-important';
case 'Australia':
return 'label label-success';
case 'Africa':
return 'label label-default';
case 'Asia':
return 'label label-warning';
}
},
itemValue: 'value',
itemText: 'text'
});
$('#state_tagsinput_add').on('click', function(){
elt.tagsinput('add', {
"value": $('#state_tagsinput_value').val(),
"text": $('#state_tagsinput_city').val(),
"continent": $('#state_tagsinput_continent').val()
});
});
elt.tagsinput('add', {
"value": 1,
"text": "Amsterdam",
"continent": "Europe"
});
elt.tagsinput('add', {
"value": 4,
"text": "Washington",
"continent": "America"
});
elt.tagsinput('add', {
"value": 7,
"text": "Sydney",
"continent": "Australia"
});
elt.tagsinput('add', {
"value": 10,
"text": "Beijing",
"continent": "Asia"
});
elt.tagsinput('add', {
"value": 13,
"text": "Cairo",
"continent": "Africa"
});
}
var handleDemo3 = function() {
var citynames = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: {
url: '../demo/typeahead_cities.json',
filter: function(list) {
return $.map(list, function(cityname) {
return { name: cityname };
});
}
}
});
citynames.initialize();
$('#typeahead_demo').tagsinput({
typeaheadjs: {
name: 'citynames',
displayKey: 'name',
valueKey: 'name',
source: citynames.ttAdapter()
}
});
}
return {
//main function to initiate the module
init: function() {
handleDemo1();
handleDemo2();
handleDemo3();
}
};
}();
jQuery(document).ready(function() {
ComponentsBootstrapTagsinput.init();
});
@@ -0,0 +1 @@
var ComponentsBootstrapTagsinput=function(){var t=function(){var t=$("#object_tagsinput");t.tagsinput({itemValue:"value",itemText:"text"}),$("#object_tagsinput_add").on("click",function(){t.tagsinput("add",{value:$("#object_tagsinput_value").val(),text:$("#object_tagsinput_city").val(),continent:$("#object_tagsinput_continent").val()})}),t.tagsinput("add",{value:1,text:"Amsterdam",continent:"Europe"}),t.tagsinput("add",{value:4,text:"Washington",continent:"America"}),t.tagsinput("add",{value:7,text:"Sydney",continent:"Australia"}),t.tagsinput("add",{value:10,text:"Beijing",continent:"Asia"}),t.tagsinput("add",{value:13,text:"Cairo",continent:"Africa"})},e=function(){var t=$("#state_tagsinput");t.tagsinput({tagClass:function(t){switch(t.continent){case"Europe":return"label label-primary";case"America":return"label label-danger label-important";case"Australia":return"label label-success";case"Africa":return"label label-default";case"Asia":return"label label-warning"}},itemValue:"value",itemText:"text"}),$("#state_tagsinput_add").on("click",function(){t.tagsinput("add",{value:$("#state_tagsinput_value").val(),text:$("#state_tagsinput_city").val(),continent:$("#state_tagsinput_continent").val()})}),t.tagsinput("add",{value:1,text:"Amsterdam",continent:"Europe"}),t.tagsinput("add",{value:4,text:"Washington",continent:"America"}),t.tagsinput("add",{value:7,text:"Sydney",continent:"Australia"}),t.tagsinput("add",{value:10,text:"Beijing",continent:"Asia"}),t.tagsinput("add",{value:13,text:"Cairo",continent:"Africa"})},a=function(){var t=new Bloodhound({datumTokenizer:Bloodhound.tokenizers.obj.whitespace("name"),queryTokenizer:Bloodhound.tokenizers.whitespace,prefetch:{url:"../demo/typeahead_cities.json",filter:function(t){return $.map(t,function(t){return{name:t}})}}});t.initialize(),$("#typeahead_demo").tagsinput({typeaheadjs:{name:"citynames",displayKey:"name",valueKey:"name",source:t.ttAdapter()}})};return{init:function(){t(),e(),a()}}}();jQuery(document).ready(function(){ComponentsBootstrapTagsinput.init()});
@@ -0,0 +1,76 @@
var ComponentsBootstrapTouchSpin = function() {
var handleDemo = function() {
$("#touchspin_1").TouchSpin({
min: 0,
max: 100,
step: 0.1,
decimals: 2,
boostat: 5,
maxboostedstep: 10,
postfix: '%'
});
$("#touchspin_2").TouchSpin({
min: -1000000000,
max: 1000000000,
stepinterval: 50,
maxboostedstep: 10000000,
prefix: '$'
});
$("#touchspin_3").TouchSpin({
verticalbuttons: true
});
$("#touchspin_4").TouchSpin({
verticalbuttons: true,
verticalupclass: 'glyphicon glyphicon-plus',
verticaldownclass: 'glyphicon glyphicon-minus'
});
$("#touchspin_5").TouchSpin();
$("#touchspin_6").TouchSpin({
initval: 40
});
$("#touchspin_7").TouchSpin({
initval: 40
});
$("#touchspin_8").TouchSpin({
postfix: "a button",
postfix_extraclass: "btn red"
});
$("#touchspin_9").TouchSpin({
postfix: "a button",
postfix_extraclass: "btn green"
});
$("#touchspin_10").TouchSpin({
prefix: "pre",
postfix: "post"
});
$("#touchspin_11").TouchSpin({
buttondown_class: "btn blue",
buttonup_class: "btn red"
});
}
return {
//main function to initiate the module
init: function() {
handleDemo();
}
};
}();
jQuery(document).ready(function() {
ComponentsBootstrapTouchSpin.init();
});
@@ -0,0 +1 @@
var ComponentsBootstrapTouchSpin=function(){var t=function(){$("#touchspin_1").TouchSpin({min:0,max:100,step:.1,decimals:2,boostat:5,maxboostedstep:10,postfix:"%"}),$("#touchspin_2").TouchSpin({min:-1e9,max:1e9,stepinterval:50,maxboostedstep:1e7,prefix:"$"}),$("#touchspin_3").TouchSpin({verticalbuttons:!0}),$("#touchspin_4").TouchSpin({verticalbuttons:!0,verticalupclass:"glyphicon glyphicon-plus",verticaldownclass:"glyphicon glyphicon-minus"}),$("#touchspin_5").TouchSpin(),$("#touchspin_6").TouchSpin({initval:40}),$("#touchspin_7").TouchSpin({initval:40}),$("#touchspin_8").TouchSpin({postfix:"a button",postfix_extraclass:"btn red"}),$("#touchspin_9").TouchSpin({postfix:"a button",postfix_extraclass:"btn green"}),$("#touchspin_10").TouchSpin({prefix:"pre",postfix:"post"}),$("#touchspin_11").TouchSpin({buttondown_class:"btn blue",buttonup_class:"btn red"})};return{init:function(){t()}}}();jQuery(document).ready(function(){ComponentsBootstrapTouchSpin.init()});
@@ -0,0 +1,37 @@
// ClipboardJS
var ComponentsClipboard = function() {
return {
//main function to initiate the module
init: function() {
var paste_text;
$('.mt-clipboard').each(function(){
var clipboard = new Clipboard(this);
clipboard.on('success', function(e) {
paste_text = e.text;
console.log(paste_text);
});
});
$('.mt-clipboard').click(function(){
if($(this).data('clipboard-paste') == true){
if(paste_text){
var paste_target = $(this).data('paste-target');
$(paste_target).val(paste_text);
$(paste_target).html(paste_text);
} else {
alert('No text was copied or cut.');
}
}
});
}
}
}();
jQuery(document).ready(function() {
ComponentsClipboard.init();
});
+1
View File
@@ -0,0 +1 @@
var ComponentsClipboard=function(){return{init:function(){var t;$(".mt-clipboard").each(function(){var o=new Clipboard(this);o.on("success",function(o){t=o.text,console.log(t)})}),$(".mt-clipboard").click(function(){if(1==$(this).data("clipboard-paste"))if(t){var o=$(this).data("paste-target");$(o).val(t),$(o).html(t)}else alert("No text was copied or cut.")})}}}();jQuery(document).ready(function(){ComponentsClipboard.init()});
@@ -0,0 +1,64 @@
var ComponentsCodeEditors = function () {
var handleDemo1 = function () {
var myTextArea = document.getElementById('code_editor_demo_1');
var myCodeMirror = CodeMirror.fromTextArea(myTextArea, {
lineNumbers: true,
matchBrackets: true,
styleActiveLine: true,
theme:"ambiance",
mode: 'javascript'
});
}
var handleDemo2 = function () {
var myTextArea = document.getElementById('code_editor_demo_2');
var myCodeMirror = CodeMirror.fromTextArea(myTextArea, {
lineNumbers: true,
matchBrackets: true,
styleActiveLine: true,
theme:"material",
mode: 'css'
});
}
var handleDemo3 = function () {
var myTextArea = document.getElementById('code_editor_demo_3');
var myCodeMirror = CodeMirror.fromTextArea(myTextArea, {
lineNumbers: true,
matchBrackets: true,
styleActiveLine: true,
theme:"neat",
mode: 'javascript',
readOnly: true
});
}
var handleDemo4 = function () {
var myTextArea = document.getElementById('code_editor_demo_4');
var myCodeMirror = CodeMirror.fromTextArea(myTextArea, {
lineNumbers: true,
matchBrackets: true,
styleActiveLine: true,
theme:"neo",
mode: 'css',
readOnly: true
});
}
return {
//main function to initiate the module
init: function () {
handleDemo1();
handleDemo2();
handleDemo3();
handleDemo4();
}
};
}();
jQuery(document).ready(function() {
ComponentsCodeEditors.init();
});
+1
View File
@@ -0,0 +1 @@
var ComponentsCodeEditors=function(){var e=function(){var e=document.getElementById("code_editor_demo_1");CodeMirror.fromTextArea(e,{lineNumbers:!0,matchBrackets:!0,styleActiveLine:!0,theme:"ambiance",mode:"javascript"})},t=function(){var e=document.getElementById("code_editor_demo_2");CodeMirror.fromTextArea(e,{lineNumbers:!0,matchBrackets:!0,styleActiveLine:!0,theme:"material",mode:"css"})},o=function(){var e=document.getElementById("code_editor_demo_3");CodeMirror.fromTextArea(e,{lineNumbers:!0,matchBrackets:!0,styleActiveLine:!0,theme:"neat",mode:"javascript",readOnly:!0})},r=function(){var e=document.getElementById("code_editor_demo_4");CodeMirror.fromTextArea(e,{lineNumbers:!0,matchBrackets:!0,styleActiveLine:!0,theme:"neo",mode:"css",readOnly:!0})};return{init:function(){e(),t(),o(),r()}}}();jQuery(document).ready(function(){ComponentsCodeEditors.init()});
@@ -0,0 +1,56 @@
var ComponentsColorPickers = function() {
var handleColorPicker = function () {
if (!jQuery().colorpicker) {
return;
}
$('.colorpicker-default').colorpicker({
format: 'hex'
});
$('.colorpicker-rgba').colorpicker();
}
var handleMiniColors = function() {
$('.demo').each(function() {
//
// Dear reader, it's actually very easy to initialize MiniColors. For example:
//
// $(selector).minicolors();
//
// The way I've done it below is just for the demo, so don't get confused
// by it. Also, data- attributes aren't supported at this time...they're
// only used for this demo.
//
$(this).minicolors({
control: $(this).attr('data-control') || 'hue',
defaultValue: $(this).attr('data-defaultValue') || '',
inline: $(this).attr('data-inline') === 'true',
letterCase: $(this).attr('data-letterCase') || 'lowercase',
opacity: $(this).attr('data-opacity'),
position: $(this).attr('data-position') || 'bottom left',
change: function(hex, opacity) {
if (!hex) return;
if (opacity) hex += ', ' + opacity;
if (typeof console === 'object') {
console.log(hex);
}
},
theme: 'bootstrap'
});
});
}
return {
//main function to initiate the module
init: function() {
handleMiniColors();
handleColorPicker();
}
};
}();
jQuery(document).ready(function() {
ComponentsColorPickers.init();
});
+1
View File
@@ -0,0 +1 @@
var ComponentsColorPickers=function(){var t=function(){jQuery().colorpicker&&($(".colorpicker-default").colorpicker({format:"hex"}),$(".colorpicker-rgba").colorpicker())},o=function(){$(".demo").each(function(){$(this).minicolors({control:$(this).attr("data-control")||"hue",defaultValue:$(this).attr("data-defaultValue")||"",inline:"true"===$(this).attr("data-inline"),letterCase:$(this).attr("data-letterCase")||"lowercase",opacity:$(this).attr("data-opacity"),position:$(this).attr("data-position")||"bottom left",change:function(t,o){t&&(o&&(t+=", "+o),"object"==typeof console&&console.log(t))},theme:"bootstrap"})})};return{init:function(){o(),t()}}}();jQuery(document).ready(function(){ComponentsColorPickers.init()});
@@ -0,0 +1,65 @@
var ComponentsContextMenu = function () {
var demo2 = function() {
$('#main').contextmenu({
target: '#context-menu2',
before: function (e) {
// This function is optional.
// Here we use it to stop the event if the user clicks a span
e.preventDefault();
if (e.target.tagName == 'SPAN') {
e.preventDefault();
this.closemenu();
return false;
}
//this.getMenu().find("li").eq(2).find('a').html("Dynamically changed!");
return true;
}
});
}
var demo3 = function() {
// Demo 3
$('#context2').contextmenu({
target: '#context-menu2',
onItem: function (context, e) {
if ($(e.target).data('url')) {
this.closemenu();
} else {
alert($(e.target).text());
}
}
});
$('#context-menu2').on('show.bs.context', function (e) {
console.log('before show event');
});
$('#context-menu2').on('shown.bs.context', function (e) {
console.log('after show event');
});
$('#context-menu2').on('hide.bs.context', function (e) {
console.log('before hide event');
});
$('#context-menu2').on('hidden.bs.context', function (e) {
console.log('after hide event');
});
}
return {
//main function to initiate the module
init: function () {
demo2();
demo3();
}
};
}();
jQuery(document).ready(function() {
ComponentsContextMenu.init();
});
+1
View File
@@ -0,0 +1 @@
var ComponentsContextMenu=function(){var n=function(){$("#main").contextmenu({target:"#context-menu2",before:function(n){return n.preventDefault(),"SPAN"!=n.target.tagName||(n.preventDefault(),this.closemenu(),!1)}})},t=function(){$("#context2").contextmenu({target:"#context-menu2",onItem:function(n,t){$(t.target).data("url")?this.closemenu():alert($(t.target).text())}}),$("#context-menu2").on("show.bs.context",function(n){console.log("before show event")}),$("#context-menu2").on("shown.bs.context",function(n){console.log("after show event")}),$("#context-menu2").on("hide.bs.context",function(n){console.log("before hide event")}),$("#context-menu2").on("hidden.bs.context",function(n){console.log("after hide event")})};return{init:function(){n(),t()}}}();jQuery(document).ready(function(){ComponentsContextMenu.init()});
@@ -0,0 +1,249 @@
var ComponentsDateTimePickers = function () {
var handleDatePickers = function () {
if (jQuery().datepicker) {
$('.date-picker').datepicker({
rtl: App.isRTL(),
orientation: "left",
autoclose: true
});
//$('body').removeClass("modal-open"); // fix bug when inline picker is used in modal
}
/* Workaround to restrict daterange past date select: http://stackoverflow.com/questions/11933173/how-to-restrict-the-selectable-date-ranges-in-bootstrap-datepicker */
// Workaround to fix datepicker position on window scroll
$( document ).scroll(function(){
$('#form_modal2 .date-picker').datepicker('place'); //#modal is the id of the modal
});
}
var handleTimePickers = function () {
if (jQuery().timepicker) {
$('.timepicker-default').timepicker({
autoclose: true,
showSeconds: true,
minuteStep: 1
});
$('.timepicker-no-seconds').timepicker({
autoclose: true,
minuteStep: 5,
defaultTime: false
});
$('.timepicker-24').timepicker({
autoclose: true,
minuteStep: 5,
showSeconds: false,
showMeridian: false
});
// handle input group button click
$('.timepicker').parent('.input-group').on('click', '.input-group-btn', function(e){
e.preventDefault();
$(this).parent('.input-group').find('.timepicker').timepicker('showWidget');
});
// Workaround to fix timepicker position on window scroll
$( document ).scroll(function(){
$('#form_modal4 .timepicker-default, #form_modal4 .timepicker-no-seconds, #form_modal4 .timepicker-24').timepicker('place'); //#modal is the id of the modal
});
}
}
var handleDateRangePickers = function () {
if (!jQuery().daterangepicker) {
return;
}
$('#defaultrange').daterangepicker({
opens: (App.isRTL() ? 'left' : 'right'),
format: 'MM/DD/YYYY',
separator: ' to ',
startDate: moment().subtract('days', 29),
endDate: moment(),
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract('days', 1), moment().subtract('days', 1)],
'Last 7 Days': [moment().subtract('days', 6), moment()],
'Last 30 Days': [moment().subtract('days', 29), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
},
minDate: '01/01/2012',
maxDate: '12/31/2018',
},
function (start, end) {
$('#defaultrange input').val(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
}
);
$('#defaultrange_modal').daterangepicker({
opens: (App.isRTL() ? 'left' : 'right'),
format: 'MM/DD/YYYY',
separator: ' to ',
startDate: moment().subtract('days', 29),
endDate: moment(),
minDate: '01/01/2012',
maxDate: '12/31/2018',
},
function (start, end) {
$('#defaultrange_modal input').val(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
}
);
// this is very important fix when daterangepicker is used in modal. in modal when daterange picker is opened and mouse clicked anywhere bootstrap modal removes the modal-open class from the body element.
// so the below code will fix this issue.
$('#defaultrange_modal').on('click', function(){
if ($('#daterangepicker_modal').is(":visible") && $('body').hasClass("modal-open") == false) {
$('body').addClass("modal-open");
}
});
$('#reportrange').daterangepicker({
opens: (App.isRTL() ? 'left' : 'right'),
startDate: moment().subtract('days', 29),
endDate: moment(),
//minDate: '01/01/2012',
//maxDate: '12/31/2014',
dateLimit: {
days: 60
},
showDropdowns: true,
showWeekNumbers: true,
timePicker: false,
timePickerIncrement: 1,
timePicker12Hour: true,
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract('days', 1), moment().subtract('days', 1)],
'Last 7 Days': [moment().subtract('days', 6), moment()],
'Last 30 Days': [moment().subtract('days', 29), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
},
buttonClasses: ['btn'],
applyClass: 'green',
cancelClass: 'default',
format: 'MM/DD/YYYY',
separator: ' to ',
locale: {
applyLabel: 'Apply',
fromLabel: 'From',
toLabel: 'To',
customRangeLabel: 'Custom Range',
daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
firstDay: 1
}
},
function (start, end) {
$('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
}
);
//Set the initial state of the picker label
$('#reportrange span').html(moment().subtract('days', 29).format('MMMM D, YYYY') + ' - ' + moment().format('MMMM D, YYYY'));
}
var handleDatetimePicker = function () {
if (!jQuery().datetimepicker) {
return;
}
$(".form_datetime").datetimepicker({
autoclose: true,
isRTL: App.isRTL(),
format: "dd MM yyyy - hh:ii",
fontAwesome: true,
pickerPosition: (App.isRTL() ? "bottom-right" : "bottom-left")
});
$(".form_advance_datetime").datetimepicker({
isRTL: App.isRTL(),
format: "dd MM yyyy - hh:ii",
autoclose: true,
todayBtn: true,
fontAwesome: true,
startDate: "2013-02-14 10:00",
pickerPosition: (App.isRTL() ? "bottom-right" : "bottom-left"),
minuteStep: 10
});
$(".form_meridian_datetime").datetimepicker({
isRTL: App.isRTL(),
format: "dd MM yyyy - HH:ii P",
showMeridian: true,
autoclose: true,
fontAwesome: true,
pickerPosition: (App.isRTL() ? "bottom-right" : "bottom-left"),
todayBtn: true
});
$('body').removeClass("modal-open"); // fix bug when inline picker is used in modal
// Workaround to fix datetimepicker position on window scroll
$( document ).scroll(function(){
$('#form_modal1 .form_datetime, #form_modal1 .form_advance_datetime, #form_modal1 .form_meridian_datetime').datetimepicker('place'); //#modal is the id of the modal
});
}
var handleClockfaceTimePickers = function () {
if (!jQuery().clockface) {
return;
}
$('.clockface_1').clockface();
$('#clockface_2').clockface({
format: 'HH:mm',
trigger: 'manual'
});
$('#clockface_2_toggle').click(function (e) {
e.stopPropagation();
$('#clockface_2').clockface('toggle');
});
$('#clockface_2_modal').clockface({
format: 'HH:mm',
trigger: 'manual'
});
$('#clockface_2_modal_toggle').click(function (e) {
e.stopPropagation();
$('#clockface_2_modal').clockface('toggle');
});
$('.clockface_3').clockface({
format: 'H:mm'
}).clockface('show', '14:30');
// Workaround to fix clockface position on window scroll
$( document ).scroll(function(){
$('#form_modal5 .clockface_1, #form_modal5 #clockface_2_modal').clockface('place'); //#modal is the id of the modal
});
}
return {
//main function to initiate the module
init: function () {
handleDatePickers();
handleTimePickers();
handleDatetimePicker();
handleDateRangePickers();
handleClockfaceTimePickers();
}
};
}();
if (App.isAngularJsApp() === false) {
jQuery(document).ready(function() {
ComponentsDateTimePickers.init();
});
}
@@ -0,0 +1 @@
var ComponentsDateTimePickers=function(){var t=function(){jQuery().datepicker&&$(".date-picker").datepicker({rtl:App.isRTL(),orientation:"left",autoclose:!0}),$(document).scroll(function(){$("#form_modal2 .date-picker").datepicker("place")})},e=function(){jQuery().timepicker&&($(".timepicker-default").timepicker({autoclose:!0,showSeconds:!0,minuteStep:1}),$(".timepicker-no-seconds").timepicker({autoclose:!0,minuteStep:5,defaultTime:!1}),$(".timepicker-24").timepicker({autoclose:!0,minuteStep:5,showSeconds:!1,showMeridian:!1}),$(".timepicker").parent(".input-group").on("click",".input-group-btn",function(t){t.preventDefault(),$(this).parent(".input-group").find(".timepicker").timepicker("showWidget")}),$(document).scroll(function(){$("#form_modal4 .timepicker-default, #form_modal4 .timepicker-no-seconds, #form_modal4 .timepicker-24").timepicker("place")}))},o=function(){jQuery().daterangepicker&&($("#defaultrange").daterangepicker({opens:App.isRTL()?"left":"right",format:"MM/DD/YYYY",separator:" to ",startDate:moment().subtract("days",29),endDate:moment(),ranges:{Today:[moment(),moment()],Yesterday:[moment().subtract("days",1),moment().subtract("days",1)],"Last 7 Days":[moment().subtract("days",6),moment()],"Last 30 Days":[moment().subtract("days",29),moment()],"This Month":[moment().startOf("month"),moment().endOf("month")],"Last Month":[moment().subtract("month",1).startOf("month"),moment().subtract("month",1).endOf("month")]},minDate:"01/01/2012",maxDate:"12/31/2018"},function(t,e){$("#defaultrange input").val(t.format("MMMM D, YYYY")+" - "+e.format("MMMM D, YYYY"))}),$("#defaultrange_modal").daterangepicker({opens:App.isRTL()?"left":"right",format:"MM/DD/YYYY",separator:" to ",startDate:moment().subtract("days",29),endDate:moment(),minDate:"01/01/2012",maxDate:"12/31/2018"},function(t,e){$("#defaultrange_modal input").val(t.format("MMMM D, YYYY")+" - "+e.format("MMMM D, YYYY"))}),$("#defaultrange_modal").on("click",function(){$("#daterangepicker_modal").is(":visible")&&0==$("body").hasClass("modal-open")&&$("body").addClass("modal-open")}),$("#reportrange").daterangepicker({opens:App.isRTL()?"left":"right",startDate:moment().subtract("days",29),endDate:moment(),dateLimit:{days:60},showDropdowns:!0,showWeekNumbers:!0,timePicker:!1,timePickerIncrement:1,timePicker12Hour:!0,ranges:{Today:[moment(),moment()],Yesterday:[moment().subtract("days",1),moment().subtract("days",1)],"Last 7 Days":[moment().subtract("days",6),moment()],"Last 30 Days":[moment().subtract("days",29),moment()],"This Month":[moment().startOf("month"),moment().endOf("month")],"Last Month":[moment().subtract("month",1).startOf("month"),moment().subtract("month",1).endOf("month")]},buttonClasses:["btn"],applyClass:"green",cancelClass:"default",format:"MM/DD/YYYY",separator:" to ",locale:{applyLabel:"Apply",fromLabel:"From",toLabel:"To",customRangeLabel:"Custom Range",daysOfWeek:["Su","Mo","Tu","We","Th","Fr","Sa"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],firstDay:1}},function(t,e){$("#reportrange span").html(t.format("MMMM D, YYYY")+" - "+e.format("MMMM D, YYYY"))}),$("#reportrange span").html(moment().subtract("days",29).format("MMMM D, YYYY")+" - "+moment().format("MMMM D, YYYY")))},a=function(){jQuery().datetimepicker&&($(".form_datetime").datetimepicker({autoclose:!0,isRTL:App.isRTL(),format:"dd MM yyyy - hh:ii",fontAwesome:!0,pickerPosition:App.isRTL()?"bottom-right":"bottom-left"}),$(".form_advance_datetime").datetimepicker({isRTL:App.isRTL(),format:"dd MM yyyy - hh:ii",autoclose:!0,todayBtn:!0,fontAwesome:!0,startDate:"2013-02-14 10:00",pickerPosition:App.isRTL()?"bottom-right":"bottom-left",minuteStep:10}),$(".form_meridian_datetime").datetimepicker({isRTL:App.isRTL(),format:"dd MM yyyy - HH:ii P",showMeridian:!0,autoclose:!0,fontAwesome:!0,pickerPosition:App.isRTL()?"bottom-right":"bottom-left",todayBtn:!0}),$("body").removeClass("modal-open"),$(document).scroll(function(){$("#form_modal1 .form_datetime, #form_modal1 .form_advance_datetime, #form_modal1 .form_meridian_datetime").datetimepicker("place")}))},m=function(){jQuery().clockface&&($(".clockface_1").clockface(),$("#clockface_2").clockface({format:"HH:mm",trigger:"manual"}),$("#clockface_2_toggle").click(function(t){t.stopPropagation(),$("#clockface_2").clockface("toggle")}),$("#clockface_2_modal").clockface({format:"HH:mm",trigger:"manual"}),$("#clockface_2_modal_toggle").click(function(t){t.stopPropagation(),$("#clockface_2_modal").clockface("toggle")}),$(".clockface_3").clockface({format:"H:mm"}).clockface("show","14:30"),$(document).scroll(function(){$("#form_modal5 .clockface_1, #form_modal5 #clockface_2_modal").clockface("place")}))};return{init:function(){t(),e(),a(),o(),m()}}}();App.isAngularJsApp()===!1&&jQuery(document).ready(function(){ComponentsDateTimePickers.init()});
@@ -0,0 +1,263 @@
var ComponentsDropdowns = function () {
var handleSelect2 = function () {
$('#select2_sample1').select2({
placeholder: "Select an option",
allowClear: true
});
$('#select2_sample2').select2({
placeholder: "Select a State",
allowClear: true
});
$("#select2_sample3").select2({
placeholder: "Select...",
allowClear: true,
minimumInputLength: 1,
query: function (query) {
var data = {
results: []
}, i, j, s;
for (i = 1; i < 5; i++) {
s = "";
for (j = 0; j < i; j++) {
s = s + query.term;
}
data.results.push({
id: query.term + i,
text: s
});
}
query.callback(data);
}
});
function format(state) {
if (!state.id) return state.text; // optgroup
return "<img class='flag' src='" + App.getGlobalImgPath() + "flags/" + state.id.toLowerCase() + ".png'/>&nbsp;&nbsp;" + state.text;
}
$("#select2_sample4").select2({
placeholder: "Select a Country",
allowClear: true,
formatResult: format,
formatSelection: format,
escapeMarkup: function (m) {
return m;
}
});
$("#select2_sample5").select2({
tags: ["red", "green", "blue", "yellow", "pink"]
});
function movieFormatResult(movie) {
var markup = "<table class='movie-result'><tr>";
if (movie.posters !== undefined && movie.posters.thumbnail !== undefined) {
markup += "<td valign='top'><img src='" + movie.posters.thumbnail + "'/></td>";
}
markup += "<td valign='top'><h5>" + movie.title + "</h5>";
if (movie.critics_consensus !== undefined) {
markup += "<div class='movie-synopsis'>" + movie.critics_consensus + "</div>";
} else if (movie.synopsis !== undefined) {
markup += "<div class='movie-synopsis'>" + movie.synopsis + "</div>";
}
markup += "</td></tr></table>"
return markup;
}
function movieFormatSelection(movie) {
return movie.title;
}
$("#select2_sample6").select2({
placeholder: "Search for a movie",
minimumInputLength: 1,
ajax: { // instead of writing the function to execute the request we use Select2's convenient helper
url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json",
dataType: 'jsonp',
data: function (term, page) {
return {
q: term, // search term
page_limit: 10,
apikey: "ju6z9mjyajq2djue3gbvv26t" // please do not use so this example keeps working
};
},
results: function (data, page) { // parse the results into the format expected by Select2.
// since we are using custom formatting functions we do not need to alter remote JSON data
return {
results: data.movies
};
}
},
initSelection: function (element, callback) {
// the input tag has a value attribute preloaded that points to a preselected movie's id
// this function resolves that id attribute to an object that select2 can render
// using its formatResult renderer - that way the movie name is shown preselected
var id = $(element).val();
if (id !== "") {
$.ajax("http://api.rottentomatoes.com/api/public/v1.0/movies/" + id + ".json", {
data: {
apikey: "ju6z9mjyajq2djue3gbvv26t"
},
dataType: "jsonp"
}).done(function (data) {
callback(data);
});
}
},
formatResult: movieFormatResult, // omitted for brevity, see the source of this page
formatSelection: movieFormatSelection, // omitted for brevity, see the source of this page
dropdownCssClass: "bigdrop", // apply css that makes the dropdown taller
escapeMarkup: function (m) {
return m;
} // we do not want to escape markup since we are displaying html in results
});
}
var handleSelect2Modal = function () {
$('#select2_sample_modal_1').select2({
placeholder: "Select an option",
allowClear: true
});
$('#select2_sample_modal_2').select2({
placeholder: "Select a State",
allowClear: true
});
$("#select2_sample_modal_3").select2({
allowClear: true,
minimumInputLength: 1,
query: function (query) {
var data = {
results: []
}, i, j, s;
for (i = 1; i < 5; i++) {
s = "";
for (j = 0; j < i; j++) {
s = s + query.term;
}
data.results.push({
id: query.term + i,
text: s
});
}
query.callback(data);
}
});
function format(state) {
if (!state.id) return state.text; // optgroup
return "<img class='flag' src='" + App.getGlobalImgPath() + "flags/" + state.id.toLowerCase() + ".png'/>&nbsp;&nbsp;" + state.text;
}
$("#select2_sample_modal_4").select2({
allowClear: true,
formatResult: format,
formatSelection: format,
escapeMarkup: function (m) {
return m;
}
});
$("#select2_sample_modal_5").select2({
tags: ["red", "green", "blue", "yellow", "pink"]
});
function movieFormatResult(movie) {
var markup = "<table class='movie-result'><tr>";
if (movie.posters !== undefined && movie.posters.thumbnail !== undefined) {
markup += "<td valign='top'><img src='" + movie.posters.thumbnail + "'/></td>";
}
markup += "<td valign='top'><h5>" + movie.title + "</h5>";
if (movie.critics_consensus !== undefined) {
markup += "<div class='movie-synopsis'>" + movie.critics_consensus + "</div>";
} else if (movie.synopsis !== undefined) {
markup += "<div class='movie-synopsis'>" + movie.synopsis + "</div>";
}
markup += "</td></tr></table>"
return markup;
}
function movieFormatSelection(movie) {
return movie.title;
}
$("#select2_sample_modal_6").select2({
placeholder: "Search for a movie",
minimumInputLength: 1,
ajax: { // instead of writing the function to execute the request we use Select2's convenient helper
url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json",
dataType: 'jsonp',
data: function (term, page) {
return {
q: term, // search term
page_limit: 10,
apikey: "ju6z9mjyajq2djue3gbvv26t" // please do not use so this example keeps working
};
},
results: function (data, page) { // parse the results into the format expected by Select2.
// since we are using custom formatting functions we do not need to alter remote JSON data
return {
results: data.movies
};
}
},
initSelection: function (element, callback) {
// the input tag has a value attribute preloaded that points to a preselected movie's id
// this function resolves that id attribute to an object that select2 can render
// using its formatResult renderer - that way the movie name is shown preselected
var id = $(element).val();
if (id !== "") {
$.ajax("http://api.rottentomatoes.com/api/public/v1.0/movies/" + id + ".json", {
data: {
apikey: "ju6z9mjyajq2djue3gbvv26t"
},
dataType: "jsonp"
}).done(function (data) {
callback(data);
});
}
},
formatResult: movieFormatResult, // omitted for brevity, see the source of this page
formatSelection: movieFormatSelection, // omitted for brevity, see the source of this page
dropdownCssClass: "bigdrop", // apply css that makes the dropdown taller
escapeMarkup: function (m) {
return m;
} // we do not want to escape markup since we are displaying html in results
});
}
var handleBootstrapSelect = function() {
$('.bs-select').selectpicker({
iconBase: 'fa',
tickIcon: 'fa-check'
});
}
var handleMultiSelect = function () {
$('#my_multi_select1').multiSelect();
$('#my_multi_select2').multiSelect({
selectableOptgroup: true
});
}
return {
//main function to initiate the module
init: function () {
handleSelect2();
handleSelect2Modal();
handleMultiSelect();
handleBootstrapSelect();
}
};
}();
jQuery(document).ready(function() {
ComponentsDropdowns.init();
});
+1
View File
@@ -0,0 +1 @@
var ComponentsDropdowns=function(){var e=function(){function e(e){return e.id?"<img class='flag' src='"+App.getGlobalImgPath()+"flags/"+e.id.toLowerCase()+".png'/>&nbsp;&nbsp;"+e.text:e.text}function t(e){var t="<table class='movie-result'><tr>";return void 0!==e.posters&&void 0!==e.posters.thumbnail&&(t+="<td valign='top'><img src='"+e.posters.thumbnail+"'/></td>"),t+="<td valign='top'><h5>"+e.title+"</h5>",void 0!==e.critics_consensus?t+="<div class='movie-synopsis'>"+e.critics_consensus+"</div>":void 0!==e.synopsis&&(t+="<div class='movie-synopsis'>"+e.synopsis+"</div>"),t+="</td></tr></table>"}function s(e){return e.title}$("#select2_sample1").select2({placeholder:"Select an option",allowClear:!0}),$("#select2_sample2").select2({placeholder:"Select a State",allowClear:!0}),$("#select2_sample3").select2({placeholder:"Select...",allowClear:!0,minimumInputLength:1,query:function(e){var t,s,l,o={results:[]};for(t=1;t<5;t++){for(l="",s=0;s<t;s++)l+=e.term;o.results.push({id:e.term+t,text:l})}e.callback(o)}}),$("#select2_sample4").select2({placeholder:"Select a Country",allowClear:!0,formatResult:e,formatSelection:e,escapeMarkup:function(e){return e}}),$("#select2_sample5").select2({tags:["red","green","blue","yellow","pink"]}),$("#select2_sample6").select2({placeholder:"Search for a movie",minimumInputLength:1,ajax:{url:"http://api.rottentomatoes.com/api/public/v1.0/movies.json",dataType:"jsonp",data:function(e,t){return{q:e,page_limit:10,apikey:"ju6z9mjyajq2djue3gbvv26t"}},results:function(e,t){return{results:e.movies}}},initSelection:function(e,t){var s=$(e).val();""!==s&&$.ajax("http://api.rottentomatoes.com/api/public/v1.0/movies/"+s+".json",{data:{apikey:"ju6z9mjyajq2djue3gbvv26t"},dataType:"jsonp"}).done(function(e){t(e)})},formatResult:t,formatSelection:s,dropdownCssClass:"bigdrop",escapeMarkup:function(e){return e}})},t=function(){function e(e){return e.id?"<img class='flag' src='"+App.getGlobalImgPath()+"flags/"+e.id.toLowerCase()+".png'/>&nbsp;&nbsp;"+e.text:e.text}function t(e){var t="<table class='movie-result'><tr>";return void 0!==e.posters&&void 0!==e.posters.thumbnail&&(t+="<td valign='top'><img src='"+e.posters.thumbnail+"'/></td>"),t+="<td valign='top'><h5>"+e.title+"</h5>",void 0!==e.critics_consensus?t+="<div class='movie-synopsis'>"+e.critics_consensus+"</div>":void 0!==e.synopsis&&(t+="<div class='movie-synopsis'>"+e.synopsis+"</div>"),t+="</td></tr></table>"}function s(e){return e.title}$("#select2_sample_modal_1").select2({placeholder:"Select an option",allowClear:!0}),$("#select2_sample_modal_2").select2({placeholder:"Select a State",allowClear:!0}),$("#select2_sample_modal_3").select2({allowClear:!0,minimumInputLength:1,query:function(e){var t,s,l,o={results:[]};for(t=1;t<5;t++){for(l="",s=0;s<t;s++)l+=e.term;o.results.push({id:e.term+t,text:l})}e.callback(o)}}),$("#select2_sample_modal_4").select2({allowClear:!0,formatResult:e,formatSelection:e,escapeMarkup:function(e){return e}}),$("#select2_sample_modal_5").select2({tags:["red","green","blue","yellow","pink"]}),$("#select2_sample_modal_6").select2({placeholder:"Search for a movie",minimumInputLength:1,ajax:{url:"http://api.rottentomatoes.com/api/public/v1.0/movies.json",dataType:"jsonp",data:function(e,t){return{q:e,page_limit:10,apikey:"ju6z9mjyajq2djue3gbvv26t"}},results:function(e,t){return{results:e.movies}}},initSelection:function(e,t){var s=$(e).val();""!==s&&$.ajax("http://api.rottentomatoes.com/api/public/v1.0/movies/"+s+".json",{data:{apikey:"ju6z9mjyajq2djue3gbvv26t"},dataType:"jsonp"}).done(function(e){t(e)})},formatResult:t,formatSelection:s,dropdownCssClass:"bigdrop",escapeMarkup:function(e){return e}})},s=function(){$(".bs-select").selectpicker({iconBase:"fa",tickIcon:"fa-check"})},l=function(){$("#my_multi_select1").multiSelect(),$("#my_multi_select2").multiSelect({selectableOptgroup:!0})};return{init:function(){e(),t(),l(),s()}}}();jQuery(document).ready(function(){ComponentsDropdowns.init()});
@@ -0,0 +1,34 @@
var ComponentsEditors = function () {
var handleWysihtml5 = function () {
if (!jQuery().wysihtml5) {
return;
}
if ($('.wysihtml5').size() > 0) {
$('.wysihtml5').wysihtml5({
"stylesheets": ["../assets/global/plugins/bootstrap-wysihtml5/wysiwyg-color.css"]
});
}
}
var handleSummernote = function () {
$('#summernote_1').summernote({height: 300});
//API:
//var sHTML = $('#summernote_1').code(); // get code
//$('#summernote_1').destroy(); // destroy
}
return {
//main function to initiate the module
init: function () {
handleWysihtml5();
handleSummernote();
}
};
}();
jQuery(document).ready(function() {
ComponentsEditors.init();
});
+1
View File
@@ -0,0 +1 @@
var ComponentsEditors=function(){var t=function(){jQuery().wysihtml5&&$(".wysihtml5").size()>0&&$(".wysihtml5").wysihtml5({stylesheets:["../assets/global/plugins/bootstrap-wysihtml5/wysiwyg-color.css"]})},s=function(){$("#summernote_1").summernote({height:300})};return{init:function(){t(),s()}}}();jQuery(document).ready(function(){ComponentsEditors.init()});
@@ -0,0 +1,586 @@
var ComponentsFormTools = function () {
var handleTwitterTypeahead = function() {
// Example #1
// instantiate the bloodhound suggestion engine
var numbers = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.num); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
local: [
{ num: 'metronic' },
{ num: 'keenthemes' },
{ num: 'metronic theme' },
{ num: 'metronic template' },
{ num: 'keenthemes team' }
]
});
// initialize the bloodhound suggestion engine
numbers.initialize();
// instantiate the typeahead UI
if (App.isRTL()) {
$('#typeahead_example_1').attr("dir", "rtl");
}
$('#typeahead_example_1').typeahead(null, {
displayKey: 'num',
hint: (App.isRTL() ? false : true),
source: numbers.ttAdapter()
});
// Example #2
var countries = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.name); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
limit: 10,
prefetch: {
url: '../demo/typeahead_countries.json',
filter: function(list) {
return $.map(list, function(country) { return { name: country }; });
}
}
});
countries.initialize();
if (App.isRTL()) {
$('#typeahead_example_2').attr("dir", "rtl");
}
$('#typeahead_example_2').typeahead(null, {
name: 'typeahead_example_2',
displayKey: 'name',
hint: (App.isRTL() ? false : true),
source: countries.ttAdapter()
});
// Example #3
var custom = new Bloodhound({
datumTokenizer: function(d) { return d.tokens; },
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: '../demo/typeahead_custom.php?query=%QUERY'
});
custom.initialize();
if (App.isRTL()) {
$('#typeahead_example_3').attr("dir", "rtl");
}
$('#typeahead_example_3').typeahead(null, {
name: 'datypeahead_example_3',
displayKey: 'value',
source: custom.ttAdapter(),
hint: (App.isRTL() ? false : true),
templates: {
suggestion: Handlebars.compile([
'<div class="media">',
'<div class="pull-left">',
'<div class="media-object">',
'<img src="{{img}}" width="50" height="50"/>',
'</div>',
'</div>',
'<div class="media-body">',
'<h4 class="media-heading">{{value}}</h4>',
'<p>{{desc}}</p>',
'</div>',
'</div>',
].join(''))
}
});
// Example #4
var nba = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.team); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: '../demo/typeahead_nba.json'
});
var nhl = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.team); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: '../demo/typeahead_nhl.json'
});
nba.initialize();
nhl.initialize();
if (App.isRTL()) {
$('#typeahead_example_4').attr("dir", "rtl");
}
$('#typeahead_example_4').typeahead({
hint: (App.isRTL() ? false : true),
highlight: true
},
{
name: 'nba',
displayKey: 'team',
source: nba.ttAdapter(),
templates: {
header: '<h3>NBA Teams</h3>'
}
},
{
name: 'nhl',
displayKey: 'team',
source: nhl.ttAdapter(),
templates: {
header: '<h3>NHL Teams</h3>'
}
});
}
var handleTwitterTypeaheadModal = function() {
// Example #1
// instantiate the bloodhound suggestion engine
var numbers = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.num); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
local: [
{ num: 'metronic' },
{ num: 'keenthemes' },
{ num: 'metronic theme' },
{ num: 'metronic template' },
{ num: 'keenthemes team' }
]
});
// initialize the bloodhound suggestion engine
numbers.initialize();
// instantiate the typeahead UI
if (App.isRTL()) {
$('#typeahead_example_modal_1').attr("dir", "rtl");
}
$('#typeahead_example_modal_1').typeahead(null, {
displayKey: 'num',
hint: (App.isRTL() ? false : true),
source: numbers.ttAdapter()
});
// Example #2
var countries = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.name); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
limit: 10,
prefetch: {
url: '../demo/typeahead_countries.json',
filter: function(list) {
return $.map(list, function(country) { return { name: country }; });
}
}
});
countries.initialize();
if (App.isRTL()) {
$('#typeahead_example_modal_2').attr("dir", "rtl");
}
$('#typeahead_example_modal_2').typeahead(null, {
name: 'typeahead_example_modal_2',
displayKey: 'name',
hint: (App.isRTL() ? false : true),
source: countries.ttAdapter()
});
// Example #3
var custom = new Bloodhound({
datumTokenizer: function(d) { return d.tokens; },
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: '../demo/typeahead_custom.php?query=%QUERY'
});
custom.initialize();
if (App.isRTL()) {
$('#typeahead_example_modal_3').attr("dir", "rtl");
}
$('#typeahead_example_modal_3').typeahead(null, {
name: 'datypeahead_example_modal_3',
displayKey: 'value',
hint: (App.isRTL() ? false : true),
source: custom.ttAdapter(),
templates: {
suggestion: Handlebars.compile([
'<div class="media">',
'<div class="pull-left">',
'<div class="media-object">',
'<img src="{{img}}" width="50" height="50"/>',
'</div>',
'</div>',
'<div class="media-body">',
'<h4 class="media-heading">{{value}}</h4>',
'<p>{{desc}}</p>',
'</div>',
'</div>',
].join(''))
}
});
// Example #4
var nba = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.team); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
limit: 3,
prefetch: '../demo/typeahead_nba.json'
});
var nhl = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.team); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
limit: 3,
prefetch: '../demo/typeahead_nhl.json'
});
nba.initialize();
nhl.initialize();
$('#typeahead_example_modal_4').typeahead({
hint: (App.isRTL() ? false : true),
highlight: true
},
{
name: 'nba',
displayKey: 'team',
source: nba.ttAdapter(),
templates: {
header: '<h3>NBA Teams</h3>'
}
},
{
name: 'nhl',
displayKey: 'team',
source: nhl.ttAdapter(),
templates: {
header: '<h3>NHL Teams</h3>'
}
});
}
var handleBootstrapSwitch = function() {
$('.switch-radio1').on('switch-change', function () {
$('.switch-radio1').bootstrapSwitch('toggleRadioState');
});
// or
$('.switch-radio1').on('switch-change', function () {
$('.switch-radio1').bootstrapSwitch('toggleRadioStateAllowUncheck');
});
// or
$('.switch-radio1').on('switch-change', function () {
$('.switch-radio1').bootstrapSwitch('toggleRadioStateAllowUncheck', false);
});
}
var handleBootstrapTouchSpin = function() {
$("#touchspin_demo1").TouchSpin({
buttondown_class: 'btn green',
buttonup_class: 'btn green',
min: -1000000000,
max: 1000000000,
stepinterval: 50,
maxboostedstep: 10000000,
prefix: '$'
});
$("#touchspin_demo2").TouchSpin({
buttondown_class: 'btn blue',
buttonup_class: 'btn blue',
min: 0,
max: 100,
step: 0.1,
decimals: 2,
boostat: 5,
maxboostedstep: 10,
postfix: '%'
});
$("#touchspin_demo3").TouchSpin({
buttondown_class: 'btn green',
buttonup_class: 'btn green',
prefix: "$",
postfix: "%"
});
}
var handleBootstrapMaxlength = function() {
$('#maxlength_defaultconfig').maxlength({
limitReachedClass: "label label-danger",
})
$('#maxlength_thresholdconfig').maxlength({
limitReachedClass: "label label-danger",
threshold: 20
});
$('#maxlength_alloptions').maxlength({
alwaysShow: true,
warningClass: "label label-success",
limitReachedClass: "label label-danger",
separator: ' out of ',
preText: 'You typed ',
postText: ' chars available.',
validate: true
});
$('#maxlength_textarea').maxlength({
limitReachedClass: "label label-danger",
alwaysShow: true
});
$('#maxlength_placement').maxlength({
limitReachedClass: "label label-danger",
alwaysShow: true,
placement: App.isRTL() ? 'top-right' : 'top-left'
});
}
var handleSpinners = function () {
$('#spinner1').spinner();
$('#spinner2').spinner({disabled: true});
$('#spinner3').spinner({value:0, min: 0, max: 10});
$('#spinner4').spinner({value:0, step: 5, min: 0, max: 200});
}
var handleTagsInput = function () {
if (!jQuery().tagsInput) {
return;
}
$('#tags_1').tagsInput({
width: 'auto',
'onAddTag': function () {
//alert(1);
},
});
$('#tags_2').tagsInput({
width: 300
});
}
var handleInputMasks = function () {
$("#mask_date").inputmask("d/m/y", {
autoUnmask: true
}); //direct mask
$("#mask_date1").inputmask("d/m/y", {
"placeholder": "*"
}); //change the placeholder
$("#mask_date2").inputmask("d/m/y", {
"placeholder": "dd/mm/yyyy"
}); //multi-char placeholder
$("#mask_phone").inputmask("mask", {
"mask": "(999) 999-9999"
}); //specifying fn & options
$("#mask_tin").inputmask({
"mask": "99-9999999",
placeholder: "" // remove underscores from the input mask
}); //specifying options only
$("#mask_number").inputmask({
"mask": "9",
"repeat": 10,
"greedy": false
}); // ~ mask "9" or mask "99" or ... mask "9999999999"
$("#mask_decimal").inputmask('decimal', {
rightAlignNumerics: false
}); //disables the right alignment of the decimal input
$("#mask_currency").inputmask('€ 999.999.999,99', {
numericInput: true
}); //123456 => € ___.__1.234,56
$("#mask_currency2").inputmask('€ 999,999,999.99', {
numericInput: true,
rightAlignNumerics: false,
greedy: false
}); //123456 => € ___.__1.234,56
$("#mask_ssn").inputmask("999-99-9999", {
placeholder: " ",
clearMaskOnLostFocus: true
}); //default
}
var handleIPAddressInput = function () {
$('#input_ipv4').ipAddress();
$('#input_ipv6').ipAddress({
v: 6
});
}
var handlePasswordStrengthChecker = function () {
var initialized = false;
var input = $("#password_strength");
input.keydown(function () {
if (initialized === false) {
// set base options
input.pwstrength({
raisePower: 1.4,
minChar: 8,
verdicts: ["Weak", "Normal", "Medium", "Strong", "Very Strong"],
scores: [17, 26, 40, 50, 60]
});
// add your own rule to calculate the password strength
input.pwstrength("addRule", "demoRule", function (options, word, score) {
return word.match(/[a-z].[0-9]/) && score;
}, 10, true);
// set as initialized
initialized = true;
}
});
}
var handleUsernameAvailabilityChecker1 = function () {
var input = $("#username1_input");
$("#username1_checker").click(function (e) {
var pop = $(this);
if (input.val() === "") {
input.closest('.form-group').removeClass('has-success').addClass('has-error');
pop.popover('destroy');
pop.popover({
'placement': (App.isRTL() ? 'left' : 'right'),
'html': true,
'container': 'body',
'content': 'Please enter a username to check its availability.',
});
// add error class to the popover
pop.data('bs.popover').tip().addClass('error');
// set last poped popover to be closed on click(see App.js => handlePopovers function)
App.setLastPopedPopover(pop);
pop.popover('show');
e.stopPropagation(); // prevent closing the popover
return;
}
var btn = $(this);
btn.attr('disabled', true);
input.attr("readonly", true).
attr("disabled", true).
addClass("spinner");
$.post('../demo/username_checker.php', {
username: input.val()
}, function (res) {
btn.attr('disabled', false);
input.attr("readonly", false).
attr("disabled", false).
removeClass("spinner");
if (res.status == 'OK') {
input.closest('.form-group').removeClass('has-error').addClass('has-success');
pop.popover('destroy');
pop.popover({
'html': true,
'placement': (App.isRTL() ? 'left' : 'right'),
'container': 'body',
'content': res.message,
});
pop.popover('show');
pop.data('bs.popover').tip().removeClass('error').addClass('success');
} else {
input.closest('.form-group').removeClass('has-success').addClass('has-error');
pop.popover('destroy');
pop.popover({
'html': true,
'placement': (App.isRTL() ? 'left' : 'right'),
'container': 'body',
'content': res.message,
});
pop.popover('show');
pop.data('bs.popover').tip().removeClass('success').addClass('error');
App.setLastPopedPopover(pop);
}
}, 'json');
});
}
var handleUsernameAvailabilityChecker2 = function () {
$("#username2_input").change(function () {
var input = $(this);
if (input.val() === "") {
input.closest('.form-group').removeClass('has-error').removeClass('has-success');
$('.fa-check, fa-warning', input.closest('.form-group')).remove();
return;
}
input.attr("readonly", true).
attr("disabled", true).
addClass("spinner");
$.post('../demo/username_checker.php', {
username: input.val()
}, function (res) {
input.attr("readonly", false).
attr("disabled", false).
removeClass("spinner");
// change popover font color based on the result
if (res.status == 'OK') {
input.closest('.form-group').removeClass('has-error').addClass('has-success');
$('.fa-warning', input.closest('.form-group')).remove();
input.before('<i class="fa fa-check"></i>');
input.data('bs.popover').tip().removeClass('error').addClass('success');
} else {
input.closest('.form-group').removeClass('has-success').addClass('has-error');
$('.fa-check', input.closest('.form-group')).remove();
input.before('<i class="fa fa-warning"></i>');
input.popover('destroy');
input.popover({
'html': true,
'placement': (App.isRTL() ? 'left' : 'right'),
'container': 'body',
'content': res.message,
});
input.popover('show');
input.data('bs.popover').tip().removeClass('success').addClass('error');
App.setLastPopedPopover(input);
}
}, 'json');
});
}
return {
//main function to initiate the module
init: function () {
handleTwitterTypeahead();
handleTwitterTypeaheadModal();
handleBootstrapSwitch();
handleBootstrapTouchSpin();
handleBootstrapMaxlength();
handleSpinners();
handleTagsInput();
handleInputMasks();
handleIPAddressInput();
handlePasswordStrengthChecker();
handleUsernameAvailabilityChecker1();
handleUsernameAvailabilityChecker2();
}
};
}();
File diff suppressed because one or more lines are too long
@@ -0,0 +1,202 @@
var ComponentsFormTools = function () {
var handleBootstrapMaxlength = function() {
$('#maxlength_defaultconfig').maxlength({
limitReachedClass: "label label-danger",
})
$('#maxlength_thresholdconfig').maxlength({
limitReachedClass: "label label-danger",
threshold: 20
});
$('#maxlength_alloptions').maxlength({
alwaysShow: true,
warningClass: "label label-success",
limitReachedClass: "label label-danger",
separator: ' out of ',
preText: 'You typed ',
postText: ' chars available.',
validate: true
});
$('#maxlength_textarea').maxlength({
limitReachedClass: "label label-danger",
alwaysShow: true
});
$('#maxlength_placement').maxlength({
limitReachedClass: "label label-danger",
alwaysShow: true,
placement: App.isRTL() ? 'top-right' : 'top-left'
});
}
var handlePasswordStrengthChecker = function () {
var initialized = false;
var input = $("#password_strength");
input.keydown(function () {
if (initialized === false) {
// set base options
input.pwstrength({
raisePower: 1.4,
minChar: 8,
verdicts: ["Weak", "Normal", "Medium", "Strong", "Very Strong"],
scores: [17, 26, 40, 50, 60]
});
// add your own rule to calculate the password strength
input.pwstrength("addRule", "demoRule", function (options, word, score) {
return word.match(/[a-z].[0-9]/) && score;
}, 10, true);
// set as initialized
initialized = true;
}
});
}
var handleUsernameAvailabilityChecker1 = function () {
var input = $("#username1_input");
$("#username1_checker").click(function (e) {
var pop = $(this);
if (input.val() === "") {
input.closest('.form-group').removeClass('has-success').addClass('has-error');
pop.popover('destroy');
pop.popover({
'placement': (App.isRTL() ? 'left' : 'right'),
'html': true,
'container': 'body',
'content': 'Please enter a username to check its availability.',
});
// add error class to the popover
pop.data('bs.popover').tip().addClass('error');
// set last poped popover to be closed on click(see App.js => handlePopovers function)
App.setLastPopedPopover(pop);
pop.popover('show');
e.stopPropagation(); // prevent closing the popover
return;
}
var btn = $(this);
btn.attr('disabled', true);
input.attr("readonly", true).
attr("disabled", true).
addClass("spinner");
$.post('../demo/username_checker.php', {
username: input.val()
}, function (res) {
btn.attr('disabled', false);
input.attr("readonly", false).
attr("disabled", false).
removeClass("spinner");
if (res.status == 'OK') {
input.closest('.form-group').removeClass('has-error').addClass('has-success');
pop.popover('destroy');
pop.popover({
'html': true,
'placement': (App.isRTL() ? 'left' : 'right'),
'container': 'body',
'content': res.message,
});
pop.popover('show');
pop.data('bs.popover').tip().removeClass('error').addClass('success');
} else {
input.closest('.form-group').removeClass('has-success').addClass('has-error');
pop.popover('destroy');
pop.popover({
'html': true,
'placement': (App.isRTL() ? 'left' : 'right'),
'container': 'body',
'content': res.message,
});
pop.popover('show');
pop.data('bs.popover').tip().removeClass('success').addClass('error');
App.setLastPopedPopover(pop);
}
}, 'json');
});
}
var handleUsernameAvailabilityChecker2 = function () {
$("#username2_input").change(function () {
var input = $(this);
if (input.val() === "") {
input.closest('.form-group').removeClass('has-error').removeClass('has-success');
$('.fa-check, fa-warning', input.closest('.form-group')).remove();
return;
}
input.attr("readonly", true).
attr("disabled", true).
addClass("spinner");
$.post('../demo/username_checker.php', {
username: input.val()
}, function (res) {
input.attr("readonly", false).
attr("disabled", false).
removeClass("spinner");
// change popover font color based on the result
if (res.status == 'OK') {
input.closest('.form-group').removeClass('has-error').addClass('has-success');
$('.fa-warning', input.closest('.form-group')).remove();
input.before('<i class="fa fa-check"></i>');
input.data('bs.popover').tip().removeClass('error').addClass('success');
} else {
input.closest('.form-group').removeClass('has-success').addClass('has-error');
$('.fa-check', input.closest('.form-group')).remove();
input.before('<i class="fa fa-warning"></i>');
input.popover('destroy');
input.popover({
'html': true,
'placement': (App.isRTL() ? 'left' : 'right'),
'container': 'body',
'content': res.message,
});
input.popover('show');
input.data('bs.popover').tip().removeClass('success').addClass('error');
App.setLastPopedPopover(input);
}
}, 'json');
});
}
return {
//main function to initiate the module
init: function () {
handleBootstrapMaxlength();
handlePasswordStrengthChecker();
handleUsernameAvailabilityChecker1();
handleUsernameAvailabilityChecker2();
}
};
}();
if (App.isAngularJsApp() === false) {
jQuery(document).ready(function() {
ComponentsFormTools.init(); // init metronic core componets
});
}
+1
View File
@@ -0,0 +1 @@
var ComponentsFormTools=function(){var e=function(){$("#maxlength_defaultconfig").maxlength({limitReachedClass:"label label-danger"}),$("#maxlength_thresholdconfig").maxlength({limitReachedClass:"label label-danger",threshold:20}),$("#maxlength_alloptions").maxlength({alwaysShow:!0,warningClass:"label label-success",limitReachedClass:"label label-danger",separator:" out of ",preText:"You typed ",postText:" chars available.",validate:!0}),$("#maxlength_textarea").maxlength({limitReachedClass:"label label-danger",alwaysShow:!0}),$("#maxlength_placement").maxlength({limitReachedClass:"label label-danger",alwaysShow:!0,placement:App.isRTL()?"top-right":"top-left"})},s=function(){var e=!1,s=$("#password_strength");s.keydown(function(){e===!1&&(s.pwstrength({raisePower:1.4,minChar:8,verdicts:["Weak","Normal","Medium","Strong","Very Strong"],scores:[17,26,40,50,60]}),s.pwstrength("addRule","demoRule",function(e,s,a){return s.match(/[a-z].[0-9]/)&&a},10,!0),e=!0)})},a=function(){var e=$("#username1_input");$("#username1_checker").click(function(s){var a=$(this);if(""===e.val())return e.closest(".form-group").removeClass("has-success").addClass("has-error"),a.popover("destroy"),a.popover({placement:App.isRTL()?"left":"right",html:!0,container:"body",content:"Please enter a username to check its availability."}),a.data("bs.popover").tip().addClass("error"),App.setLastPopedPopover(a),a.popover("show"),void s.stopPropagation();var o=$(this);o.attr("disabled",!0),e.attr("readonly",!0).attr("disabled",!0).addClass("spinner"),$.post("../demo/username_checker.php",{username:e.val()},function(s){o.attr("disabled",!1),e.attr("readonly",!1).attr("disabled",!1).removeClass("spinner"),"OK"==s.status?(e.closest(".form-group").removeClass("has-error").addClass("has-success"),a.popover("destroy"),a.popover({html:!0,placement:App.isRTL()?"left":"right",container:"body",content:s.message}),a.popover("show"),a.data("bs.popover").tip().removeClass("error").addClass("success")):(e.closest(".form-group").removeClass("has-success").addClass("has-error"),a.popover("destroy"),a.popover({html:!0,placement:App.isRTL()?"left":"right",container:"body",content:s.message}),a.popover("show"),a.data("bs.popover").tip().removeClass("success").addClass("error"),App.setLastPopedPopover(a))},"json")})},o=function(){$("#username2_input").change(function(){var e=$(this);return""===e.val()?(e.closest(".form-group").removeClass("has-error").removeClass("has-success"),void $(".fa-check, fa-warning",e.closest(".form-group")).remove()):(e.attr("readonly",!0).attr("disabled",!0).addClass("spinner"),void $.post("../demo/username_checker.php",{username:e.val()},function(s){e.attr("readonly",!1).attr("disabled",!1).removeClass("spinner"),"OK"==s.status?(e.closest(".form-group").removeClass("has-error").addClass("has-success"),$(".fa-warning",e.closest(".form-group")).remove(),e.before('<i class="fa fa-check"></i>'),e.data("bs.popover").tip().removeClass("error").addClass("success")):(e.closest(".form-group").removeClass("has-success").addClass("has-error"),$(".fa-check",e.closest(".form-group")).remove(),e.before('<i class="fa fa-warning"></i>'),e.popover("destroy"),e.popover({html:!0,placement:App.isRTL()?"left":"right",container:"body",content:s.message}),e.popover("show"),e.data("bs.popover").tip().removeClass("success").addClass("error"),App.setLastPopedPopover(e))},"json"))})};return{init:function(){e(),s(),a(),o()}}}();App.isAngularJsApp()===!1&&jQuery(document).ready(function(){ComponentsFormTools.init()});
@@ -0,0 +1,150 @@
var ComponentsIonSliders = function() {
var handleBasicDemo = function() {
// demo 1
$("#range_1").ionRangeSlider();
// demo 2
$("#range_2").ionRangeSlider({
min: 100,
max: 1000,
from: 550
});
// demo 3
$("#range_3").ionRangeSlider({
type: "double",
grid: true,
min: 0,
max: 1000,
from: 200,
to: 800,
prefix: "$"
});
// demo 4
$("#range_4").ionRangeSlider({
type: "double",
grid: true,
min: -1000,
max: 1000,
from: -500,
to: 500
});
// demo 5
$("#range_5").ionRangeSlider({
type: "double",
grid: true,
from: 1,
to: 5,
values: [0, 10, 100, 1000, 10000, 100000, 1000000]
});
// demo 6
$("#range_6").ionRangeSlider({
grid: true,
from: 5,
values: [
"zero", "one",
"two", "three",
"four", "five",
"six", "seven",
"eight", "nine",
"ten"
]
});
// demo 7
$("#range_7").ionRangeSlider({
grid: true,
from: 3,
values: [
"January", "February", "March",
"April", "May", "June",
"July", "August", "September",
"October", "November", "December"
]
});
// demo 8
$("#range_8").ionRangeSlider({
type: "double",
min: 100,
max: 200,
from: 145,
to: 155,
prefix: "Weight: ",
postfix: " million pounds",
decorate_both: true
});
// demo 9
$("#range_9").ionRangeSlider({
type: "double",
min: 100,
max: 200,
from: 148,
to: 152,
prefix: "Weight: ",
postfix: " million pounds",
values_separator: " → "
});
}
var handleAdvancedDemo = function() {
$("#range_10").ionRangeSlider({
type: "double",
min: 0,
max: 100,
from: 30,
to: 70,
from_fixed: true
});
$("#range_11").ionRangeSlider({
min: 0,
max: 100,
from: 30,
from_min: 10,
from_max: 50
});
$("#range_12").ionRangeSlider({
type: "double",
min: 0,
max: 100,
from: 20,
from_min: 10,
from_max: 30,
from_shadow: true,
to: 80,
to_min: 70,
to_max: 90,
to_shadow: true,
grid: true,
grid_num: 10
});
$("#range_13").ionRangeSlider({
min: 0,
max: 100,
from: 30,
disable: true
});
}
return {
//main function to initiate the module
init: function() {
handleBasicDemo();
handleAdvancedDemo();
}
};
}();
jQuery(document).ready(function() {
ComponentsIonSliders.init();
});
+1
View File
@@ -0,0 +1 @@
var ComponentsIonSliders=function(){var e=function(){$("#range_1").ionRangeSlider(),$("#range_2").ionRangeSlider({min:100,max:1e3,from:550}),$("#range_3").ionRangeSlider({type:"double",grid:!0,min:0,max:1e3,from:200,to:800,prefix:"$"}),$("#range_4").ionRangeSlider({type:"double",grid:!0,min:-1e3,max:1e3,from:-500,to:500}),$("#range_5").ionRangeSlider({type:"double",grid:!0,from:1,to:5,values:[0,10,100,1e3,1e4,1e5,1e6]}),$("#range_6").ionRangeSlider({grid:!0,from:5,values:["zero","one","two","three","four","five","six","seven","eight","nine","ten"]}),$("#range_7").ionRangeSlider({grid:!0,from:3,values:["January","February","March","April","May","June","July","August","September","October","November","December"]}),$("#range_8").ionRangeSlider({type:"double",min:100,max:200,from:145,to:155,prefix:"Weight: ",postfix:" million pounds",decorate_both:!0}),$("#range_9").ionRangeSlider({type:"double",min:100,max:200,from:148,to:152,prefix:"Weight: ",postfix:" million pounds",values_separator:" → "})},n=function(){$("#range_10").ionRangeSlider({type:"double",min:0,max:100,from:30,to:70,from_fixed:!0}),$("#range_11").ionRangeSlider({min:0,max:100,from:30,from_min:10,from_max:50}),$("#range_12").ionRangeSlider({type:"double",min:0,max:100,from:20,from_min:10,from_max:30,from_shadow:!0,to:80,to_min:70,to_max:90,to_shadow:!0,grid:!0,grid_num:10}),$("#range_13").ionRangeSlider({min:0,max:100,from:30,disable:!0})};return{init:function(){e(),n()}}}();jQuery(document).ready(function(){ComponentsIonSliders.init()});
@@ -0,0 +1,27 @@
var ComponentsKnobDials = function () {
return {
//main function to initiate the module
init: function () {
//knob does not support ie8 so skip it
if (!jQuery().knob || App.isIE8()) {
return;
}
// general knob
$(".knob").knob({
'dynamicDraw': true,
'thickness': 0.2,
'tickColorizeValues': true,
'skin': 'tron'
});
}
};
}();
jQuery(document).ready(function() {
ComponentsKnobDials.init();
});
+1
View File
@@ -0,0 +1 @@
var ComponentsKnobDials=function(){return{init:function(){jQuery().knob&&!App.isIE8()&&$(".knob").knob({dynamicDraw:!0,thickness:.2,tickColorizeValues:!0,skin:"tron"})}}}();jQuery(document).ready(function(){ComponentsKnobDials.init()});
@@ -0,0 +1,263 @@
var ComponentsDropdowns = function () {
var handleSelect2 = function () {
$('#select2_sample1').select2({
placeholder: "Select an option",
allowClear: true
});
$('#select2_sample2').select2({
placeholder: "Select a State",
allowClear: true
});
$("#select2_sample3").select2({
placeholder: "Select...",
allowClear: true,
minimumInputLength: 1,
query: function (query) {
var data = {
results: []
}, i, j, s;
for (i = 1; i < 5; i++) {
s = "";
for (j = 0; j < i; j++) {
s = s + query.term;
}
data.results.push({
id: query.term + i,
text: s
});
}
query.callback(data);
}
});
function format(state) {
if (!state.id) return state.text; // optgroup
return "<img class='flag' src='" + App.getGlobalImgPath() + "flags/" + state.id.toLowerCase() + ".png'/>&nbsp;&nbsp;" + state.text;
}
$("#select2_sample4").select2({
placeholder: "Select a Country",
allowClear: true,
formatResult: format,
formatSelection: format,
escapeMarkup: function (m) {
return m;
}
});
$("#select2_sample5").select2({
tags: ["red", "green", "blue", "yellow", "pink"]
});
function movieFormatResult(movie) {
var markup = "<table class='movie-result'><tr>";
if (movie.posters !== undefined && movie.posters.thumbnail !== undefined) {
markup += "<td valign='top'><img src='" + movie.posters.thumbnail + "'/></td>";
}
markup += "<td valign='top'><h5>" + movie.title + "</h5>";
if (movie.critics_consensus !== undefined) {
markup += "<div class='movie-synopsis'>" + movie.critics_consensus + "</div>";
} else if (movie.synopsis !== undefined) {
markup += "<div class='movie-synopsis'>" + movie.synopsis + "</div>";
}
markup += "</td></tr></table>"
return markup;
}
function movieFormatSelection(movie) {
return movie.title;
}
$("#select2_sample6").select2({
placeholder: "Search for a movie",
minimumInputLength: 1,
ajax: { // instead of writing the function to execute the request we use Select2's convenient helper
url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json",
dataType: 'jsonp',
data: function (term, page) {
return {
q: term, // search term
page_limit: 10,
apikey: "ju6z9mjyajq2djue3gbvv26t" // please do not use so this example keeps working
};
},
results: function (data, page) { // parse the results into the format expected by Select2.
// since we are using custom formatting functions we do not need to alter remote JSON data
return {
results: data.movies
};
}
},
initSelection: function (element, callback) {
// the input tag has a value attribute preloaded that points to a preselected movie's id
// this function resolves that id attribute to an object that select2 can render
// using its formatResult renderer - that way the movie name is shown preselected
var id = $(element).val();
if (id !== "") {
$.ajax("http://api.rottentomatoes.com/api/public/v1.0/movies/" + id + ".json", {
data: {
apikey: "ju6z9mjyajq2djue3gbvv26t"
},
dataType: "jsonp"
}).done(function (data) {
callback(data);
});
}
},
formatResult: movieFormatResult, // omitted for brevity, see the source of this page
formatSelection: movieFormatSelection, // omitted for brevity, see the source of this page
dropdownCssClass: "bigdrop", // apply css that makes the dropdown taller
escapeMarkup: function (m) {
return m;
} // we do not want to escape markup since we are displaying html in results
});
}
var handleSelect2Modal = function () {
$('#select2_sample_modal_1').select2({
placeholder: "Select an option",
allowClear: true
});
$('#select2_sample_modal_2').select2({
placeholder: "Select a State",
allowClear: true
});
$("#select2_sample_modal_3").select2({
allowClear: true,
minimumInputLength: 1,
query: function (query) {
var data = {
results: []
}, i, j, s;
for (i = 1; i < 5; i++) {
s = "";
for (j = 0; j < i; j++) {
s = s + query.term;
}
data.results.push({
id: query.term + i,
text: s
});
}
query.callback(data);
}
});
function format(state) {
if (!state.id) return state.text; // optgroup
return "<img class='flag' src='" + App.getGlobalImgPath() + "flags/" + state.id.toLowerCase() + ".png'/>&nbsp;&nbsp;" + state.text;
}
$("#select2_sample_modal_4").select2({
allowClear: true,
formatResult: format,
formatSelection: format,
escapeMarkup: function (m) {
return m;
}
});
$("#select2_sample_modal_5").select2({
tags: ["red", "green", "blue", "yellow", "pink"]
});
function movieFormatResult(movie) {
var markup = "<table class='movie-result'><tr>";
if (movie.posters !== undefined && movie.posters.thumbnail !== undefined) {
markup += "<td valign='top'><img src='" + movie.posters.thumbnail + "'/></td>";
}
markup += "<td valign='top'><h5>" + movie.title + "</h5>";
if (movie.critics_consensus !== undefined) {
markup += "<div class='movie-synopsis'>" + movie.critics_consensus + "</div>";
} else if (movie.synopsis !== undefined) {
markup += "<div class='movie-synopsis'>" + movie.synopsis + "</div>";
}
markup += "</td></tr></table>"
return markup;
}
function movieFormatSelection(movie) {
return movie.title;
}
$("#select2_sample_modal_6").select2({
placeholder: "Search for a movie",
minimumInputLength: 1,
ajax: { // instead of writing the function to execute the request we use Select2's convenient helper
url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json",
dataType: 'jsonp',
data: function (term, page) {
return {
q: term, // search term
page_limit: 10,
apikey: "ju6z9mjyajq2djue3gbvv26t" // please do not use so this example keeps working
};
},
results: function (data, page) { // parse the results into the format expected by Select2.
// since we are using custom formatting functions we do not need to alter remote JSON data
return {
results: data.movies
};
}
},
initSelection: function (element, callback) {
// the input tag has a value attribute preloaded that points to a preselected movie's id
// this function resolves that id attribute to an object that select2 can render
// using its formatResult renderer - that way the movie name is shown preselected
var id = $(element).val();
if (id !== "") {
$.ajax("http://api.rottentomatoes.com/api/public/v1.0/movies/" + id + ".json", {
data: {
apikey: "ju6z9mjyajq2djue3gbvv26t"
},
dataType: "jsonp"
}).done(function (data) {
callback(data);
});
}
},
formatResult: movieFormatResult, // omitted for brevity, see the source of this page
formatSelection: movieFormatSelection, // omitted for brevity, see the source of this page
dropdownCssClass: "bigdrop", // apply css that makes the dropdown taller
escapeMarkup: function (m) {
return m;
} // we do not want to escape markup since we are displaying html in results
});
}
var handleBootstrapSelect = function() {
$('.bs-select').selectpicker({
iconBase: 'fa',
tickIcon: 'fa-check'
});
}
var handleMultiSelect = function () {
$('#my_multi_select1').multiSelect();
$('#my_multi_select2').multiSelect({
selectableOptgroup: true
});
}
return {
//main function to initiate the module
init: function () {
handleSelect2();
handleSelect2Modal();
handleMultiSelect();
handleBootstrapSelect();
}
};
}();
jQuery(document).ready(function() {
ComponentsDropdowns.init();
});
+1
View File
@@ -0,0 +1 @@
var ComponentsDropdowns=function(){var e=function(){function e(e){return e.id?"<img class='flag' src='"+App.getGlobalImgPath()+"flags/"+e.id.toLowerCase()+".png'/>&nbsp;&nbsp;"+e.text:e.text}function t(e){var t="<table class='movie-result'><tr>";return void 0!==e.posters&&void 0!==e.posters.thumbnail&&(t+="<td valign='top'><img src='"+e.posters.thumbnail+"'/></td>"),t+="<td valign='top'><h5>"+e.title+"</h5>",void 0!==e.critics_consensus?t+="<div class='movie-synopsis'>"+e.critics_consensus+"</div>":void 0!==e.synopsis&&(t+="<div class='movie-synopsis'>"+e.synopsis+"</div>"),t+="</td></tr></table>"}function s(e){return e.title}$("#select2_sample1").select2({placeholder:"Select an option",allowClear:!0}),$("#select2_sample2").select2({placeholder:"Select a State",allowClear:!0}),$("#select2_sample3").select2({placeholder:"Select...",allowClear:!0,minimumInputLength:1,query:function(e){var t,s,l,o={results:[]};for(t=1;t<5;t++){for(l="",s=0;s<t;s++)l+=e.term;o.results.push({id:e.term+t,text:l})}e.callback(o)}}),$("#select2_sample4").select2({placeholder:"Select a Country",allowClear:!0,formatResult:e,formatSelection:e,escapeMarkup:function(e){return e}}),$("#select2_sample5").select2({tags:["red","green","blue","yellow","pink"]}),$("#select2_sample6").select2({placeholder:"Search for a movie",minimumInputLength:1,ajax:{url:"http://api.rottentomatoes.com/api/public/v1.0/movies.json",dataType:"jsonp",data:function(e,t){return{q:e,page_limit:10,apikey:"ju6z9mjyajq2djue3gbvv26t"}},results:function(e,t){return{results:e.movies}}},initSelection:function(e,t){var s=$(e).val();""!==s&&$.ajax("http://api.rottentomatoes.com/api/public/v1.0/movies/"+s+".json",{data:{apikey:"ju6z9mjyajq2djue3gbvv26t"},dataType:"jsonp"}).done(function(e){t(e)})},formatResult:t,formatSelection:s,dropdownCssClass:"bigdrop",escapeMarkup:function(e){return e}})},t=function(){function e(e){return e.id?"<img class='flag' src='"+App.getGlobalImgPath()+"flags/"+e.id.toLowerCase()+".png'/>&nbsp;&nbsp;"+e.text:e.text}function t(e){var t="<table class='movie-result'><tr>";return void 0!==e.posters&&void 0!==e.posters.thumbnail&&(t+="<td valign='top'><img src='"+e.posters.thumbnail+"'/></td>"),t+="<td valign='top'><h5>"+e.title+"</h5>",void 0!==e.critics_consensus?t+="<div class='movie-synopsis'>"+e.critics_consensus+"</div>":void 0!==e.synopsis&&(t+="<div class='movie-synopsis'>"+e.synopsis+"</div>"),t+="</td></tr></table>"}function s(e){return e.title}$("#select2_sample_modal_1").select2({placeholder:"Select an option",allowClear:!0}),$("#select2_sample_modal_2").select2({placeholder:"Select a State",allowClear:!0}),$("#select2_sample_modal_3").select2({allowClear:!0,minimumInputLength:1,query:function(e){var t,s,l,o={results:[]};for(t=1;t<5;t++){for(l="",s=0;s<t;s++)l+=e.term;o.results.push({id:e.term+t,text:l})}e.callback(o)}}),$("#select2_sample_modal_4").select2({allowClear:!0,formatResult:e,formatSelection:e,escapeMarkup:function(e){return e}}),$("#select2_sample_modal_5").select2({tags:["red","green","blue","yellow","pink"]}),$("#select2_sample_modal_6").select2({placeholder:"Search for a movie",minimumInputLength:1,ajax:{url:"http://api.rottentomatoes.com/api/public/v1.0/movies.json",dataType:"jsonp",data:function(e,t){return{q:e,page_limit:10,apikey:"ju6z9mjyajq2djue3gbvv26t"}},results:function(e,t){return{results:e.movies}}},initSelection:function(e,t){var s=$(e).val();""!==s&&$.ajax("http://api.rottentomatoes.com/api/public/v1.0/movies/"+s+".json",{data:{apikey:"ju6z9mjyajq2djue3gbvv26t"},dataType:"jsonp"}).done(function(e){t(e)})},formatResult:t,formatSelection:s,dropdownCssClass:"bigdrop",escapeMarkup:function(e){return e}})},s=function(){$(".bs-select").selectpicker({iconBase:"fa",tickIcon:"fa-check"})},l=function(){$("#my_multi_select1").multiSelect(),$("#my_multi_select2").multiSelect({selectableOptgroup:!0})};return{init:function(){e(),t(),l(),s()}}}();jQuery(document).ready(function(){ComponentsDropdowns.init()});
@@ -0,0 +1,308 @@
var ComponentsNoUiSliders = function() {
var demo2 = function() {
var connectSlider = document.getElementById('demo2');
noUiSlider.create(connectSlider, {
start: [20],
connect: false,
range: {
'min': 0,
'max': 100
}
});
}
var demo3 = function() {
var connectSlider = document.getElementById('demo3');
noUiSlider.create(connectSlider, {
start: [20, 80],
connect: false,
range: {
'min': 0,
'max': 100
}
});
var connectBar = document.createElement('div'),
connectBase = connectSlider.getElementsByClassName('noUi-base')[0],
connectHandles = connectSlider.getElementsByClassName('noUi-origin');
// Give the bar a class for styling and add it to the slider.
connectBar.className += 'connect';
connectBase.appendChild(connectBar);
connectSlider.noUiSlider.on('update', function( values, handle ) {
// Pick left for the first handle, right for the second.
var side = handle ? 'right' : 'left',
// Get the handle position and trim the '%' sign.
offset = (connectHandles[handle].style.left).slice(0, - 1);
// Right offset is 100% - left offset
if ( handle === 1 ) {
offset = 100 - offset;
}
connectBar.style[side] = offset + '%';
});
}
var demo4 = function() {
//** init the select
var select = document.getElementById('demo4_select');
// Append the option elements
for ( var i = -20; i <= 40; i++ ) {
var option = document.createElement("option");
option.text = i;
option.value = i;
select.appendChild(option);
}
//** init the slider
var html5Slider = document.getElementById('demo4');
noUiSlider.create(html5Slider, {
start: [ 10, 30 ],
connect: true,
range: {
'min': -20,
'max': 40
}
});
//** init the input
var inputNumber = document.getElementById('demo4_input');
html5Slider.noUiSlider.on('update', function( values, handle ) {
var value = values[handle];
if ( handle ) {
inputNumber.value = value;
} else {
select.value = Math.round(value);
}
});
select.addEventListener('change', function(){
html5Slider.noUiSlider.set([this.value, null]);
});
inputNumber.addEventListener('change', function(){
html5Slider.noUiSlider.set([null, this.value]);
});
}
var demo5 = function() {
var nonLinearSlider = document.getElementById('demo5');
noUiSlider.create(nonLinearSlider, {
connect: true,
behaviour: 'tap',
start: [ 500, 4000 ],
range: {
// Starting at 500, step the value by 500,
// until 4000 is reached. From there, step by 1000.
'min': [ 0 ],
'10%': [ 500, 500 ],
'50%': [ 4000, 1000 ],
'max': [ 10000 ]
}
});
// Write the CSS 'left' value to a span.
function leftValue ( handle ) {
return handle.parentElement.style.left;
}
var lowerValue = document.getElementById('demo5_lower-value'),
upperValue = document.getElementById('demo5_upper-value'),
handles = nonLinearSlider.getElementsByClassName('noUi-handle');
// Display the slider value and how far the handle moved
// from the left edge of the slider.
nonLinearSlider.noUiSlider.on('update', function ( values, handle ) {
if ( !handle ) {
lowerValue.innerHTML = values[handle] + ', ' + leftValue(handles[handle]);
} else {
upperValue.innerHTML = values[handle] + ', ' + leftValue(handles[handle]);
}
});
}
var demo6 = function() {
// Store the locked state and slider values.
var lockedState = false,
lockedSlider = false,
lockedValues = [60, 80],
slider1 = document.getElementById('demo6_slider1'),
slider2 = document.getElementById('demo6_slider2'),
lockButton = document.getElementById('demo6_lockbutton'),
slider1Value = document.getElementById('demo6_slider1-span'),
slider2Value = document.getElementById('demo6_slider2-span');
// When the button is clicked, the locked
// state is inverted.
lockButton.addEventListener('click', function(){
lockedState = !lockedState;
this.textContent = lockedState ? 'unlock' : 'lock';
});
function crossUpdate ( value, slider ) {
// If the sliders aren't interlocked, don't
// cross-update.
if ( !lockedState ) return;
// Select whether to increase or decrease
// the other slider value.
var a = slider1 === slider ? 0 : 1, b = a ? 0 : 1;
// Offset the slider value.
value -= lockedValues[b] - lockedValues[a];
// Set the value
slider.noUiSlider.set(value);
}
noUiSlider.create(slider1, {
start: 60,
// Disable animation on value-setting,
// so the sliders respond immediately.
animate: false,
range: {
min: 50,
max: 100
}
});
noUiSlider.create(slider2, {
start: 80,
animate: false,
range: {
min: 50,
max: 100
}
});
slider1.noUiSlider.on('update', function( values, handle ){
slider1Value.innerHTML = values[handle];
});
slider2.noUiSlider.on('update', function( values, handle ){
slider2Value.innerHTML = values[handle];
});
function setLockedValues ( ) {
lockedValues = [
Number(slider1.noUiSlider.get()),
Number(slider2.noUiSlider.get())
];
}
slider1.noUiSlider.on('change', setLockedValues);
slider2.noUiSlider.on('change', setLockedValues);
// The value will be send to the other slider,
// using a custom function as the serialization
// method. The function uses the global 'lockedState'
// variable to decide whether the other slider is updated.
slider1.noUiSlider.on('slide', function( values, handle ){
crossUpdate(values[handle], slider2);
});
slider2.noUiSlider.on('slide', function( values, handle ){
crossUpdate(values[handle], slider1);
});
}
var demo7 = function() {
var softSlider = document.getElementById('demo7');
noUiSlider.create(softSlider, {
start: 50,
range: {
min: 0,
max: 100
},
pips: {
mode: 'values',
values: [20, 80],
density: 4
}
});
softSlider.noUiSlider.on('change', function ( values, handle ) {
if ( values[handle] < 20 ) {
softSlider.noUiSlider.set(20);
} else if ( values[handle] > 80 ) {
softSlider.noUiSlider.set(80);
}
});
}
var demo8 = function() {
var tooltipSlider = document.getElementById('demo8');
noUiSlider.create(tooltipSlider, {
start: [40, 50],
connect: true,
range: {
'min': 30,
'30%': 40,
'max': 50
}
});
var tipHandles = tooltipSlider.getElementsByClassName('noUi-handle'),
tooltips = [];
// Add divs to the slider handles.
for ( var i = 0; i < tipHandles.length; i++ ){
tooltips[i] = document.createElement('div');
tipHandles[i].appendChild(tooltips[i]);
}
// Add a class for styling
tooltips[1].className += 'noUi-tooltip';
// Add additional markup
tooltips[1].innerHTML = '<strong>Value: </strong><span></span>';
// Replace the tooltip reference with the span we just added
tooltips[1] = tooltips[1].getElementsByTagName('span')[0];
// Add a class for styling
tooltips[0].className += 'noUi-tooltip';
// Add additional markup
tooltips[0].innerHTML = '<strong>Value: </strong><span></span>';
// Replace the tooltip reference with the span we just added
tooltips[0] = tooltips[0].getElementsByTagName('span')[0];
// When the slider changes, write the value to the tooltips.
tooltipSlider.noUiSlider.on('update', function( values, handle ){
tooltips[handle].innerHTML = values[handle];
});
}
return {
//main function to initiate the module
init: function() {
demo2();
demo3();
demo4();
demo5();
demo6();
demo7();
demo8();
}
};
}();
jQuery(document).ready(function() {
ComponentsNoUiSliders.init();
});
+1
View File
@@ -0,0 +1 @@
var ComponentsNoUiSliders=function(){var e=function(){var e=document.getElementById("demo2");noUiSlider.create(e,{start:[20],connect:!1,range:{min:0,max:100}})},n=function(){var e=document.getElementById("demo3");noUiSlider.create(e,{start:[20,80],connect:!1,range:{min:0,max:100}});var n=document.createElement("div"),t=e.getElementsByClassName("noUi-base")[0],i=e.getElementsByClassName("noUi-origin");n.className+="connect",t.appendChild(n),e.noUiSlider.on("update",function(e,t){var o=t?"right":"left",a=i[t].style.left.slice(0,-1);1===t&&(a=100-a),n.style[o]=a+"%"})},t=function(){for(var e=document.getElementById("demo4_select"),n=-20;n<=40;n++){var t=document.createElement("option");t.text=n,t.value=n,e.appendChild(t)}var i=document.getElementById("demo4");noUiSlider.create(i,{start:[10,30],connect:!0,range:{min:-20,max:40}});var o=document.getElementById("demo4_input");i.noUiSlider.on("update",function(n,t){var i=n[t];t?o.value=i:e.value=Math.round(i)}),e.addEventListener("change",function(){i.noUiSlider.set([this.value,null])}),o.addEventListener("change",function(){i.noUiSlider.set([null,this.value])})},i=function(){function e(e){return e.parentElement.style.left}var n=document.getElementById("demo5");noUiSlider.create(n,{connect:!0,behaviour:"tap",start:[500,4e3],range:{min:[0],"10%":[500,500],"50%":[4e3,1e3],max:[1e4]}});var t=document.getElementById("demo5_lower-value"),i=document.getElementById("demo5_upper-value"),o=n.getElementsByClassName("noUi-handle");n.noUiSlider.on("update",function(n,a){a?i.innerHTML=n[a]+", "+e(o[a]):t.innerHTML=n[a]+", "+e(o[a])})},o=function(){function e(e,n){if(t){var a=o===n?0:1,d=a?0:1;e-=i[d]-i[a],n.noUiSlider.set(e)}}function n(){i=[Number(o.noUiSlider.get()),Number(a.noUiSlider.get())]}var t=!1,i=[60,80],o=document.getElementById("demo6_slider1"),a=document.getElementById("demo6_slider2"),d=document.getElementById("demo6_lockbutton"),r=document.getElementById("demo6_slider1-span"),l=document.getElementById("demo6_slider2-span");d.addEventListener("click",function(){t=!t,this.textContent=t?"unlock":"lock"}),noUiSlider.create(o,{start:60,animate:!1,range:{min:50,max:100}}),noUiSlider.create(a,{start:80,animate:!1,range:{min:50,max:100}}),o.noUiSlider.on("update",function(e,n){r.innerHTML=e[n]}),a.noUiSlider.on("update",function(e,n){l.innerHTML=e[n]}),o.noUiSlider.on("change",n),a.noUiSlider.on("change",n),o.noUiSlider.on("slide",function(n,t){e(n[t],a)}),a.noUiSlider.on("slide",function(n,t){e(n[t],o)})},a=function(){var e=document.getElementById("demo7");noUiSlider.create(e,{start:50,range:{min:0,max:100},pips:{mode:"values",values:[20,80],density:4}}),e.noUiSlider.on("change",function(n,t){n[t]<20?e.noUiSlider.set(20):n[t]>80&&e.noUiSlider.set(80)})},d=function(){var e=document.getElementById("demo8");noUiSlider.create(e,{start:[40,50],connect:!0,range:{min:30,"30%":40,max:50}});for(var n=e.getElementsByClassName("noUi-handle"),t=[],i=0;i<n.length;i++)t[i]=document.createElement("div"),n[i].appendChild(t[i]);t[1].className+="noUi-tooltip",t[1].innerHTML="<strong>Value: </strong><span></span>",t[1]=t[1].getElementsByTagName("span")[0],t[0].className+="noUi-tooltip",t[0].innerHTML="<strong>Value: </strong><span></span>",t[0]=t[0].getElementsByTagName("span")[0],e.noUiSlider.on("update",function(e,n){t[n].innerHTML=e[n]})};return{init:function(){e(),n(),t(),i(),o(),a(),d()}}}();jQuery(document).ready(function(){ComponentsNoUiSliders.init()});
+152
View File
@@ -0,0 +1,152 @@
var ComponentsSelect2 = function() {
var handleDemo = function() {
// Set the "bootstrap" theme as the default theme for all Select2
// widgets.
//
// @see https://github.com/select2/select2/issues/2927
$.fn.select2.defaults.set("theme", "bootstrap");
var placeholder = "Select a State";
$(".select2, .select2-multiple").select2({
placeholder: placeholder,
width: null
});
$(".select2-allow-clear").select2({
allowClear: true,
placeholder: placeholder,
width: null
});
$(".qweqweqwe").select2({
placeholder: "Select a Forwarder",
escapeMarkup: function(markup) {
return markup;
}, // let our custom formatter work
templateResult: productStyles,
templateSelection: formatRepoSelections
});
function productStyles(repo) {
var markup = "<div class='select2-result-repository clearfix'>" +
"<div class='select2-result-repository__avatar'><img src='" + $(repo.element).data('thumb') + "' /></div>" +
"<div class='select2-result-repository__meta'>" +
"<div class='select2-result-repository__title'>" + $(repo.element).data('nama') + "</div>" +
"</div></div>";
return markup;
};
function formatRepoSelections(repo) {
var name = $(repo.element).data('nama');
return name;
}
// @see https://select2.github.io/examples.html#data-ajax
function formatRepo(repo) {
if (repo.loading) return repo.text;
var markup = "<div class='select2-result-repository clearfix'>" +
"<div class='select2-result-repository__avatar'><img src='" + repo.owner.avatar_url + "' /></div>" +
"<div class='select2-result-repository__meta'>" +
"<div class='select2-result-repository__title'>" + repo.full_name + "</div>";
if (repo.description) {
markup += "<div class='select2-result-repository__description'>" + repo.description + "</div>";
}
markup += "<div class='select2-result-repository__statistics'>" +
"<div class='select2-result-repository__forks'><span class='glyphicon glyphicon-flash'></span> " + repo.forks_count + " Forks</div>" +
"<div class='select2-result-repository__stargazers'><span class='glyphicon glyphicon-star'></span> " + repo.stargazers_count + " Stars</div>" +
"<div class='select2-result-repository__watchers'><span class='glyphicon glyphicon-eye-open'></span> " + repo.watchers_count + " Watchers</div>" +
"</div>" +
"</div></div>";
return markup;
}
function formatRepoSelection(repo) {
return repo.full_name || repo.text;
}
$(".js-data-example-ajax").select2({
width: "off",
ajax: {
url: "https://api.github.com/search/repositories",
dataType: 'json',
delay: 250,
data: function(params) {
return {
q: params.term, // search term
page: params.page
};
},
processResults: function(data, page) {
// parse the results into the format expected by Select2.
// since we are using custom formatting functions we do not need to
// alter the remote JSON data
return {
results: data.items
};
},
cache: true
},
escapeMarkup: function(markup) {
return markup;
}, // let our custom formatter work
minimumInputLength: 1,
templateResult: formatRepo,
templateSelection: formatRepoSelection
});
$("button[data-select2-open]").click(function() {
$("#" + $(this).data("select2-open")).select2("open");
});
$(":checkbox").on("click", function() {
$(this).parent().nextAll("select").prop("disabled", !this.checked);
});
// copy Bootstrap validation states to Select2 dropdown
//
// add .has-waring, .has-error, .has-succes to the Select2 dropdown
// (was #select2-drop in Select2 v3.x, in Select2 v4 can be selected via
// body > .select2-container) if _any_ of the opened Select2's parents
// has one of these forementioned classes (YUCK! ;-))
$(".select2, .select2-multiple, .select2-allow-clear, .js-data-example-ajax").on("select2:open", function() {
if ($(this).parents("[class*='has-']").length) {
var classNames = $(this).parents("[class*='has-']")[0].className.split(/\s+/);
for (var i = 0; i < classNames.length; ++i) {
if (classNames[i].match("has-")) {
$("body > .select2-container").addClass(classNames[i]);
}
}
}
});
$(".js-btn-set-scaling-classes").on("click", function() {
$("#select2-multiple-input-sm, #select2-single-input-sm").next(".select2-container--bootstrap").addClass("input-sm");
$("#select2-multiple-input-lg, #select2-single-input-lg").next(".select2-container--bootstrap").addClass("input-lg");
$(this).removeClass("btn-primary btn-outline").prop("disabled", true);
});
}
return {
//main function to initiate the module
init: function() {
handleDemo();
}
};
}();
if (App.isAngularJsApp() === false) {
jQuery(document).ready(function() {
ComponentsSelect2.init();
});
}
+1
View File
@@ -0,0 +1 @@
var ComponentsSelect2=function(){var e=function(){function e(e){if(e.loading)return e.text;var t="<div class='select2-result-repository clearfix'><div class='select2-result-repository__avatar'><img src='"+e.owner.avatar_url+"' /></div><div class='select2-result-repository__meta'><div class='select2-result-repository__title'>"+e.full_name+"</div>";return e.description&&(t+="<div class='select2-result-repository__description'>"+e.description+"</div>"),t+="<div class='select2-result-repository__statistics'><div class='select2-result-repository__forks'><span class='glyphicon glyphicon-flash'></span> "+e.forks_count+" Forks</div><div class='select2-result-repository__stargazers'><span class='glyphicon glyphicon-star'></span> "+e.stargazers_count+" Stars</div><div class='select2-result-repository__watchers'><span class='glyphicon glyphicon-eye-open'></span> "+e.watchers_count+" Watchers</div></div></div></div>"}function t(e){return e.full_name||e.text}$.fn.select2.defaults.set("theme","bootstrap");var s="Select a State";$(".select2, .select2-multiple").select2({placeholder:s,width:null}),$(".select2-allow-clear").select2({allowClear:!0,placeholder:s,width:null}),$(".js-data-example-ajax").select2({width:"off",ajax:{url:"https://api.github.com/search/repositories",dataType:"json",delay:250,data:function(e){return{q:e.term,page:e.page}},processResults:function(e,t){return{results:e.items}},cache:!0},escapeMarkup:function(e){return e},minimumInputLength:1,templateResult:e,templateSelection:t}),$("button[data-select2-open]").click(function(){$("#"+$(this).data("select2-open")).select2("open")}),$(":checkbox").on("click",function(){$(this).parent().nextAll("select").prop("disabled",!this.checked)}),$(".select2, .select2-multiple, .select2-allow-clear, .js-data-example-ajax").on("select2:open",function(){if($(this).parents("[class*='has-']").length)for(var e=$(this).parents("[class*='has-']")[0].className.split(/\s+/),t=0;t<e.length;++t)e[t].match("has-")&&$("body > .select2-container").addClass(e[t])}),$(".js-btn-set-scaling-classes").on("click",function(){$("#select2-multiple-input-sm, #select2-single-input-sm").next(".select2-container--bootstrap").addClass("input-sm"),$("#select2-multiple-input-lg, #select2-single-input-lg").next(".select2-container--bootstrap").addClass("input-lg"),$(this).removeClass("btn-primary btn-outline").prop("disabled",!0)})};return{init:function(){e()}}}();App.isAngularJsApp()===!1&&jQuery(document).ready(function(){ComponentsSelect2.init()});
@@ -0,0 +1,279 @@
var ComponentsTypeahead = function () {
var handleTwitterTypeahead = function() {
// Example #1
// instantiate the bloodhound suggestion engine
var numbers = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.num); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
local: [
{ num: 'metronic' },
{ num: 'keenthemes' },
{ num: 'metronic theme' },
{ num: 'metronic template' },
{ num: 'keenthemes team' }
]
});
// initialize the bloodhound suggestion engine
numbers.initialize();
// instantiate the typeahead UI
if (App.isRTL()) {
$('#typeahead_example_1').attr("dir", "rtl");
}
$('#typeahead_example_1').typeahead(null, {
displayKey: 'num',
hint: (App.isRTL() ? false : true),
source: numbers.ttAdapter()
});
// Example #2
var countries = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.name); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
limit: 10,
prefetch: {
url: '../demo/typeahead_countries.json',
filter: function(list) {
return $.map(list, function(country) { return { name: country }; });
}
}
});
countries.initialize();
if (App.isRTL()) {
$('#typeahead_example_2').attr("dir", "rtl");
}
$('#typeahead_example_2').typeahead(null, {
name: 'typeahead_example_2',
displayKey: 'name',
hint: (App.isRTL() ? false : true),
source: countries.ttAdapter()
});
// Example #3
var custom = new Bloodhound({
datumTokenizer: function(d) { return d.tokens; },
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: '../demo/typeahead_custom.php?query=%QUERY',
wildcard: '%QUERY'
}
});
custom.initialize();
if (App.isRTL()) {
$('#typeahead_example_3').attr("dir", "rtl");
}
$('#typeahead_example_3').typeahead(null, {
name: 'datypeahead_example_3',
displayKey: 'value',
source: custom.ttAdapter(),
hint: (App.isRTL() ? false : true),
templates: {
suggestion: Handlebars.compile([
'<div class="media">',
'<div class="pull-left">',
'<div class="media-object">',
'<img src="{{img}}" width="50" height="50"/>',
'</div>',
'</div>',
'<div class="media-body">',
'<h4 class="media-heading">{{value}}</h4>',
'<p>{{desc}}</p>',
'</div>',
'</div>',
].join(''))
}
});
// Example #4
var nba = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.team); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: '../demo/typeahead_nba.json'
});
var nhl = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.team); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: '../demo/typeahead_nhl.json'
});
nba.initialize();
nhl.initialize();
if (App.isRTL()) {
$('#typeahead_example_4').attr("dir", "rtl");
}
$('#typeahead_example_4').typeahead({
hint: (App.isRTL() ? false : true),
highlight: true
},
{
name: 'nba',
displayKey: 'team',
source: nba.ttAdapter(),
templates: {
header: '<h3>NBA Teams</h3>'
}
},
{
name: 'nhl',
displayKey: 'team',
source: nhl.ttAdapter(),
templates: {
header: '<h3>NHL Teams</h3>'
}
});
}
var handleTwitterTypeaheadModal = function() {
// Example #1
// instantiate the bloodhound suggestion engine
var numbers = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.num); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
local: [
{ num: 'metronic' },
{ num: 'keenthemes' },
{ num: 'metronic theme' },
{ num: 'metronic template' },
{ num: 'keenthemes team' }
]
});
// initialize the bloodhound suggestion engine
numbers.initialize();
// instantiate the typeahead UI
if (App.isRTL()) {
$('#typeahead_example_modal_1').attr("dir", "rtl");
}
$('#typeahead_example_modal_1').typeahead(null, {
displayKey: 'num',
hint: (App.isRTL() ? false : true),
source: numbers.ttAdapter()
});
// Example #2
var countries = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.name); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
limit: 10,
prefetch: {
url: '../demo/typeahead_countries.json',
filter: function(list) {
return $.map(list, function(country) { return { name: country }; });
}
}
});
countries.initialize();
if (App.isRTL()) {
$('#typeahead_example_modal_2').attr("dir", "rtl");
}
$('#typeahead_example_modal_2').typeahead(null, {
name: 'typeahead_example_modal_2',
displayKey: 'name',
hint: (App.isRTL() ? false : true),
source: countries.ttAdapter()
});
// Example #3
var custom = new Bloodhound({
datumTokenizer: function(d) { return d.tokens; },
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: '../demo/typeahead_custom.php?query=%QUERY'
});
custom.initialize();
if (App.isRTL()) {
$('#typeahead_example_modal_3').attr("dir", "rtl");
}
$('#typeahead_example_modal_3').typeahead(null, {
name: 'datypeahead_example_modal_3',
displayKey: 'value',
hint: (App.isRTL() ? false : true),
source: custom.ttAdapter(),
templates: {
suggestion: Handlebars.compile([
'<div class="media">',
'<div class="pull-left">',
'<div class="media-object">',
'<img src="{{img}}" width="50" height="50"/>',
'</div>',
'</div>',
'<div class="media-body">',
'<h4 class="media-heading">{{value}}</h4>',
'<p>{{desc}}</p>',
'</div>',
'</div>',
].join(''))
}
});
// Example #4
var nba = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.team); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
limit: 3,
prefetch: '../demo/typeahead_nba.json'
});
var nhl = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.team); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
limit: 3,
prefetch: '../demo/typeahead_nhl.json'
});
nba.initialize();
nhl.initialize();
$('#typeahead_example_modal_4').typeahead({
hint: (App.isRTL() ? false : true),
highlight: true
},
{
name: 'nba',
displayKey: 'team',
source: nba.ttAdapter(),
templates: {
header: '<h3>NBA Teams</h3>'
}
},
{
name: 'nhl',
displayKey: 'team',
source: nhl.ttAdapter(),
templates: {
header: '<h3>NHL Teams</h3>'
}
});
}
return {
//main function to initiate the module
init: function () {
handleTwitterTypeahead();
handleTwitterTypeaheadModal();
}
};
}();
jQuery(document).ready(function() {
ComponentsTypeahead.init();
});
+1
View File
@@ -0,0 +1 @@
var ComponentsTypeahead=function(){var e=function(){var e=new Bloodhound({datumTokenizer:function(e){return Bloodhound.tokenizers.whitespace(e.num)},queryTokenizer:Bloodhound.tokenizers.whitespace,local:[{num:"metronic"},{num:"keenthemes"},{num:"metronic theme"},{num:"metronic template"},{num:"keenthemes team"}]});e.initialize(),App.isRTL()&&$("#typeahead_example_1").attr("dir","rtl"),$("#typeahead_example_1").typeahead(null,{displayKey:"num",hint:!App.isRTL(),source:e.ttAdapter()});var t=new Bloodhound({datumTokenizer:function(e){return Bloodhound.tokenizers.whitespace(e.name)},queryTokenizer:Bloodhound.tokenizers.whitespace,limit:10,prefetch:{url:"../demo/typeahead_countries.json",filter:function(e){return $.map(e,function(e){return{name:e}})}}});t.initialize(),App.isRTL()&&$("#typeahead_example_2").attr("dir","rtl"),$("#typeahead_example_2").typeahead(null,{name:"typeahead_example_2",displayKey:"name",hint:!App.isRTL(),source:t.ttAdapter()});var a=new Bloodhound({datumTokenizer:function(e){return e.tokens},queryTokenizer:Bloodhound.tokenizers.whitespace,remote:{url:"../demo/typeahead_custom.php?query=%QUERY",wildcard:"%QUERY"}});a.initialize(),App.isRTL()&&$("#typeahead_example_3").attr("dir","rtl"),$("#typeahead_example_3").typeahead(null,{name:"datypeahead_example_3",displayKey:"value",source:a.ttAdapter(),hint:!App.isRTL(),templates:{suggestion:Handlebars.compile(['<div class="media">','<div class="pull-left">','<div class="media-object">','<img src="{{img}}" width="50" height="50"/>',"</div>","</div>",'<div class="media-body">','<h4 class="media-heading">{{value}}</h4>',"<p>{{desc}}</p>","</div>","</div>"].join(""))}});var n=new Bloodhound({datumTokenizer:function(e){return Bloodhound.tokenizers.whitespace(e.team)},queryTokenizer:Bloodhound.tokenizers.whitespace,prefetch:"../demo/typeahead_nba.json"}),i=new Bloodhound({datumTokenizer:function(e){return Bloodhound.tokenizers.whitespace(e.team)},queryTokenizer:Bloodhound.tokenizers.whitespace,prefetch:"../demo/typeahead_nhl.json"});n.initialize(),i.initialize(),App.isRTL()&&$("#typeahead_example_4").attr("dir","rtl"),$("#typeahead_example_4").typeahead({hint:!App.isRTL(),highlight:!0},{name:"nba",displayKey:"team",source:n.ttAdapter(),templates:{header:"<h3>NBA Teams</h3>"}},{name:"nhl",displayKey:"team",source:i.ttAdapter(),templates:{header:"<h3>NHL Teams</h3>"}})},t=function(){var e=new Bloodhound({datumTokenizer:function(e){return Bloodhound.tokenizers.whitespace(e.num)},queryTokenizer:Bloodhound.tokenizers.whitespace,local:[{num:"metronic"},{num:"keenthemes"},{num:"metronic theme"},{num:"metronic template"},{num:"keenthemes team"}]});e.initialize(),App.isRTL()&&$("#typeahead_example_modal_1").attr("dir","rtl"),$("#typeahead_example_modal_1").typeahead(null,{displayKey:"num",hint:!App.isRTL(),source:e.ttAdapter()});var t=new Bloodhound({datumTokenizer:function(e){return Bloodhound.tokenizers.whitespace(e.name)},queryTokenizer:Bloodhound.tokenizers.whitespace,limit:10,prefetch:{url:"../demo/typeahead_countries.json",filter:function(e){return $.map(e,function(e){return{name:e}})}}});t.initialize(),App.isRTL()&&$("#typeahead_example_modal_2").attr("dir","rtl"),$("#typeahead_example_modal_2").typeahead(null,{name:"typeahead_example_modal_2",displayKey:"name",hint:!App.isRTL(),source:t.ttAdapter()});var a=new Bloodhound({datumTokenizer:function(e){return e.tokens},queryTokenizer:Bloodhound.tokenizers.whitespace,remote:"../demo/typeahead_custom.php?query=%QUERY"});a.initialize(),App.isRTL()&&$("#typeahead_example_modal_3").attr("dir","rtl"),$("#typeahead_example_modal_3").typeahead(null,{name:"datypeahead_example_modal_3",displayKey:"value",hint:!App.isRTL(),source:a.ttAdapter(),templates:{suggestion:Handlebars.compile(['<div class="media">','<div class="pull-left">','<div class="media-object">','<img src="{{img}}" width="50" height="50"/>',"</div>","</div>",'<div class="media-body">','<h4 class="media-heading">{{value}}</h4>',"<p>{{desc}}</p>","</div>","</div>"].join(""))}});var n=new Bloodhound({datumTokenizer:function(e){return Bloodhound.tokenizers.whitespace(e.team)},queryTokenizer:Bloodhound.tokenizers.whitespace,limit:3,prefetch:"../demo/typeahead_nba.json"}),i=new Bloodhound({datumTokenizer:function(e){return Bloodhound.tokenizers.whitespace(e.team)},queryTokenizer:Bloodhound.tokenizers.whitespace,limit:3,prefetch:"../demo/typeahead_nhl.json"});n.initialize(),i.initialize(),$("#typeahead_example_modal_4").typeahead({hint:!App.isRTL(),highlight:!0},{name:"nba",displayKey:"team",source:n.ttAdapter(),templates:{header:"<h3>NBA Teams</h3>"}},{name:"nhl",displayKey:"team",source:i.ttAdapter(),templates:{header:"<h3>NHL Teams</h3>"}})};return{init:function(){e(),t()}}}();jQuery(document).ready(function(){ComponentsTypeahead.init()});
+32
View File
@@ -0,0 +1,32 @@
var Contact = function () {
return {
//main function to initiate the module
init: function () {
var map;
$(document).ready(function(){
map = new GMaps({
div: '#gmapbg',
lat: -13.004333,
lng: -38.494333
});
var marker = map.addMarker({
lat: -13.004333,
lng: -38.494333,
title: 'Loop, Inc.',
infoWindow: {
content: "<b>Metronic, Inc.</b> 795 Park Ave, Suite 120<br>San Francisco, CA 94107"
}
});
marker.infoWindow.open(map, marker);
});
}
};
}();
jQuery(document).ready(function() {
Contact.init();
});
+1
View File
@@ -0,0 +1 @@
var Contact=function(){return{init:function(){var n;$(document).ready(function(){n=new GMaps({div:"#gmapbg",lat:-13.004333,lng:-38.494333});var t=n.addMarker({lat:-13.004333,lng:-38.494333,title:"Loop, Inc.",infoWindow:{content:"<b>Metronic, Inc.</b> 795 Park Ave, Suite 120<br>San Francisco, CA 94107"}});t.infoWindow.open(n,t)})}}}();jQuery(document).ready(function(){Contact.init()});
+36
View File
@@ -0,0 +1,36 @@
/**
Custom module for you to write your own javascript functions
**/
var Custom = function () {
// private functions & variables
var myFunc = function(text) {
alert(text);
}
// public functions
return {
//main function
init: function () {
//initialize here something.
},
//some helper function
doSomeStuff: function () {
myFunc();
}
};
}();
jQuery(document).ready(function() {
Custom.init();
});
/***
Usage
***/
//Custom.doSomeStuff();
+1
View File
@@ -0,0 +1 @@
var Custom=function(){var n=function(n){alert(n)};return{init:function(){},doSomeStuff:function(){n()}}}();jQuery(document).ready(function(){Custom.init()});
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+236
View File
@@ -0,0 +1,236 @@
var EcommerceDashboard = function() {
function showTooltip(x, y, labelX, labelY) {
$('<div id="tooltip" class="chart-tooltip">' + (labelY.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,')) + 'USD<\/div>').css({
position: 'absolute',
display: 'none',
top: y - 40,
left: x - 60,
border: '0px solid #ccc',
padding: '2px 6px',
'background-color': '#fff'
}).appendTo("body").fadeIn(200);
}
var initChart1 = function() {
var data = [
['01/2013', 4],
['02/2013', 8],
['03/2013', 10],
['04/2013', 12],
['05/2013', 2125],
['06/2013', 324],
['07/2013', 1223],
['08/2013', 1365],
['09/2013', 250],
['10/2013', 999],
['11/2013', 390]
];
var plot_statistics = $.plot(
$("#statistics_1"), [{
data: data,
lines: {
fill: 0.6,
lineWidth: 0
},
color: ['#f89f9f']
}, {
data: data,
points: {
show: true,
fill: true,
radius: 5,
fillColor: "#f89f9f",
lineWidth: 3
},
color: '#fff',
shadowSize: 0
}], {
xaxis: {
tickLength: 0,
tickDecimals: 0,
mode: "categories",
min: 2,
font: {
lineHeight: 15,
style: "normal",
variant: "small-caps",
color: "#6F7B8A"
}
},
yaxis: {
ticks: 3,
tickDecimals: 0,
tickColor: "#f0f0f0",
font: {
lineHeight: 15,
style: "normal",
variant: "small-caps",
color: "#6F7B8A"
}
},
grid: {
backgroundColor: {
colors: ["#fff", "#fff"]
},
borderWidth: 1,
borderColor: "#f0f0f0",
margin: 0,
minBorderMargin: 0,
labelMargin: 20,
hoverable: true,
clickable: true,
mouseActiveRadius: 6
},
legend: {
show: false
}
}
);
var previousPoint = null;
$("#statistics_1").bind("plothover", function(event, pos, item) {
$("#x").text(pos.x.toFixed(2));
$("#y").text(pos.y.toFixed(2));
if (item) {
if (previousPoint != item.dataIndex) {
previousPoint = item.dataIndex;
$("#tooltip").remove();
var x = item.datapoint[0].toFixed(2),
y = item.datapoint[1].toFixed(2);
showTooltip(item.pageX, item.pageY, item.datapoint[0], item.datapoint[1]);
}
} else {
$("#tooltip").remove();
previousPoint = null;
}
});
}
var initChart2 = function() {
var data = [
['01/2013', 10],
['02/2013', 0],
['03/2013', 10],
['04/2013', 12],
['05/2013', 212],
['06/2013', 324],
['07/2013', 122],
['08/2013', 136],
['09/2013', 250],
['10/2013', 99],
['11/2013', 190]
];
var plot_statistics = $.plot(
$("#statistics_2"), [{
data: data,
lines: {
fill: 0.6,
lineWidth: 0
},
color: ['#BAD9F5']
}, {
data: data,
points: {
show: true,
fill: true,
radius: 5,
fillColor: "#BAD9F5",
lineWidth: 3
},
color: '#fff',
shadowSize: 0
}], {
xaxis: {
tickLength: 0,
tickDecimals: 0,
mode: "categories",
min: 2,
font: {
lineHeight: 14,
style: "normal",
variant: "small-caps",
color: "#6F7B8A"
}
},
yaxis: {
ticks: 3,
tickDecimals: 0,
tickColor: "#f0f0f0",
font: {
lineHeight: 14,
style: "normal",
variant: "small-caps",
color: "#6F7B8A"
}
},
grid: {
backgroundColor: {
colors: ["#fff", "#fff"]
},
borderWidth: 1,
borderColor: "#f0f0f0",
margin: 0,
minBorderMargin: 0,
labelMargin: 20,
hoverable: true,
clickable: true,
mouseActiveRadius: 6
},
legend: {
show: false
}
}
);
var previousPoint = null;
$("#statistics_2").bind("plothover", function(event, pos, item) {
$("#x").text(pos.x.toFixed(2));
$("#y").text(pos.y.toFixed(2));
if (item) {
if (previousPoint != item.dataIndex) {
previousPoint = item.dataIndex;
$("#tooltip").remove();
var x = item.datapoint[0].toFixed(2),
y = item.datapoint[1].toFixed(2);
showTooltip(item.pageX, item.pageY, item.datapoint[0], item.datapoint[1]);
}
} else {
$("#tooltip").remove();
previousPoint = null;
}
});
}
return {
//main function
init: function() {
initChart1();
$('#statistics_orders_tab').on('shown.bs.tab', function(e) {
initChart2();
});
}
};
}();
jQuery(document).ready(function() {
EcommerceDashboard.init();
});
+1
View File
@@ -0,0 +1 @@
var EcommerceDashboard=function(){function o(o,i,t,a){$('<div id="tooltip" class="chart-tooltip">'+a.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g,"$1,")+"USD</div>").css({position:"absolute",display:"none",top:i-40,left:o-60,border:"0px solid #ccc",padding:"2px 6px","background-color":"#fff"}).appendTo("body").fadeIn(200)}var i=function(){var i=[["01/2013",4],["02/2013",8],["03/2013",10],["04/2013",12],["05/2013",2125],["06/2013",324],["07/2013",1223],["08/2013",1365],["09/2013",250],["10/2013",999],["11/2013",390]],t=($.plot($("#statistics_1"),[{data:i,lines:{fill:.6,lineWidth:0},color:["#f89f9f"]},{data:i,points:{show:!0,fill:!0,radius:5,fillColor:"#f89f9f",lineWidth:3},color:"#fff",shadowSize:0}],{xaxis:{tickLength:0,tickDecimals:0,mode:"categories",min:2,font:{lineHeight:15,style:"normal",variant:"small-caps",color:"#6F7B8A"}},yaxis:{ticks:3,tickDecimals:0,tickColor:"#f0f0f0",font:{lineHeight:15,style:"normal",variant:"small-caps",color:"#6F7B8A"}},grid:{backgroundColor:{colors:["#fff","#fff"]},borderWidth:1,borderColor:"#f0f0f0",margin:0,minBorderMargin:0,labelMargin:20,hoverable:!0,clickable:!0,mouseActiveRadius:6},legend:{show:!1}}),null);$("#statistics_1").bind("plothover",function(i,a,e){if($("#x").text(a.x.toFixed(2)),$("#y").text(a.y.toFixed(2)),e){if(t!=e.dataIndex){t=e.dataIndex,$("#tooltip").remove();e.datapoint[0].toFixed(2),e.datapoint[1].toFixed(2);o(e.pageX,e.pageY,e.datapoint[0],e.datapoint[1])}}else $("#tooltip").remove(),t=null})},t=function(){var i=[["01/2013",10],["02/2013",0],["03/2013",10],["04/2013",12],["05/2013",212],["06/2013",324],["07/2013",122],["08/2013",136],["09/2013",250],["10/2013",99],["11/2013",190]],t=($.plot($("#statistics_2"),[{data:i,lines:{fill:.6,lineWidth:0},color:["#BAD9F5"]},{data:i,points:{show:!0,fill:!0,radius:5,fillColor:"#BAD9F5",lineWidth:3},color:"#fff",shadowSize:0}],{xaxis:{tickLength:0,tickDecimals:0,mode:"categories",min:2,font:{lineHeight:14,style:"normal",variant:"small-caps",color:"#6F7B8A"}},yaxis:{ticks:3,tickDecimals:0,tickColor:"#f0f0f0",font:{lineHeight:14,style:"normal",variant:"small-caps",color:"#6F7B8A"}},grid:{backgroundColor:{colors:["#fff","#fff"]},borderWidth:1,borderColor:"#f0f0f0",margin:0,minBorderMargin:0,labelMargin:20,hoverable:!0,clickable:!0,mouseActiveRadius:6},legend:{show:!1}}),null);$("#statistics_2").bind("plothover",function(i,a,e){if($("#x").text(a.x.toFixed(2)),$("#y").text(a.y.toFixed(2)),e){if(t!=e.dataIndex){t=e.dataIndex,$("#tooltip").remove();e.datapoint[0].toFixed(2),e.datapoint[1].toFixed(2);o(e.pageX,e.pageY,e.datapoint[0],e.datapoint[1])}}else $("#tooltip").remove(),t=null})};return{init:function(){i(),$("#statistics_orders_tab").on("shown.bs.tab",function(o){t()})}}}();jQuery(document).ready(function(){EcommerceDashboard.init()});
@@ -0,0 +1,237 @@
var EcommerceOrdersView = function () {
var handleInvoices = function () {
var grid = new Datatable();
grid.init({
src: $("#datatable_invoices"),
onSuccess: function (grid) {
// execute some code after table records loaded
},
onError: function (grid) {
// execute some code on network or other general error
},
loadingMessage: 'Loading...',
dataTable: { // here you can define a typical datatable settings from http://datatables.net/usage/options
// Uncomment below line("dom" parameter) to fix the dropdown overflow issue in the datatable cells. The default datatable layout
// setup uses scrollable div(table-scrollable) with overflow:auto to enable vertical scroll(see: assets/global/scripts/datatable.js).
// So when dropdowns used the scrollable div should be removed.
//"dom": "<'row'<'col-md-8 col-sm-12'pli><'col-md-4 col-sm-12'<'table-group-actions pull-right'>>r>t<'row'<'col-md-8 col-sm-12'pli><'col-md-4 col-sm-12'>>",
"lengthMenu": [
[10, 20, 50, 100, 150, -1],
[19, 20, 50, 100, 150, "All"] // change per page values here
],
"pageLength": 10, // default record count per page
"ajax": {
"url": "../demo/ecommerce_order_invoices.php", // ajax source
},
"order": [
[1, "asc"]
] // set first column as a default sort by asc
}
});
// handle group actionsubmit button click
grid.getTableWrapper().on('click', '.table-group-action-submit', function (e) {
e.preventDefault();
var action = $(".table-group-action-input", grid.getTableWrapper());
if (action.val() != "" && grid.getSelectedRowsCount() > 0) {
grid.setAjaxParam("customActionType", "group_action");
grid.setAjaxParam("customActionName", action.val());
grid.setAjaxParam("id", grid.getSelectedRows());
grid.getDataTable().ajax.reload();
grid.clearAjaxParams();
} else if (action.val() == "") {
App.alert({
type: 'danger',
icon: 'warning',
message: 'Please select an action',
container: grid.getTableWrapper(),
place: 'prepend'
});
} else if (grid.getSelectedRowsCount() === 0) {
App.alert({
type: 'danger',
icon: 'warning',
message: 'No record selected',
container: grid.getTableWrapper(),
place: 'prepend'
});
}
});
}
var handleCreditMemos = function () {
var grid = new Datatable();
grid.init({
src: $("#datatable_credit_memos"),
onSuccess: function (grid) {
// execute some code after table records loaded
},
onError: function (grid) {
// execute some code on network or other general error
},
loadingMessage: 'Loading...',
dataTable: { // here you can define a typical datatable settings from http://datatables.net/usage/options
// Uncomment below line("dom" parameter) to fix the dropdown overflow issue in the datatable cells. The default datatable layout
// setup uses scrollable div(table-scrollable) with overflow:auto to enable vertical scroll(see: assets/global/scripts/datatable.js).
// So when dropdowns used the scrollable div should be removed.
//"dom": "<'row'<'col-md-8 col-sm-12'pli><'col-md-4 col-sm-12'<'table-group-actions pull-right'>>r>t<'row'<'col-md-8 col-sm-12'pli><'col-md-4 col-sm-12'>>",
"lengthMenu": [
[10, 20, 50, 100, 150, -1],
[10, 20, 50, 100, 150, "All"] // change per page values here
],
"pageLength": 10, // default record count per page
"ajax": {
"url": "../demo/ecommerce_order_credit_memos.php", // ajax source
},
"columnDefs": [{ // define columns sorting options(by default all columns are sortable extept the first checkbox column)
'orderable': true,
'targets': [0]
}],
"order": [
[0, "asc"]
] // set first column as a default sort by asc
}
});
}
var handleShipment = function () {
var grid = new Datatable();
grid.init({
src: $("#datatable_shipment"),
onSuccess: function (grid) {
// execute some code after table records loaded
},
onError: function (grid) {
// execute some code on network or other general error
},
loadingMessage: 'Loading...',
dataTable: { // here you can define a typical datatable settings from http://datatables.net/usage/options
"lengthMenu": [
[10, 20, 50, 100, 150, -1],
[10, 20, 50, 100, 150, "All"] // change per page values here
],
"pageLength": 10, // default record count per page
"ajax": {
"url": "../demo/ecommerce_order_shipment.php", // ajax source
},
"columnDefs": [{ // define columns sorting options(by default all columns are sortable extept the first checkbox column)
'orderable': true,
'targets': [0]
}],
"order": [
[0, "asc"]
] // set first column as a default sort by asc
}
});
}
var handleHistory = function () {
var grid = new Datatable();
grid.init({
src: $("#datatable_history"),
onSuccess: function (grid) {
// execute some code after table records loaded
},
onError: function (grid) {
// execute some code on network or other general error
},
loadingMessage: 'Loading...',
dataTable: { // here you can define a typical datatable settings from http://datatables.net/usage/options
"lengthMenu": [
[10, 20, 50, 100, 150, -1],
[10, 20, 50, 100, 150, "All"] // change per page values here
],
"pageLength": 10, // default record count per page
"ajax": {
"url": "../demo/ecommerce_order_history.php", // ajax source
},
"columnDefs": [{ // define columns sorting options(by default all columns are sortable extept the first checkbox column)
'orderable': true,
'targets': [0]
}],
"order": [
[0, "asc"]
] // set first column as a default sort by asc
}
});
// handle group actionsubmit button click
grid.getTableWrapper().on('click', '.table-group-action-submit', function (e) {
e.preventDefault();
var action = $(".table-group-action-input", grid.getTableWrapper());
if (action.val() != "" && grid.getSelectedRowsCount() > 0) {
grid.setAjaxParam("customActionType", "group_action");
grid.setAjaxParam("customActionName", action.val());
grid.setAjaxParam("id", grid.getSelectedRows());
grid.getDataTable().ajax.reload();
grid.clearAjaxParams();
} else if (action.val() == "") {
App.alert({
type: 'danger',
icon: 'warning',
message: 'Please select an action',
container: grid.getTableWrapper(),
place: 'prepend'
});
} else if (grid.getSelectedRowsCount() === 0) {
App.alert({
type: 'danger',
icon: 'warning',
message: 'No record selected',
container: grid.getTableWrapper(),
place: 'prepend'
});
}
});
}
var initPickers = function () {
//init date pickers
$('.date-picker').datepicker({
rtl: App.isRTL(),
autoclose: true
});
$(".datetime-picker").datetimepicker({
isRTL: App.isRTL(),
autoclose: true,
todayBtn: true,
pickerPosition: (App.isRTL() ? "bottom-right" : "bottom-left"),
minuteStep: 10
});
}
return {
//main function to initiate the module
init: function () {
initPickers();
handleInvoices();
handleCreditMemos();
handleShipment();
handleHistory();
}
};
}();
jQuery(document).ready(function() {
EcommerceOrdersView.init();
});
+1
View File
@@ -0,0 +1 @@
var EcommerceOrdersView=function(){var e=function(){var e=new Datatable;e.init({src:$("#datatable_invoices"),onSuccess:function(e){},onError:function(e){},loadingMessage:"Loading...",dataTable:{lengthMenu:[[10,20,50,100,150,-1],[19,20,50,100,150,"All"]],pageLength:10,ajax:{url:"../demo/ecommerce_order_invoices.php"},order:[[1,"asc"]]}}),e.getTableWrapper().on("click",".table-group-action-submit",function(a){a.preventDefault();var t=$(".table-group-action-input",e.getTableWrapper());""!=t.val()&&e.getSelectedRowsCount()>0?(e.setAjaxParam("customActionType","group_action"),e.setAjaxParam("customActionName",t.val()),e.setAjaxParam("id",e.getSelectedRows()),e.getDataTable().ajax.reload(),e.clearAjaxParams()):""==t.val()?App.alert({type:"danger",icon:"warning",message:"Please select an action",container:e.getTableWrapper(),place:"prepend"}):0===e.getSelectedRowsCount()&&App.alert({type:"danger",icon:"warning",message:"No record selected",container:e.getTableWrapper(),place:"prepend"})})},a=function(){var e=new Datatable;e.init({src:$("#datatable_credit_memos"),onSuccess:function(e){},onError:function(e){},loadingMessage:"Loading...",dataTable:{lengthMenu:[[10,20,50,100,150,-1],[10,20,50,100,150,"All"]],pageLength:10,ajax:{url:"../demo/ecommerce_order_credit_memos.php"},columnDefs:[{orderable:!0,targets:[0]}],order:[[0,"asc"]]}})},t=function(){var e=new Datatable;e.init({src:$("#datatable_shipment"),onSuccess:function(e){},onError:function(e){},loadingMessage:"Loading...",dataTable:{lengthMenu:[[10,20,50,100,150,-1],[10,20,50,100,150,"All"]],pageLength:10,ajax:{url:"../demo/ecommerce_order_shipment.php"},columnDefs:[{orderable:!0,targets:[0]}],order:[[0,"asc"]]}})},n=function(){var e=new Datatable;e.init({src:$("#datatable_history"),onSuccess:function(e){},onError:function(e){},loadingMessage:"Loading...",dataTable:{lengthMenu:[[10,20,50,100,150,-1],[10,20,50,100,150,"All"]],pageLength:10,ajax:{url:"../demo/ecommerce_order_history.php"},columnDefs:[{orderable:!0,targets:[0]}],order:[[0,"asc"]]}}),e.getTableWrapper().on("click",".table-group-action-submit",function(a){a.preventDefault();var t=$(".table-group-action-input",e.getTableWrapper());""!=t.val()&&e.getSelectedRowsCount()>0?(e.setAjaxParam("customActionType","group_action"),e.setAjaxParam("customActionName",t.val()),e.setAjaxParam("id",e.getSelectedRows()),e.getDataTable().ajax.reload(),e.clearAjaxParams()):""==t.val()?App.alert({type:"danger",icon:"warning",message:"Please select an action",container:e.getTableWrapper(),place:"prepend"}):0===e.getSelectedRowsCount()&&App.alert({type:"danger",icon:"warning",message:"No record selected",container:e.getTableWrapper(),place:"prepend"})})},r=function(){$(".date-picker").datepicker({rtl:App.isRTL(),autoclose:!0}),$(".datetime-picker").datetimepicker({isRTL:App.isRTL(),autoclose:!0,todayBtn:!0,pickerPosition:App.isRTL()?"bottom-right":"bottom-left",minuteStep:10})};return{init:function(){r(),e(),a(),t(),n()}}}();jQuery(document).ready(function(){EcommerceOrdersView.init()});
+90
View File
@@ -0,0 +1,90 @@
var EcommerceOrders = function () {
var initPickers = function () {
//init date pickers
$('.date-picker').datepicker({
rtl: App.isRTL(),
autoclose: true
});
}
var handleOrders = function () {
var grid = new Datatable();
grid.init({
src: $("#datatable_orders"),
onSuccess: function (grid) {
// execute some code after table records loaded
},
onError: function (grid) {
// execute some code on network or other general error
},
loadingMessage: 'Loading...',
dataTable: { // here you can define a typical datatable settings from http://datatables.net/usage/options
// Uncomment below line("dom" parameter) to fix the dropdown overflow issue in the datatable cells. The default datatable layout
// setup uses scrollable div(table-scrollable) with overflow:auto to enable vertical scroll(see: assets/global/scripts/datatable.js).
// So when dropdowns used the scrollable div should be removed.
//"dom": "<'row'<'col-md-8 col-sm-12'pli><'col-md-4 col-sm-12'<'table-group-actions pull-right'>>r>t<'row'<'col-md-8 col-sm-12'pli><'col-md-4 col-sm-12'>>",
"lengthMenu": [
[10, 20, 50, 100, 150, -1],
[10, 20, 50, 100, 150, "All"] // change per page values here
],
"pageLength": 10, // default record count per page
"ajax": {
"url": "../demo/ecommerce_orders.php", // ajax source
},
"order": [
[1, "asc"]
] // set first column as a default sort by asc
}
});
// handle group actionsubmit button click
grid.getTableWrapper().on('click', '.table-group-action-submit', function (e) {
e.preventDefault();
var action = $(".table-group-action-input", grid.getTableWrapper());
if (action.val() != "" && grid.getSelectedRowsCount() > 0) {
grid.setAjaxParam("customActionType", "group_action");
grid.setAjaxParam("customActionName", action.val());
grid.setAjaxParam("id", grid.getSelectedRows());
grid.getDataTable().ajax.reload();
grid.clearAjaxParams();
} else if (action.val() == "") {
alert({
type: 'danger',
icon: 'warning',
message: 'Please select an action',
container: grid.getTableWrapper(),
place: 'prepend'
});
} else if (grid.getSelectedRowsCount() === 0) {
alert({
type: 'danger',
icon: 'warning',
message: 'No record selected',
container: grid.getTableWrapper(),
place: 'prepend'
});
}
});
}
return {
//main function to initiate the module
init: function () {
initPickers();
handleOrders();
}
};
}();
jQuery(document).ready(function() {
EcommerceOrders.init();
});
+1
View File
@@ -0,0 +1 @@
var EcommerceOrders=function(){var e=function(){$(".date-picker").datepicker({rtl:App.isRTL(),autoclose:!0})},a=function(){var e=new Datatable;e.init({src:$("#datatable_orders"),onSuccess:function(e){},onError:function(e){},loadingMessage:"Loading...",dataTable:{lengthMenu:[[10,20,50,100,150,-1],[10,20,50,100,150,"All"]],pageLength:10,ajax:{url:"../demo/ecommerce_orders.php"},order:[[1,"asc"]]}}),e.getTableWrapper().on("click",".table-group-action-submit",function(a){a.preventDefault();var t=$(".table-group-action-input",e.getTableWrapper());""!=t.val()&&e.getSelectedRowsCount()>0?(e.setAjaxParam("customActionType","group_action"),e.setAjaxParam("customActionName",t.val()),e.setAjaxParam("id",e.getSelectedRows()),e.getDataTable().ajax.reload(),e.clearAjaxParams()):""==t.val()?alert({type:"danger",icon:"warning",message:"Please select an action",container:e.getTableWrapper(),place:"prepend"}):0===e.getSelectedRowsCount()&&alert({type:"danger",icon:"warning",message:"No record selected",container:e.getTableWrapper(),place:"prepend"})})};return{init:function(){e(),a()}}}();jQuery(document).ready(function(){EcommerceOrders.init()});
@@ -0,0 +1,189 @@
var EcommerceProductsEdit = function () {
var handleImages = function() {
// see http://www.plupload.com/
var uploader = new plupload.Uploader({
runtimes : 'html5,flash,silverlight,html4',
browse_button : document.getElementById('tab_images_uploader_pickfiles'), // you can pass in id...
container: document.getElementById('tab_images_uploader_container'), // ... or DOM Element itself
url : "assets/plugins/plupload/examples/upload.php",
filters : {
max_file_size : '10mb',
mime_types: [
{title : "Image files", extensions : "jpg,gif,png"},
{title : "Zip files", extensions : "zip"}
]
},
// Flash settings
flash_swf_url : 'assets/plugins/plupload/js/Moxie.swf',
// Silverlight settings
silverlight_xap_url : 'assets/plugins/plupload/js/Moxie.xap',
init: {
PostInit: function() {
$('#tab_images_uploader_filelist').html("");
$('#tab_images_uploader_uploadfiles').click(function() {
uploader.start();
return false;
});
$('#tab_images_uploader_filelist').on('click', '.added-files .remove', function(){
uploader.removeFile($(this).parent('.added-files').attr("id"));
$(this).parent('.added-files').remove();
});
},
FilesAdded: function(up, files) {
plupload.each(files, function(file) {
$('#tab_images_uploader_filelist').append('<div class="alert alert-warning added-files" id="uploaded_file_' + file.id + '">' + file.name + '(' + plupload.formatSize(file.size) + ') <span class="status label label-info"></span>&nbsp;<a href="javascript:;" style="margin-top:-5px" class="remove pull-right btn btn-sm red"><i class="fa fa-times"></i> remove</a></div>');
});
},
UploadProgress: function(up, file) {
$('#uploaded_file_' + file.id + ' > .status').html(file.percent + '%');
},
FileUploaded: function(up, file, response) {
var response = $.parseJSON(response.response);
if (response.result && response.result == 'OK') {
var id = response.id; // uploaded file's unique name. Here you can collect uploaded file names and submit an jax request to your server side script to process the uploaded files and update the images tabke
$('#uploaded_file_' + file.id + ' > .status').removeClass("label-info").addClass("label-success").html('<i class="fa fa-check"></i> Done'); // set successfull upload
} else {
$('#uploaded_file_' + file.id + ' > .status').removeClass("label-info").addClass("label-danger").html('<i class="fa fa-warning"></i> Failed'); // set failed upload
App.alert({type: 'danger', message: 'One of uploads failed. Please retry.', closeInSeconds: 10, icon: 'warning'});
}
},
Error: function(up, err) {
App.alert({type: 'danger', message: err.message, closeInSeconds: 10, icon: 'warning'});
}
}
});
uploader.init();
}
var handleReviews = function () {
var grid = new Datatable();
grid.init({
src: $("#datatable_reviews"),
onSuccess: function (grid) {
// execute some code after table records loaded
},
onError: function (grid) {
// execute some code on network or other general error
},
loadingMessage: 'Loading...',
dataTable: { // here you can define a typical datatable settings from http://datatables.net/usage/options
// Uncomment below line("dom" parameter) to fix the dropdown overflow issue in the datatable cells. The default datatable layout
// setup uses scrollable div(table-scrollable) with overflow:auto to enable vertical scroll(see: assets/global/scripts/datatable.js).
// So when dropdowns used the scrollable div should be removed.
//"dom": "<'row'<'col-md-8 col-sm-12'pli><'col-md-4 col-sm-12'<'table-group-actions pull-right'>>r>t<'row'<'col-md-8 col-sm-12'pli><'col-md-4 col-sm-12'>>",
"lengthMenu": [
[10, 20, 50, 100, 150, -1],
[10, 20, 50, 100, 150, "All"] // change per page values here
],
"pageLength": 10, // default record count per page
"ajax": {
"url": "../demo/ecommerce_product_reviews.php", // ajax source
},
"columnDefs": [{ // define columns sorting options(by default all columns are sortable extept the first checkbox column)
'orderable': true,
'targets': [0]
}],
"order": [
[0, "asc"]
] // set first column as a default sort by asc
}
});
}
var handleHistory = function () {
var grid = new Datatable();
grid.init({
src: $("#datatable_history"),
onSuccess: function (grid) {
// execute some code after table records loaded
},
onError: function (grid) {
// execute some code on network or other general error
},
loadingMessage: 'Loading...',
dataTable: { // here you can define a typical datatable settings from http://datatables.net/usage/options
"lengthMenu": [
[10, 20, 50, 100, 150, -1],
[10, 20, 50, 100, 150, "All"] // change per page values here
],
"pageLength": 10, // default record count per page
"ajax": {
"url": "../demo/ecommerce_product_history.php", // ajax source
},
"columnDefs": [{ // define columns sorting options(by default all columns are sortable extept the first checkbox column)
'orderable': true,
'targets': [0]
}],
"order": [
[0, "asc"]
] // set first column as a default sort by asc
}
});
}
var initComponents = function () {
//init datepickers
$('.date-picker').datepicker({
rtl: App.isRTL(),
autoclose: true
});
//init datetimepickers
$(".datetime-picker").datetimepicker({
isRTL: App.isRTL(),
autoclose: true,
todayBtn: true,
pickerPosition: (App.isRTL() ? "bottom-right" : "bottom-left"),
minuteStep: 10
});
//init maxlength handler
$('.maxlength-handler').maxlength({
limitReachedClass: "label label-danger",
alwaysShow: true,
threshold: 5
});
}
return {
//main function to initiate the module
init: function () {
initComponents();
handleImages();
handleReviews();
handleHistory();
}
};
}();
jQuery(document).ready(function() {
EcommerceProductsEdit.init();
});
+1
View File
@@ -0,0 +1 @@
var EcommerceProductsEdit=function(){var e=function(){var e=new plupload.Uploader({runtimes:"html5,flash,silverlight,html4",browse_button:document.getElementById("tab_images_uploader_pickfiles"),container:document.getElementById("tab_images_uploader_container"),url:"assets/plugins/plupload/examples/upload.php",filters:{max_file_size:"10mb",mime_types:[{title:"Image files",extensions:"jpg,gif,png"},{title:"Zip files",extensions:"zip"}]},flash_swf_url:"assets/plugins/plupload/js/Moxie.swf",silverlight_xap_url:"assets/plugins/plupload/js/Moxie.xap",init:{PostInit:function(){$("#tab_images_uploader_filelist").html(""),$("#tab_images_uploader_uploadfiles").click(function(){return e.start(),!1}),$("#tab_images_uploader_filelist").on("click",".added-files .remove",function(){e.removeFile($(this).parent(".added-files").attr("id")),$(this).parent(".added-files").remove()})},FilesAdded:function(e,a){plupload.each(a,function(e){$("#tab_images_uploader_filelist").append('<div class="alert alert-warning added-files" id="uploaded_file_'+e.id+'">'+e.name+"("+plupload.formatSize(e.size)+') <span class="status label label-info"></span>&nbsp;<a href="javascript:;" style="margin-top:-5px" class="remove pull-right btn btn-sm red"><i class="fa fa-times"></i> remove</a></div>')})},UploadProgress:function(e,a){$("#uploaded_file_"+a.id+" > .status").html(a.percent+"%")},FileUploaded:function(e,a,t){var t=$.parseJSON(t.response);if(t.result&&"OK"==t.result){t.id;$("#uploaded_file_"+a.id+" > .status").removeClass("label-info").addClass("label-success").html('<i class="fa fa-check"></i> Done')}else $("#uploaded_file_"+a.id+" > .status").removeClass("label-info").addClass("label-danger").html('<i class="fa fa-warning"></i> Failed'),App.alert({type:"danger",message:"One of uploads failed. Please retry.",closeInSeconds:10,icon:"warning"})},Error:function(e,a){App.alert({type:"danger",message:a.message,closeInSeconds:10,icon:"warning"})}}});e.init()},a=function(){var e=new Datatable;e.init({src:$("#datatable_reviews"),onSuccess:function(e){},onError:function(e){},loadingMessage:"Loading...",dataTable:{lengthMenu:[[10,20,50,100,150,-1],[10,20,50,100,150,"All"]],pageLength:10,ajax:{url:"../demo/ecommerce_product_reviews.php"},columnDefs:[{orderable:!0,targets:[0]}],order:[[0,"asc"]]}})},t=function(){var e=new Datatable;e.init({src:$("#datatable_history"),onSuccess:function(e){},onError:function(e){},loadingMessage:"Loading...",dataTable:{lengthMenu:[[10,20,50,100,150,-1],[10,20,50,100,150,"All"]],pageLength:10,ajax:{url:"../demo/ecommerce_product_history.php"},columnDefs:[{orderable:!0,targets:[0]}],order:[[0,"asc"]]}})},l=function(){$(".date-picker").datepicker({rtl:App.isRTL(),autoclose:!0}),$(".datetime-picker").datetimepicker({isRTL:App.isRTL(),autoclose:!0,todayBtn:!0,pickerPosition:App.isRTL()?"bottom-right":"bottom-left",minuteStep:10}),$(".maxlength-handler").maxlength({limitReachedClass:"label label-danger",alwaysShow:!0,threshold:5})};return{init:function(){l(),e(),a(),t()}}}();jQuery(document).ready(function(){EcommerceProductsEdit.init()});
@@ -0,0 +1,90 @@
var EcommerceProducts = function () {
var initPickers = function () {
//init date pickers
$('.date-picker').datepicker({
rtl: App.isRTL(),
autoclose: true
});
}
var handleProducts = function() {
var grid = new Datatable();
grid.init({
src: $("#datatable_products"),
onSuccess: function (grid) {
// execute some code after table records loaded
},
onError: function (grid) {
// execute some code on network or other general error
},
loadingMessage: 'Loading...',
dataTable: { // here you can define a typical datatable settings from http://datatables.net/usage/options
// Uncomment below line("dom" parameter) to fix the dropdown overflow issue in the datatable cells. The default datatable layout
// setup uses scrollable div(table-scrollable) with overflow:auto to enable vertical scroll(see: assets/global/scripts/datatable.js).
// So when dropdowns used the scrollable div should be removed.
//"dom": "<'row'<'col-md-8 col-sm-12'pli><'col-md-4 col-sm-12'<'table-group-actions pull-right'>>r>t<'row'<'col-md-8 col-sm-12'pli><'col-md-4 col-sm-12'>>",
"lengthMenu": [
[10, 20, 50, 100, 150],
[10, 20, 50, 100, 150] // change per page values here
],
"pageLength": 10, // default record count per page
"ajax": {
"url": "../demo/ecommerce_products.php", // ajax source
},
"order": [
[1, "asc"]
] // set first column as a default sort by asc
}
});
// handle group actionsubmit button click
grid.getTableWrapper().on('click', '.table-group-action-submit', function (e) {
e.preventDefault();
var action = $(".table-group-action-input", grid.getTableWrapper());
if (action.val() != "" && grid.getSelectedRowsCount() > 0) {
grid.setAjaxParam("customActionType", "group_action");
grid.setAjaxParam("customActionName", action.val());
grid.setAjaxParam("id", grid.getSelectedRows());
grid.getDataTable().ajax.reload();
grid.clearAjaxParams();
} else if (action.val() == "") {
App.alert({
type: 'danger',
icon: 'warning',
message: 'Please select an action',
container: grid.getTableWrapper(),
place: 'prepend'
});
} else if (grid.getSelectedRowsCount() === 0) {
App.alert({
type: 'danger',
icon: 'warning',
message: 'No record selected',
container: grid.getTableWrapper(),
place: 'prepend'
});
}
});
}
return {
//main function to initiate the module
init: function () {
handleProducts();
initPickers();
}
};
}();
jQuery(document).ready(function() {
EcommerceProducts.init();
});
+1
View File
@@ -0,0 +1 @@
var EcommerceProducts=function(){var e=function(){$(".date-picker").datepicker({rtl:App.isRTL(),autoclose:!0})},a=function(){var e=new Datatable;e.init({src:$("#datatable_products"),onSuccess:function(e){},onError:function(e){},loadingMessage:"Loading...",dataTable:{lengthMenu:[[10,20,50,100,150],[10,20,50,100,150]],pageLength:10,ajax:{url:"../demo/ecommerce_products.php"},order:[[1,"asc"]]}}),e.getTableWrapper().on("click",".table-group-action-submit",function(a){a.preventDefault();var t=$(".table-group-action-input",e.getTableWrapper());""!=t.val()&&e.getSelectedRowsCount()>0?(e.setAjaxParam("customActionType","group_action"),e.setAjaxParam("customActionName",t.val()),e.setAjaxParam("id",e.getSelectedRows()),e.getDataTable().ajax.reload(),e.clearAjaxParams()):""==t.val()?App.alert({type:"danger",icon:"warning",message:"Please select an action",container:e.getTableWrapper(),place:"prepend"}):0===e.getSelectedRowsCount()&&App.alert({type:"danger",icon:"warning",message:"No record selected",container:e.getTableWrapper(),place:"prepend"})})};return{init:function(){a(),e()}}}();jQuery(document).ready(function(){EcommerceProducts.init()});
+41
View File
@@ -0,0 +1,41 @@
var FormDropzone = function () {
return {
//main function to initiate the module
init: function () {
Dropzone.options.myDropzone = {
dictDefaultMessage: "",
init: function() {
this.on("addedfile", function(file) {
// Create the remove button
var removeButton = Dropzone.createElement("<a href='javascript:;'' class='btn red btn-sm btn-block'>Remove</a>");
// Capture the Dropzone instance as closure.
var _this = this;
// Listen to the click event
removeButton.addEventListener("click", function(e) {
// Make sure the button click doesn't submit the form:
e.preventDefault();
e.stopPropagation();
// Remove the file preview.
_this.removeFile(file);
// If you want to the delete the file on the server as well,
// you can do the AJAX request here.
});
// Add the button to the file preview element.
file.previewElement.appendChild(removeButton);
});
}
}
}
};
}();
jQuery(document).ready(function() {
FormDropzone.init();
});
+1
View File
@@ -0,0 +1 @@
var FormDropzone=function(){return{init:function(){Dropzone.options.myDropzone={dictDefaultMessage:"",init:function(){this.on("addedfile",function(e){var n=Dropzone.createElement("<a href='javascript:;'' class='btn red btn-sm btn-block'>Remove</a>"),t=this;n.addEventListener("click",function(n){n.preventDefault(),n.stopPropagation(),t.removeFile(e)}),e.previewElement.appendChild(n)})}}}}}();jQuery(document).ready(function(){FormDropzone.init()});
+668
View File
@@ -0,0 +1,668 @@
var FormEditable = function() {
$.mockjaxSettings.responseTime = 500;
var log = function(settings, response) {
var s = [],
str;
s.push(settings.type.toUpperCase() + ' url = "' + settings.url + '"');
for (var a in settings.data) {
if (settings.data[a] && typeof settings.data[a] === 'object') {
str = [];
for (var j in settings.data[a]) {
str.push(j + ': "' + settings.data[a][j] + '"');
}
str = '{ ' + str.join(', ') + ' }';
} else {
str = '"' + settings.data[a] + '"';
}
s.push(a + ' = ' + str);
}
s.push('RESPONSE: status = ' + response.status);
if (response.responseText) {
if ($.isArray(response.responseText)) {
s.push('[');
$.each(response.responseText, function(i, v) {
s.push('{value: ' + v.value + ', text: "' + v.text + '"}');
});
s.push(']');
} else {
s.push($.trim(response.responseText));
}
}
s.push('--------------------------------------\n');
$('#console').val(s.join('\n') + $('#console').val());
}
var initAjaxMock = function() {
//ajax mocks
$.mockjax({
url: '/post',
response: function(settings) {
log(settings, this);
}
});
$.mockjax({
url: '/error',
status: 400,
statusText: 'Bad Request',
response: function(settings) {
this.responseText = 'Please input correct value';
log(settings, this);
}
});
$.mockjax({
url: '/status',
status: 500,
response: function(settings) {
this.responseText = 'Internal Server Error';
log(settings, this);
}
});
$.mockjax({
url: '/groups',
response: function(settings) {
this.responseText = [{
value: 0,
text: 'Guest'
}, {
value: 1,
text: 'Service'
}, {
value: 2,
text: 'Customer'
}, {
value: 3,
text: 'Operator'
}, {
value: 4,
text: 'Support'
}, {
value: 5,
text: 'Admin'
}];
log(settings, this);
}
});
}
var initEditables = function() {
//set editable mode based on URL parameter
if (App.getURLParameter('mode') == 'inline') {
$.fn.editable.defaults.mode = 'inline';
$('#inline').attr("checked", true);
} else {
$('#inline').attr("checked", false);
}
//global settings
$.fn.editable.defaults.inputclass = 'form-control';
$.fn.editable.defaults.url = '/post';
//editables element samples
$('#totalctn').editable({
url: '/post',
type: 'text',
pk: 1,
name: 'totalctn',
title: 'Enter Total Ctn'
});
$('#weight').editable({
url: '/post',
type: 'text',
pk: 1,
name: 'weight',
title: 'Enter Weight'
});
$('#measurement').editable({
url: '/post',
type: 'text',
pk: 1,
name: 'measurement',
title: 'Enter measurement'
});
$('#totalctn2').editable({
url: '/post',
type: 'text',
pk: 1,
name: 'totalctn',
title: 'Enter Total Ctn'
});
$('#weight2').editable({
url: '/post',
type: 'text',
pk: 1,
name: 'weight',
title: 'Enter Weight'
});
$('#measurement2').editable({
url: '/post',
type: 'text',
pk: 1,
name: 'measurement',
title: 'Enter measurement'
});
$('#totalctn3').editable({
url: '/post',
type: 'text',
pk: 1,
name: 'totalctn',
title: 'Enter Total Ctn'
});
$('#weight3').editable({
url: '/post',
type: 'text',
pk: 1,
name: 'weight',
title: 'Enter Weight'
});
$('#measurement3').editable({
url: '/post',
type: 'text',
pk: 1,
name: 'measurement',
title: 'Enter measurement'
});
$('#username').editable({
url: '/post',
type: 'text',
pk: 1,
name: 'username',
title: 'Enter username'
});
$('#firstname').editable({
validate: function(value) {
if ($.trim(value) == '') return 'This field is required';
}
});
$('#sex').editable({
prepend: "not selected",
inputclass: 'form-control',
source: [{
value: 1,
text: 'Male'
}, {
value: 2,
text: 'Female'
}],
display: function(value, sourceData) {
var colors = {
"": "gray",
1: "green",
2: "blue"
},
elem = $.grep(sourceData, function(o) {
return o.value == value;
});
if (elem.length) {
$(this).text(elem[0].text).css("color", colors[value]);
} else {
$(this).empty();
}
}
});
$('#status').editable();
$('#group').editable({
showbuttons: false
});
$('#vacation').editable({
rtl: App.isRTL()
});
$('#dob').editable({
inputclass: 'form-control',
});
$('#event').editable({
placement: (App.isRTL() ? 'left' : 'right'),
combodate: {
firstItem: 'name'
}
});
$('#meeting_start').editable({
format: 'yyyy-mm-dd hh:ii',
viewformat: 'dd/mm/yyyy hh:ii',
validate: function(v) {
if (v && v.getDate() == 10) return 'Day cant be 10!';
},
datetimepicker: {
rtl: App.isRTL(),
todayBtn: 'linked',
weekStart: 1
}
});
$('#comments').editable({
showbuttons: 'bottom'
});
$('#note').editable({
showbuttons: (App.isRTL() ? 'left' : 'right')
});
$('#pencil').click(function(e) {
e.stopPropagation();
e.preventDefault();
$('#note').editable('toggle');
});
$('#state').editable({
source: ["Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Dakota", "North Carolina", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming"]
});
$('#fruits').editable({
pk: 1,
limit: 3,
source: [{
value: 1,
text: 'banana'
}, {
value: 2,
text: 'peach'
}, {
value: 3,
text: 'apple'
}, {
value: 4,
text: 'watermelon'
}, {
value: 5,
text: 'orange'
}]
});
$('#fruits').on('shown', function(e, reason) {
});
$('#tags').editable({
inputclass: 'form-control input-medium',
select2: {
data: ['html', 'javascript', 'css', 'ajax'],
tags: true,
tokenSeparators: [',', ' '],
multiple: true
}
});
var countries = [];
$.each({
"BD": "Bangladesh",
"BE": "Belgium",
"BF": "Burkina Faso",
"BG": "Bulgaria",
"BA": "Bosnia and Herzegovina",
"BB": "Barbados",
"WF": "Wallis and Futuna",
"BL": "Saint Bartelemey",
"BM": "Bermuda",
"BN": "Brunei Darussalam",
"BO": "Bolivia",
"BH": "Bahrain",
"BI": "Burundi",
"BJ": "Benin",
"BT": "Bhutan",
"JM": "Jamaica",
"BV": "Bouvet Island",
"BW": "Botswana",
"WS": "Samoa",
"BR": "Brazil",
"BS": "Bahamas",
"JE": "Jersey",
"BY": "Belarus",
"O1": "Other Country",
"LV": "Latvia",
"RW": "Rwanda",
"RS": "Serbia",
"TL": "Timor-Leste",
"RE": "Reunion",
"LU": "Luxembourg",
"TJ": "Tajikistan",
"RO": "Romania",
"PG": "Papua New Guinea",
"GW": "Guinea-Bissau",
"GU": "Guam",
"GT": "Guatemala",
"GS": "South Georgia and the South Sandwich Islands",
"GR": "Greece",
"GQ": "Equatorial Guinea",
"GP": "Guadeloupe",
"JP": "Japan",
"GY": "Guyana",
"GG": "Guernsey",
"GF": "French Guiana",
"GE": "Georgia",
"GD": "Grenada",
"GB": "United Kingdom",
"GA": "Gabon",
"SV": "El Salvador",
"GN": "Guinea",
"GM": "Gambia",
"GL": "Greenland",
"GI": "Gibraltar",
"GH": "Ghana",
"OM": "Oman",
"TN": "Tunisia",
"JO": "Jordan",
"HR": "Croatia",
"HT": "Haiti",
"HU": "Hungary",
"HK": "Hong Kong",
"HN": "Honduras",
"HM": "Heard Island and McDonald Islands",
"VE": "Venezuela",
"PR": "Puerto Rico",
"PS": "Palestinian Territory",
"PW": "Palau",
"PT": "Portugal",
"SJ": "Svalbard and Jan Mayen",
"PY": "Paraguay",
"IQ": "Iraq",
"PA": "Panama",
"PF": "French Polynesia",
"BZ": "Belize",
"PE": "Peru",
"PK": "Pakistan",
"PH": "Philippines",
"PN": "Pitcairn",
"TM": "Turkmenistan",
"PL": "Poland",
"PM": "Saint Pierre and Miquelon",
"ZM": "Zambia",
"EH": "Western Sahara",
"RU": "Russian Federation",
"EE": "Estonia",
"EG": "Egypt",
"TK": "Tokelau",
"ZA": "South Africa",
"EC": "Ecuador",
"IT": "Italy",
"VN": "Vietnam",
"SB": "Solomon Islands",
"EU": "Europe",
"ET": "Ethiopia",
"SO": "Somalia",
"ZW": "Zimbabwe",
"SA": "Saudi Arabia",
"ES": "Spain",
"ER": "Eritrea",
"ME": "Montenegro",
"MD": "Moldova, Republic of",
"MG": "Madagascar",
"MF": "Saint Martin",
"MA": "Morocco",
"MC": "Monaco",
"UZ": "Uzbekistan",
"MM": "Myanmar",
"ML": "Mali",
"MO": "Macao",
"MN": "Mongolia",
"MH": "Marshall Islands",
"MK": "Macedonia",
"MU": "Mauritius",
"MT": "Malta",
"MW": "Malawi",
"MV": "Maldives",
"MQ": "Martinique",
"MP": "Northern Mariana Islands",
"MS": "Montserrat",
"MR": "Mauritania",
"IM": "Isle of Man",
"UG": "Uganda",
"TZ": "Tanzania, United Republic of",
"MY": "Malaysia",
"MX": "Mexico",
"IL": "Israel",
"FR": "France",
"IO": "British Indian Ocean Territory",
"FX": "France, Metropolitan",
"SH": "Saint Helena",
"FI": "Finland",
"FJ": "Fiji",
"FK": "Falkland Islands (Malvinas)",
"FM": "Micronesia, Federated States of",
"FO": "Faroe Islands",
"NI": "Nicaragua",
"NL": "Netherlands",
"NO": "Norway",
"NA": "Namibia",
"VU": "Vanuatu",
"NC": "New Caledonia",
"NE": "Niger",
"NF": "Norfolk Island",
"NG": "Nigeria",
"NZ": "New Zealand",
"NP": "Nepal",
"NR": "Nauru",
"NU": "Niue",
"CK": "Cook Islands",
"CI": "Cote d'Ivoire",
"CH": "Switzerland",
"CO": "Colombia",
"CN": "China",
"CM": "Cameroon",
"CL": "Chile",
"CC": "Cocos (Keeling) Islands",
"CA": "Canada",
"CG": "Congo",
"CF": "Central African Republic",
"CD": "Congo, The Democratic Republic of the",
"CZ": "Czech Republic",
"CY": "Cyprus",
"CX": "Christmas Island",
"CR": "Costa Rica",
"CV": "Cape Verde",
"CU": "Cuba",
"SZ": "Swaziland",
"SY": "Syrian Arab Republic",
"KG": "Kyrgyzstan",
"KE": "Kenya",
"SR": "Suriname",
"KI": "Kiribati",
"KH": "Cambodia",
"KN": "Saint Kitts and Nevis",
"KM": "Comoros",
"ST": "Sao Tome and Principe",
"SK": "Slovakia",
"KR": "Korea, Republic of",
"SI": "Slovenia",
"KP": "Korea, Democratic People's Republic of",
"KW": "Kuwait",
"SN": "Senegal",
"SM": "San Marino",
"SL": "Sierra Leone",
"SC": "Seychelles",
"KZ": "Kazakhstan",
"KY": "Cayman Islands",
"SG": "Singapore",
"SE": "Sweden",
"SD": "Sudan",
"DO": "Dominican Republic",
"DM": "Dominica",
"DJ": "Djibouti",
"DK": "Denmark",
"VG": "Virgin Islands, British",
"DE": "Germany",
"YE": "Yemen",
"DZ": "Algeria",
"US": "United States",
"UY": "Uruguay",
"YT": "Mayotte",
"UM": "United States Minor Outlying Islands",
"LB": "Lebanon",
"LC": "Saint Lucia",
"LA": "Lao People's Democratic Republic",
"TV": "Tuvalu",
"TW": "Taiwan",
"TT": "Trinidad and Tobago",
"TR": "Turkey",
"LK": "Sri Lanka",
"LI": "Liechtenstein",
"A1": "Anonymous Proxy",
"TO": "Tonga",
"LT": "Lithuania",
"A2": "Satellite Provider",
"LR": "Liberia",
"LS": "Lesotho",
"TH": "Thailand",
"TF": "French Southern Territories",
"TG": "Togo",
"TD": "Chad",
"TC": "Turks and Caicos Islands",
"LY": "Libyan Arab Jamahiriya",
"VA": "Holy See (Vatican City State)",
"VC": "Saint Vincent and the Grenadines",
"AE": "United Arab Emirates",
"AD": "Andorra",
"AG": "Antigua and Barbuda",
"AF": "Afghanistan",
"AI": "Anguilla",
"VI": "Virgin Islands, U.S.",
"IS": "Iceland",
"IR": "Iran, Islamic Republic of",
"AM": "Armenia",
"AL": "Albania",
"AO": "Angola",
"AN": "Netherlands Antilles",
"AQ": "Antarctica",
"AP": "Asia/Pacific Region",
"AS": "American Samoa",
"AR": "Argentina",
"AU": "Australia",
"AT": "Austria",
"AW": "Aruba",
"IN": "India",
"AX": "Aland Islands",
"AZ": "Azerbaijan",
"IE": "Ireland",
"ID": "Indonesia",
"UA": "Ukraine",
"QA": "Qatar",
"MZ": "Mozambique"
}, function(k, v) {
countries.push({
id: k,
text: v
});
});
$('#country').editable({
inputclass: 'form-control input-medium',
source: countries
});
$('#address').editable({
url: '/post',
value: {
city: "40",
street: "40",
building: "40"
},
display: function(value) {
if (!value) {
$(this).empty();
return;
}
var html = $('<div>').text(value.city).html() + ' x ' + $('<div>').text(value.street).html() + ' x ' + $('<div>').text(value.building).html();
$(this).html(html);
}
});
$('#address2').editable({
url: '/post',
value: {
city: "40",
street: "40",
building: "40"
},
display: function(value) {
if (!value) {
$(this).empty();
return;
}
var html = $('<div>').text(value.city).html() + ' x ' + $('<div>').text(value.street).html() + ' x ' + $('<div>').text(value.building).html();
$(this).html(html);
}
});
$('#address3').editable({
url: '/post',
value: {
city: "40",
street: "40",
building: "40"
},
display: function(value) {
if (!value) {
$(this).empty();
return;
}
var html = $('<div>').text(value.city).html() + ' x ' + $('<div>').text(value.street).html() + ' x ' + $('<div>').text(value.building).html();
$(this).html(html);
}
});
}
return {
//main function to initiate the module
init: function() {
// inii ajax simulation
initAjaxMock();
// init editable elements
initEditables();
// init editable toggler
$('#enable').click(function() {
$('#user .editable').editable('toggleDisabled');
});
// init
$('#inline').on('change', function(e) {
if ($(this).is(':checked')) {
window.location.href = 'form_editable.html?mode=inline';
} else {
window.location.href = 'form_editable.html';
}
});
// handle editable elements on hidden event fired
$('#user .editable').on('hidden', function(e, reason) {
if (reason === 'save' || reason === 'nochange') {
var $next = $(this).closest('tr').next().find('.editable');
if ($('#autoopen').is(':checked')) {
setTimeout(function() {
$next.editable('show');
}, 300);
} else {
$next.focus();
}
}
});
}
};
}();
jQuery(document).ready(function() {
FormEditable.init();
});
File diff suppressed because one or more lines are too long
+61
View File
@@ -0,0 +1,61 @@
var FormFileUpload = function () {
return {
//main function to initiate the module
init: function () {
// Initialize the jQuery File Upload widget:
$('#fileupload').fileupload({
disableImageResize: false,
autoUpload: false,
disableImageResize: /Android(?!.*Chrome)|Opera/.test(window.navigator.userAgent),
maxFileSize: 5000000,
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
// Uncomment the following to send cross-domain cookies:
//xhrFields: {withCredentials: true},
});
// Enable iframe cross-domain access via redirect option:
$('#fileupload').fileupload(
'option',
'redirect',
window.location.href.replace(
/\/[^\/]*$/,
'/cors/result.html?%s'
)
);
// Upload server status check for browsers with CORS support:
if ($.support.cors) {
$.ajax({
type: 'HEAD'
}).fail(function () {
$('<div class="alert alert-danger"/>')
.text('Upload server currently unavailable - ' +
new Date())
.appendTo('#fileupload');
});
}
// Load & display existing files:
$('#fileupload').addClass('fileupload-processing');
$.ajax({
// Uncomment the following to send cross-domain cookies:
//xhrFields: {withCredentials: true},
url: $('#fileupload').attr("action"),
dataType: 'json',
context: $('#fileupload')[0]
}).always(function () {
$(this).removeClass('fileupload-processing');
}).done(function (result) {
$(this).fileupload('option', 'done')
.call(this, $.Event('done'), {result: result});
});
}
};
}();
jQuery(document).ready(function() {
FormFileUpload.init();
});
+1
View File
@@ -0,0 +1 @@
var FormFileUpload=function(){return{init:function(){$("#fileupload").fileupload({disableImageResize:!1,autoUpload:!1,disableImageResize:/Android(?!.*Chrome)|Opera/.test(window.navigator.userAgent),maxFileSize:5e6,acceptFileTypes:/(\.|\/)(gif|jpe?g|png)$/i}),$("#fileupload").fileupload("option","redirect",window.location.href.replace(/\/[^\/]*$/,"/cors/result.html?%s")),$.support.cors&&$.ajax({type:"HEAD"}).fail(function(){$('<div class="alert alert-danger"/>').text("Upload server currently unavailable - "+new Date).appendTo("#fileupload")}),$("#fileupload").addClass("fileupload-processing"),$.ajax({url:$("#fileupload").attr("action"),dataType:"json",context:$("#fileupload")[0]}).always(function(){$(this).removeClass("fileupload-processing")}).done(function(e){$(this).fileupload("option","done").call(this,$.Event("done"),{result:e})})}}}();jQuery(document).ready(function(){FormFileUpload.init()});
+59
View File
@@ -0,0 +1,59 @@
var FormiCheck = function () {
return {
//main function to initiate the module
init: function () {
$('.icheck-colors li').click(function() {
var self = $(this);
if (!self.hasClass('active')) {
self.siblings().removeClass('active');
var skin = self.closest('.skin'),
color = self.attr('class') ? '-' + self.attr('class') : '',
colorTmp = skin.data('color') ? '-' + skin.data('color') : '-grey',
colorTmp = (colorTmp === '-black' ? '' : colorTmp);
checkbox_default = 'icheckbox_minimal',
radio_default = 'iradio_minimal',
checkbox = 'icheckbox_minimal' + colorTmp,
radio = 'iradio_minimal' + colorTmp;
if (skin.hasClass('skin-square')) {
checkbox_default = 'icheckbox_square';
radio_default = 'iradio_square';
checkbox = 'icheckbox_square' + colorTmp;
radio = 'iradio_square' + colorTmp;
};
if (skin.hasClass('skin-flat')) {
checkbox_default = 'icheckbox_flat';
radio_default = 'iradio_flat';
checkbox = 'icheckbox_flat' + colorTmp;
radio = 'iradio_flat' + colorTmp;
};
if (skin.hasClass('skin-line')) {
checkbox_default = 'icheckbox_line';
radio_default = 'iradio_line';
checkbox = 'icheckbox_line' + colorTmp;
radio = 'iradio_line' + colorTmp;
};
skin.find('.icheck').each(function() {
var element = $(this).hasClass('state') ? $(this) : $(this).parent();
var element_class = element.attr('class').replace(checkbox, checkbox_default + color).replace(radio, radio_default + color);
element.attr('class', element_class);
});
skin.data('color', self.attr('class') ? self.attr('class') : 'black');
self.addClass('active');
};
});
}
};
}();
jQuery(document).ready(function() {
FormiCheck.init();
});
+1
View File
@@ -0,0 +1 @@
var FormiCheck=function(){return{init:function(){$(".icheck-colors li").click(function(){var a=$(this);if(!a.hasClass("active")){a.siblings().removeClass("active");var i=a.closest(".skin"),c=a.attr("class")?"-"+a.attr("class"):"",e=i.data("color")?"-"+i.data("color"):"-grey",e="-black"===e?"":e;checkbox_default="icheckbox_minimal",radio_default="iradio_minimal",checkbox="icheckbox_minimal"+e,radio="iradio_minimal"+e,i.hasClass("skin-square")&&(checkbox_default="icheckbox_square",radio_default="iradio_square",checkbox="icheckbox_square"+e,radio="iradio_square"+e),i.hasClass("skin-flat")&&(checkbox_default="icheckbox_flat",radio_default="iradio_flat",checkbox="icheckbox_flat"+e,radio="iradio_flat"+e),i.hasClass("skin-line")&&(checkbox_default="icheckbox_line",radio_default="iradio_line",checkbox="icheckbox_line"+e,radio="iradio_line"+e),i.find(".icheck").each(function(){var a=$(this).hasClass("state")?$(this):$(this).parent(),i=a.attr("class").replace(checkbox,checkbox_default+c).replace(radio,radio_default+c);a.attr("class",i)}),i.data("color",a.attr("class")?a.attr("class"):"black"),a.addClass("active")}})}}}();jQuery(document).ready(function(){FormiCheck.init()});
+527
View File
@@ -0,0 +1,527 @@
var FormImageCrop = function () {
var demo1 = function() {
$('#demo1').Jcrop();
}
var demo2 = function() {
var jcrop_api;
$('#demo2').Jcrop({
onChange: showCoords,
onSelect: showCoords,
onRelease: clearCoords
},function(){
jcrop_api = this;
});
$('#coords').on('change','input',function(e){
var x1 = $('#x1').val(),
x2 = $('#x2').val(),
y1 = $('#y1').val(),
y2 = $('#y2').val();
jcrop_api.setSelect([x1,y1,x2,y2]);
});
// Simple event handler, called from onChange and onSelect
// event handlers, as per the Jcrop invocation above
function showCoords(c)
{
$('#x1').val(c.x);
$('#y1').val(c.y);
$('#x2').val(c.x2);
$('#y2').val(c.y2);
$('#w').val(c.w);
$('#h').val(c.h);
};
function clearCoords()
{
$('#coords input').val('');
};
}
var demo3 = function() {
// Create variables (in this scope) to hold the API and image size
var jcrop_api,
boundx,
boundy,
// Grab some information about the preview pane
$preview = $('#preview-pane'),
$pcnt = $('#preview-pane .preview-container'),
$pimg = $('#preview-pane .preview-container img'),
xsize = $pcnt.width(),
ysize = $pcnt.height();
console.log('init',[xsize,ysize]);
$('#demo3').Jcrop({
onChange: updatePreview,
onSelect: updatePreview,
aspectRatio: xsize / ysize
},function(){
// Use the API to get the real image size
var bounds = this.getBounds();
boundx = bounds[0];
boundy = bounds[1];
// Store the API in the jcrop_api variable
jcrop_api = this;
// Move the preview into the jcrop container for css positioning
$preview.appendTo(jcrop_api.ui.holder);
});
function updatePreview(c)
{
if (parseInt(c.w) > 0)
{
var rx = xsize / c.w;
var ry = ysize / c.h;
$pimg.css({
width: Math.round(rx * boundx) + 'px',
height: Math.round(ry * boundy) + 'px',
marginLeft: '-' + Math.round(rx * c.x) + 'px',
marginTop: '-' + Math.round(ry * c.y) + 'px'
});
}
};
}
var demo4 = function() {
var jcrop_api;
$('#demo4').Jcrop({
bgFade: true,
bgOpacity: .2,
setSelect: [ 60, 70, 540, 330 ]
},function(){
jcrop_api = this;
});
$('#fadetog').change(function(){
jcrop_api.setOptions({
bgFade: this.checked
});
}).attr('checked', true);
$('#shadetog').change(function(){
if (this.checked) $('#shadetxt').slideDown();
else $('#shadetxt').slideUp();
jcrop_api.setOptions({
shade: this.checked
});
}).attr('checked', false);
// Define page sections
var sections = {
bgc_buttons: 'Change bgColor',
bgo_buttons: 'Change bgOpacity',
anim_buttons: 'Animate Selection'
};
// Define animation buttons
var ac = {
anim1: [217,122,382,284],
anim2: [20,20,580,380],
anim3: [24,24,176,376],
anim4: [347,165,550,355],
anim5: [136,55,472,183]
};
// Define bgOpacity buttons
var bgo = {
Low: .2,
Mid: .5,
High: .8,
Full: 1
};
// Define bgColor buttons
var bgc = {
R: '#900',
B: '#4BB6F0',
Y: '#F0B207',
G: '#46B81C',
W: 'white',
K: 'black'
};
// Create fieldset targets for buttons
for(i in sections)
insertSection(i,sections[i]);
function create_btn(c) {
var $o = $('<button />').addClass('btn small');
if (c) $o.append(c);
return $o;
}
var a_count = 1;
// Create animation buttons
for(i in ac) {
$('#anim_buttons .btn-group')
.append(
create_btn(a_count++).click(animHandler(ac[i])),
' '
);
}
$('#anim_buttons .btn-group').append(
create_btn('Bye!').click(function(e){
$(e.target).addClass('active');
jcrop_api.animateTo(
[300,200,300,200],
function(){
this.release();
$(e.target).closest('.btn-group').find('.active').removeClass('active');
}
);
return false;
})
);
// Create bgOpacity buttons
for(i in bgo) {
$('#bgo_buttons .btn-group').append(
create_btn(i).click(setoptHandler('bgOpacity',bgo[i])),
' '
);
}
// Create bgColor buttons
for(i in bgc) {
$('#bgc_buttons .btn-group').append(
create_btn(i).css({
background: bgc[i],
color: ((i == 'K') || (i == 'R'))?'white':'black'
}).click(setoptHandler('bgColor',bgc[i])), ' '
);
}
// Function to insert named sections into interface
function insertSection(k,v) {
$('#interface').prepend(
$('<fieldset></fieldset>').attr('id',k).append(
$('<h4></h4>').append(v),
'<div class="btn-toolbar"><div class="btn-group"></div></div>'
)
);
};
// Handler for option-setting buttons
function setoptHandler(k,v) {
return function(e) {
$(e.target).closest('.btn-group').find('.active').removeClass('active');
$(e.target).addClass('active');
var opt = { };
opt[k] = v;
jcrop_api.setOptions(opt);
return false;
};
};
// Handler for animation buttons
function animHandler(v) {
return function(e) {
$(e.target).addClass('active');
jcrop_api.animateTo(v,function(){
$(e.target).closest('.btn-group').find('.active').removeClass('active');
});
return false;
};
};
$('#bgo_buttons .btn:first,#bgc_buttons .btn:last').addClass('active');
$('#interface').show();
}
var demo5 = function() {
// The variable jcrop_api will hold a reference to the
// Jcrop API once Jcrop is instantiated.
var jcrop_api;
// In this example, since Jcrop may be attached or detached
// at the whim of the user, I've wrapped the call into a function
initJcrop();
// The function is pretty simple
function initJcrop()//{{{
{
// Hide any interface elements that require Jcrop
// (This is for the local user interface portion.)
$('.requiresjcrop').hide();
// Invoke Jcrop in typical fashion
$('#demo5').Jcrop({
onRelease: releaseCheck
},function(){
jcrop_api = this;
jcrop_api.animateTo([100,100,400,300]);
// Setup and dipslay the interface for "enabled"
$('#can_click,#can_move,#can_size').attr('checked','checked');
$('#ar_lock,#size_lock,#bg_swap').attr('checked',false);
$('.requiresjcrop').show();
});
};
//}}}
// Use the API to find cropping dimensions
// Then generate a random selection
// This function is used by setSelect and animateTo buttons
// Mainly for demonstration purposes
function getRandom() {
var dim = jcrop_api.getBounds();
return [
Math.round(Math.random() * dim[0]),
Math.round(Math.random() * dim[1]),
Math.round(Math.random() * dim[0]),
Math.round(Math.random() * dim[1])
];
};
// This function is bound to the onRelease handler...
// In certain circumstances (such as if you set minSize
// and aspectRatio together), you can inadvertently lose
// the selection. This callback re-enables creating selections
// in such a case. Although the need to do this is based on a
// buggy behavior, it's recommended that you in some way trap
// the onRelease callback if you use allowSelect: false
function releaseCheck()
{
jcrop_api.setOptions({ allowSelect: true });
$('#can_click').attr('checked',false);
};
// Attach interface buttons
// This may appear to be a lot of code but it's simple stuff
$('#setSelect').click(function(e) {
// Sets a random selection
jcrop_api.setSelect(getRandom());
});
$('#animateTo').click(function(e) {
// Animates to a random selection
jcrop_api.animateTo(getRandom());
});
$('#release').click(function(e) {
// Release method clears the selection
jcrop_api.release();
});
$('#disable').click(function(e) {
// Disable Jcrop instance
jcrop_api.disable();
// Update the interface to reflect disabled state
$('#enable').show();
$('.requiresjcrop').hide();
});
$('#enable').click(function(e) {
// Re-enable Jcrop instance
jcrop_api.enable();
// Update the interface to reflect enabled state
$('#enable').hide();
$('.requiresjcrop').show();
});
$('#rehook').click(function(e) {
// This button is visible when Jcrop has been destroyed
// It performs the re-attachment and updates the UI
$('#rehook,#enable').hide();
initJcrop();
$('#unhook,.requiresjcrop').show();
return false;
});
$('#unhook').click(function(e) {
// Destroy Jcrop widget, restore original state
jcrop_api.destroy();
// Update the interface to reflect un-attached state
$('#unhook,#enable,.requiresjcrop').hide();
$('#rehook').show();
return false;
});
// Hook up the three image-swapping buttons
$('#img1').click(function(e) {
$(this).addClass('active').closest('.btn-group')
.find('button.active').not(this).removeClass('active');
jcrop_api.setImage('../../assets/global/plugins/jcrop/demos/demo_files/sago.jpg');
jcrop_api.setOptions({ bgOpacity: .6 });
return false;
});
$('#img2').click(function(e) {
$(this).addClass('active').closest('.btn-group')
.find('button.active').not(this).removeClass('active');
jcrop_api.setImage('../../assets/global/plugins/jcrop/demos/demo_files/pool.jpg');
jcrop_api.setOptions({ bgOpacity: .6 });
return false;
});
$('#img3').click(function(e) {
$(this).addClass('active').closest('.btn-group')
.find('button.active').not(this).removeClass('active');
jcrop_api.setImage('../../assets/global/plugins/jcrop/demos/demo_files/sago.jpg',function(){
this.setOptions({
bgOpacity: 1,
outerImage: '../../assets/global/plugins/jcrop/demos/demo_files/sagomod.jpg'
});
this.animateTo(getRandom());
});
return false;
});
// The checkboxes simply set options based on it's checked value
// Options are changed by passing a new options object
// Also, to prevent strange behavior, they are initially checked
// This matches the default initial state of Jcrop
$('#can_click').change(function(e) {
jcrop_api.setOptions({ allowSelect: !!this.checked });
jcrop_api.focus();
});
$('#can_move').change(function(e) {
jcrop_api.setOptions({ allowMove: !!this.checked });
jcrop_api.focus();
});
$('#can_size').change(function(e) {
jcrop_api.setOptions({ allowResize: !!this.checked });
jcrop_api.focus();
});
$('#ar_lock').change(function(e) {
jcrop_api.setOptions(this.checked?
{ aspectRatio: 4/3 }: { aspectRatio: 0 });
jcrop_api.focus();
});
$('#size_lock').change(function(e) {
jcrop_api.setOptions(this.checked? {
minSize: [ 80, 80 ],
maxSize: [ 350, 350 ]
}: {
minSize: [ 0, 0 ],
maxSize: [ 0, 0 ]
});
jcrop_api.focus();
});
}
var demo6 = function() {
var api;
$('#demo6').Jcrop({
// start off with jcrop-light class
bgOpacity: 0.5,
bgColor: 'white',
addClass: 'jcrop-light'
},function(){
api = this;
api.setSelect([130,65,130+350,65+285]);
api.setOptions({ bgFade: true });
api.ui.selection.addClass('jcrop-selection');
});
$('#buttonbar').on('click','button',function(e){
var $t = $(this), $g = $t.closest('.btn-group');
$g.find('button.active').removeClass('active');
$t.addClass('active');
$g.find('[data-setclass]').each(function(){
var $th = $(this), c = $th.data('setclass'),
a = $th.hasClass('active');
if (a) {
api.ui.holder.addClass(c);
switch(c){
case 'jcrop-light':
api.setOptions({ bgColor: 'white', bgOpacity: 0.5 });
break;
case 'jcrop-dark':
api.setOptions({ bgColor: 'black', bgOpacity: 0.4 });
break;
case 'jcrop-normal':
api.setOptions({
bgColor: $.Jcrop.defaults.bgColor,
bgOpacity: $.Jcrop.defaults.bgOpacity
});
break;
}
}
else api.ui.holder.removeClass(c);
});
});
}
var demo7 = function() {
// I did JSON.stringify(jcrop_api.tellSelect()) on a crop I liked:
var c = {"x":13,"y":7,"x2":487,"y2":107,"w":474,"h":100};
$('#demo7').Jcrop({
bgFade: true,
setSelect: [c.x,c.y,c.x2,c.y2]
});
}
var demo8 = function() {
$('#demo8').Jcrop({
aspectRatio: 1,
onSelect: updateCoords
});
function updateCoords(c)
{
$('#crop_x').val(c.x);
$('#crop_y').val(c.y);
$('#crop_w').val(c.w);
$('#crop_h').val(c.h);
};
$('#demo8_form').submit(function(){
if (parseInt($('#crop_w').val())) return true;
alert('Please select a crop region then press submit.');
return false;
});
}
var handleResponsive = function() {
if ($(window).width() <= 1024 && $(window).width() >= 678) {
$('.responsive-1024').each(function(){
$(this).attr("data-class", $(this).attr("class"));
$(this).attr("class", 'responsive-1024 col-md-12');
});
} else {
$('.responsive-1024').each(function(){
if ($(this).attr("data-class")) {
$(this).attr("class", $(this).attr("data-class"));
$(this).removeAttr("data-class");
}
});
}
}
return {
//main function to initiate the module
init: function () {
if (!jQuery().Jcrop) {;
return;
}
App.addResizeHandler(handleResponsive);
handleResponsive();
demo1();
demo2();
demo3();
demo4();
demo5();
demo6();
demo7();
demo8();
}
};
}();
jQuery(document).ready(function() {
FormImageCrop.init();
});
File diff suppressed because one or more lines are too long
+66
View File
@@ -0,0 +1,66 @@
var FormInputMask = function () {
var handleInputMasks = function () {
$("#mask_date").inputmask("d/m/y", {
autoUnmask: true
}); //direct mask
$("#mask_date1").inputmask("d/m/y", {
"placeholder": "*"
}); //change the placeholder
$("#mask_date2").inputmask("d/m/y", {
"placeholder": "dd/mm/yyyy"
}); //multi-char placeholder
$("#mask_phone").inputmask("mask", {
"mask": "(999) 999-9999"
}); //specifying fn & options
$("#mask_tin").inputmask({
"mask": "99-9999999",
placeholder: "" // remove underscores from the input mask
}); //specifying options only
$("#mask_number").inputmask({
"mask": "9",
"repeat": 10,
"greedy": false
}); // ~ mask "9" or mask "99" or ... mask "9999999999"
$("#mask_decimal").inputmask('decimal', {
rightAlignNumerics: false
}); //disables the right alignment of the decimal input
$("#mask_currency").inputmask('€ 999.999.999,99', {
numericInput: true
}); //123456 => € ___.__1.234,56
$("#mask_currency2").inputmask('€ 999,999,999.99', {
numericInput: true,
rightAlignNumerics: false,
greedy: false
}); //123456 => € ___.__1.234,56
$("#mask_ssn").inputmask("999-99-9999", {
placeholder: " ",
clearMaskOnLostFocus: true
}); //default
}
var handleIPAddressInput = function () {
$('#input_ipv4').ipAddress();
$('#input_ipv6').ipAddress({
v: 6
});
}
return {
//main function to initiate the module
init: function () {
handleInputMasks();
handleIPAddressInput();
}
};
}();
if (App.isAngularJsApp() === false) {
jQuery(document).ready(function() {
FormInputMask.init(); // init metronic core componets
});
}
+1
View File
@@ -0,0 +1 @@
var FormInputMask=function(){var a=function(){$("#mask_date").inputmask("d/m/y",{autoUnmask:!0}),$("#mask_date1").inputmask("d/m/y",{placeholder:"*"}),$("#mask_date2").inputmask("d/m/y",{placeholder:"dd/mm/yyyy"}),$("#mask_phone").inputmask("mask",{mask:"(999) 999-9999"}),$("#mask_tin").inputmask({mask:"99-9999999",placeholder:""}),$("#mask_number").inputmask({mask:"9",repeat:10,greedy:!1}),$("#mask_decimal").inputmask("decimal",{rightAlignNumerics:!1}),$("#mask_currency").inputmask("€ 999.999.999,99",{numericInput:!0}),$("#mask_currency2").inputmask("€ 999,999,999.99",{numericInput:!0,rightAlignNumerics:!1,greedy:!1}),$("#mask_ssn").inputmask("999-99-9999",{placeholder:" ",clearMaskOnLostFocus:!0})},n=function(){$("#input_ipv4").ipAddress(),$("#input_ipv6").ipAddress({v:6})};return{init:function(){a(),n()}}}();App.isAngularJsApp()===!1&&jQuery(document).ready(function(){FormInputMask.init()});
+37
View File
@@ -0,0 +1,37 @@
var FormRepeater = function () {
return {
//main function to initiate the module
init: function () {
$('.mt-repeater').each(function(){
$(this).repeater({
show: function () {
$(this).slideDown();
$('.date-picker').datepicker({
rtl: App.isRTL(),
orientation: "left",
autoclose: true
});
},
hide: function (deleteElement) {
if(confirm('Are you sure you want to delete this element?')) {
$(this).slideUp(deleteElement);
}
},
ready: function (setIndexes) {
}
});
});
}
};
}();
jQuery(document).ready(function() {
FormRepeater.init();
});
+1
View File
@@ -0,0 +1 @@
var FormRepeater=function(){return{init:function(){$(".mt-repeater").each(function(){$(this).repeater({show:function(){$(this).slideDown(),$(".date-picker").datepicker({rtl:App.isRTL(),orientation:"left",autoclose:!0})},hide:function(e){confirm("Are you sure you want to delete this element?")&&$(this).slideUp(e)},ready:function(e){}})})}}}();jQuery(document).ready(function(){FormRepeater.init()});
+16
View File
@@ -0,0 +1,16 @@
var FormSamples = function () {
return {
//main function to initiate the module
init: function () {
}
};
}();
jQuery(document).ready(function() {
FormSamples.init();
});
+1
View File
@@ -0,0 +1 @@
var FormSamples=function(){return{init:function(){}}}();jQuery(document).ready(function(){FormSamples.init()});
+391
View File
@@ -0,0 +1,391 @@
var FormValidationMd = function() {
var handleValidation1 = function() {
// for more info visit the official plugin documentation:
// http://docs.jquery.com/Plugins/Validation
var form1 = $('#form_sample_1');
var error1 = $('.alert-danger', form1);
var success1 = $('.alert-success', form1);
form1.validate({
errorElement: 'span', //default input error message container
errorClass: 'help-block help-block-error', // default input error message class
focusInvalid: false, // do not focus the last invalid input
ignore: "", // validate all fields including form hidden input
messages: {
payment: {
maxlength: jQuery.validator.format("Max {0} items allowed for selection"),
minlength: jQuery.validator.format("At least {0} items must be selected")
},
'checkboxes1[]': {
required: 'Please check some options',
minlength: jQuery.validator.format("At least {0} items must be selected"),
},
'checkboxes2[]': {
required: 'Please check some options',
minlength: jQuery.validator.format("At least {0} items must be selected"),
}
},
rules: {
name: {
minlength: 2,
required: true
},
email: {
required: true,
email: true
},
email2: {
required: true,
email: true
},
url: {
required: true,
url: true
},
url2: {
required: true,
url: true
},
number: {
required: true,
number: true
},
number2: {
required: true,
number: true
},
digits: {
required: true,
digits: true
},
creditcard: {
required: true,
creditcard: true
},
delivery: {
required: true
},
payment: {
required: true,
minlength: 2,
maxlength: 4
},
memo: {
required: true,
minlength: 10,
maxlength: 40
},
'checkboxes1[]': {
required: true,
minlength: 2,
},
'checkboxes2[]': {
required: true,
minlength: 3,
},
radio1: {
required: true
},
radio2: {
required: true
}
},
invalidHandler: function(event, validator) { //display error alert on form submit
success1.hide();
error1.show();
App.scrollTo(error1, -200);
},
errorPlacement: function(error, element) {
if (element.is(':checkbox')) {
error.insertAfter(element.closest(".md-checkbox-list, .md-checkbox-inline, .checkbox-list, .checkbox-inline"));
} else if (element.is(':radio')) {
error.insertAfter(element.closest(".md-radio-list, .md-radio-inline, .radio-list,.radio-inline"));
} else {
error.insertAfter(element); // for other inputs, just perform default behavior
}
},
highlight: function(element) { // hightlight error inputs
$(element)
.closest('.form-group').addClass('has-error'); // set error class to the control group
},
unhighlight: function(element) { // revert the change done by hightlight
$(element)
.closest('.form-group').removeClass('has-error'); // set error class to the control group
},
success: function(label) {
label
.closest('.form-group').removeClass('has-error'); // set success class to the control group
},
submitHandler: function(form) {
success1.show();
error1.hide();
}
});
}
var handleValidation2 = function() {
// for more info visit the official plugin documentation:
// http://docs.jquery.com/Plugins/Validation
var form1 = $('#form_sample_2');
var error1 = $('.alert-danger', form1);
var success1 = $('.alert-success', form1);
form1.validate({
errorElement: 'span', //default input error message container
errorClass: 'help-block help-block-error', // default input error message class
focusInvalid: false, // do not focus the last invalid input
ignore: "", // validate all fields including form hidden input
messages: {
payment: {
maxlength: jQuery.validator.format("Max {0} items allowed for selection"),
minlength: jQuery.validator.format("At least {0} items must be selected")
},
'checkboxes1[]': {
required: 'Please check some options',
minlength: jQuery.validator.format("At least {0} items must be selected"),
},
'checkboxes2[]': {
required: 'Please check some options',
minlength: jQuery.validator.format("At least {0} items must be selected"),
}
},
rules: {
name: {
minlength: 2,
required: true
},
email: {
required: true,
email: true
},
email2: {
required: true,
email: true
},
url: {
required: true,
url: true
},
url2: {
required: true,
url: true
},
number: {
required: true,
number: true
},
number2: {
required: true,
number: true
},
digits: {
required: true,
digits: true
},
creditcard: {
required: true,
creditcard: true
},
delivery: {
required: true
},
payment: {
required: true,
minlength: 2,
maxlength: 4
},
memo: {
required: true,
minlength: 10,
maxlength: 40
},
'checkboxes1[]': {
required: true,
minlength: 2,
},
'checkboxes2[]': {
required: true,
minlength: 3,
},
radio1: {
required: true
},
radio2: {
required: true
}
},
invalidHandler: function(event, validator) { //display error alert on form submit
success1.hide();
error1.show();
App.scrollTo(error1, -200);
},
errorPlacement: function(error, element) {
if (element.is(':checkbox')) {
error.insertAfter(element.closest(".md-checkbox-list, .md-checkbox-inline, .checkbox-list, .checkbox-inline"));
} else if (element.is(':radio')) {
error.insertAfter(element.closest(".md-radio-list, .md-radio-inline, .radio-list,.radio-inline"));
} else {
error.insertAfter(element); // for other inputs, just perform default behavior
}
},
highlight: function(element) { // hightlight error inputs
$(element)
.closest('.form-group').addClass('has-error'); // set error class to the control group
},
unhighlight: function(element) { // revert the change done by hightlight
$(element)
.closest('.form-group').removeClass('has-error'); // set error class to the control group
},
success: function(label) {
label
.closest('.form-group').removeClass('has-error'); // set success class to the control group
},
submitHandler: function(form) {
success1.show();
error1.hide();
}
});
}
var handleValidation3 = function() {
// for more info visit the official plugin documentation:
// http://docs.jquery.com/Plugins/Validation
var form1 = $('#form_sample_3');
var error1 = $('.alert-danger', form1);
var success1 = $('.alert-success', form1);
form1.validate({
errorElement: 'span', //default input error message container
errorClass: 'help-block help-block-error', // default input error message class
focusInvalid: false, // do not focus the last invalid input
ignore: "", // validate all fields including form hidden input
messages: {
payment: {
maxlength: jQuery.validator.format("Max {0} items allowed for selection"),
minlength: jQuery.validator.format("At least {0} items must be selected")
},
'checkboxes1[]': {
required: 'Please check some options',
minlength: jQuery.validator.format("At least {0} items must be selected"),
},
'checkboxes2[]': {
required: 'Please check some options',
minlength: jQuery.validator.format("At least {0} items must be selected"),
}
},
rules: {
name: {
minlength: 2,
required: true
},
email: {
required: true,
email: true
},
email2: {
required: true,
email: true
},
url: {
required: true,
url: true
},
url2: {
required: true,
url: true
},
number: {
required: true,
number: true
},
number2: {
required: true,
number: true
},
digits: {
required: true,
digits: true
},
creditcard: {
required: true,
creditcard: true
},
delivery: {
required: true
},
payment: {
required: true,
minlength: 2,
maxlength: 4
},
memo: {
required: true,
minlength: 10,
maxlength: 40
}
},
invalidHandler: function(event, validator) { //display error alert on form submit
success1.hide();
error1.show();
App.scrollTo(error1, -200);
},
errorPlacement: function(error, element) {
if (element.is(':checkbox')) {
error.insertAfter(element.closest(".md-checkbox-list, .md-checkbox-inline, .checkbox-list, .checkbox-inline"));
} else if (element.is(':radio')) {
error.insertAfter(element.closest(".md-radio-list, .md-radio-inline, .radio-list,.radio-inline"));
} else {
error.insertAfter(element); // for other inputs, just perform default behavior
}
},
highlight: function(element) { // hightlight error inputs
$(element)
.closest('.form-group').addClass('has-error'); // set error class to the control group
},
unhighlight: function(element) { // revert the change done by hightlight
$(element)
.closest('.form-group').removeClass('has-error'); // set error class to the control group
},
success: function(label) {
label
.closest('.form-group').removeClass('has-error'); // set success class to the control group
},
submitHandler: function(form) {
success1.show();
error1.hide();
}
});
}
return {
//main function to initiate the module
init: function() {
handleValidation1();
handleValidation2();
handleValidation3();
}
};
}();
jQuery(document).ready(function() {
FormValidationMd.init();
});
File diff suppressed because one or more lines are too long
+358
View File
@@ -0,0 +1,358 @@
var FormValidation = function () {
// basic validation
var handleValidation1 = function() {
// for more info visit the official plugin documentation:
// http://docs.jquery.com/Plugins/Validation
var form1 = $('#form_sample_1');
var error1 = $('.alert-danger', form1);
var success1 = $('.alert-success', form1);
form1.validate({
errorElement: 'span', //default input error message container
errorClass: 'help-block help-block-error', // default input error message class
focusInvalid: false, // do not focus the last invalid input
ignore: "", // validate all fields including form hidden input
messages: {
select_multi: {
maxlength: jQuery.validator.format("Max {0} items allowed for selection"),
minlength: jQuery.validator.format("At least {0} items must be selected")
}
},
rules: {
name: {
minlength: 2,
required: true
},
input_group: {
email: true,
required: true
},
email: {
required: true,
email: true
},
url: {
required: true,
url: true
},
number: {
required: true,
number: true
},
digits: {
required: true,
digits: true
},
creditcard: {
required: true,
creditcard: true
},
occupation: {
minlength: 5,
},
select: {
required: true
},
select_multi: {
required: true,
minlength: 1,
maxlength: 3
}
},
invalidHandler: function (event, validator) { //display error alert on form submit
success1.hide();
error1.show();
App.scrollTo(error1, -200);
},
errorPlacement: function (error, element) { // render error placement for each input type
var cont = $(element).parent('.input-group');
if (cont.size() > 0) {
cont.after(error);
} else {
element.after(error);
}
},
highlight: function (element) { // hightlight error inputs
$(element)
.closest('.form-group').addClass('has-error'); // set error class to the control group
},
unhighlight: function (element) { // revert the change done by hightlight
$(element)
.closest('.form-group').removeClass('has-error'); // set error class to the control group
},
success: function (label) {
label
.closest('.form-group').removeClass('has-error'); // set success class to the control group
},
submitHandler: function (form) {
success1.show();
error1.hide();
}
});
}
// validation using icons
var handleValidation2 = function() {
// for more info visit the official plugin documentation:
// http://docs.jquery.com/Plugins/Validation
var form2 = $('#form_sample_2');
var error2 = $('.alert-danger', form2);
var success2 = $('.alert-success', form2);
form2.validate({
errorElement: 'span', //default input error message container
errorClass: 'help-block help-block-error', // default input error message class
focusInvalid: false, // do not focus the last invalid input
ignore: "", // validate all fields including form hidden input
rules: {
name: {
minlength: 2,
required: true
},
email: {
required: true,
email: true
},
email: {
required: true,
email: true
},
url: {
required: true,
url: true
},
number: {
required: true,
number: true
},
digits: {
required: true,
digits: true
},
creditcard: {
required: true,
creditcard: true
},
},
invalidHandler: function (event, validator) { //display error alert on form submit
success2.hide();
error2.show();
App.scrollTo(error2, -200);
},
errorPlacement: function (error, element) { // render error placement for each input type
var icon = $(element).parent('.input-icon').children('i');
icon.removeClass('fa-check').addClass("fa-warning");
icon.attr("data-original-title", error.text()).tooltip({'container': 'body'});
},
highlight: function (element) { // hightlight error inputs
$(element)
.closest('.form-group').removeClass("has-success").addClass('has-error'); // set error class to the control group
},
unhighlight: function (element) { // revert the change done by hightlight
},
success: function (label, element) {
var icon = $(element).parent('.input-icon').children('i');
$(element).closest('.form-group').removeClass('has-error').addClass('has-success'); // set success class to the control group
icon.removeClass("fa-warning").addClass("fa-check");
},
submitHandler: function (form) {
success2.show();
error2.hide();
form[0].submit(); // submit the form
}
});
}
// advance validation
var handleValidation3 = function() {
// for more info visit the official plugin documentation:
// http://docs.jquery.com/Plugins/Validation
var form3 = $('#form_sample_3');
var error3 = $('.alert-danger', form3);
var success3 = $('.alert-success', form3);
//IMPORTANT: update CKEDITOR textarea with actual content before submit
form3.on('submit', function() {
for(var instanceName in CKEDITOR.instances) {
CKEDITOR.instances[instanceName].updateElement();
}
})
form3.validate({
errorElement: 'span', //default input error message container
errorClass: 'help-block help-block-error', // default input error message class
focusInvalid: false, // do not focus the last invalid input
ignore: "", // validate all fields including form hidden input
rules: {
name: {
minlength: 2,
required: true
},
email: {
required: true,
email: true
},
options1: {
required: true
},
options2: {
required: true
},
select2tags: {
required: true
},
datepicker: {
required: true
},
occupation: {
minlength: 5,
},
membership: {
required: true
},
service: {
required: true,
minlength: 2
},
markdown: {
required: true
},
editor1: {
required: true
},
editor2: {
required: true
}
},
messages: { // custom messages for radio buttons and checkboxes
membership: {
required: "Please select a Membership type"
},
service: {
required: "Please select at least 2 types of Service",
minlength: jQuery.validator.format("Please select at least {0} types of Service")
}
},
errorPlacement: function (error, element) { // render error placement for each input typeW
if (element.parents('.mt-radio-list').size() > 0 || element.parents('.mt-checkbox-list').size() > 0) {
if (element.parents('.mt-radio-list').size() > 0) {
error.appendTo(element.parents('.mt-radio-list')[0]);
}
if (element.parents('.mt-checkbox-list').size() > 0) {
error.appendTo(element.parents('.mt-checkbox-list')[0]);
}
} else if (element.parents('.mt-radio-inline').size() > 0 || element.parents('.mt-checkbox-inline').size() > 0) {
if (element.parents('.mt-radio-inline').size() > 0) {
error.appendTo(element.parents('.mt-radio-inline')[0]);
}
if (element.parents('.mt-checkbox-inline').size() > 0) {
error.appendTo(element.parents('.mt-checkbox-inline')[0]);
}
} else if (element.parent(".input-group").size() > 0) {
error.insertAfter(element.parent(".input-group"));
} else if (element.attr("data-error-container")) {
error.appendTo(element.attr("data-error-container"));
} else {
error.insertAfter(element); // for other inputs, just perform default behavior
}
},
invalidHandler: function (event, validator) { //display error alert on form submit
success3.hide();
error3.show();
App.scrollTo(error3, -200);
},
highlight: function (element) { // hightlight error inputs
$(element)
.closest('.form-group').addClass('has-error'); // set error class to the control group
},
unhighlight: function (element) { // revert the change done by hightlight
$(element)
.closest('.form-group').removeClass('has-error'); // set error class to the control group
},
success: function (label) {
label
.closest('.form-group').removeClass('has-error'); // set success class to the control group
},
submitHandler: function (form) {
success3.show();
error3.hide();
//form[0].submit(); // submit the form
}
});
//apply validation on select2 dropdown value change, this only needed for chosen dropdown integration.
$('.select2me', form3).change(function () {
form3.validate().element($(this)); //revalidate the chosen dropdown value and show error or success message for the input
});
//initialize datepicker
$('.date-picker').datepicker({
rtl: App.isRTL(),
autoclose: true
});
$('.date-picker .form-control').change(function() {
form3.validate().element($(this)); //revalidate the chosen dropdown value and show error or success message for the input
})
}
var handleWysihtml5 = function() {
if (!jQuery().wysihtml5) {
return;
}
if ($('.wysihtml5').size() > 0) {
$('.wysihtml5').wysihtml5({
"stylesheets": ["../assets/global/plugins/bootstrap-wysihtml5/wysiwyg-color.css"]
});
}
}
return {
//main function to initiate the module
init: function () {
handleWysihtml5();
handleValidation1();
handleValidation2();
handleValidation3();
}
};
}();
jQuery(document).ready(function() {
FormValidation.init();
});
+1
View File
@@ -0,0 +1 @@
var FormValidation=function(){var e=function(){var e=$("#form_sample_1"),r=$(".alert-danger",e),i=$(".alert-success",e);e.validate({errorElement:"span",errorClass:"help-block help-block-error",focusInvalid:!1,ignore:"",messages:{select_multi:{maxlength:jQuery.validator.format("Max {0} items allowed for selection"),minlength:jQuery.validator.format("At least {0} items must be selected")}},rules:{name:{minlength:2,required:!0},input_group:{email:!0,required:!0},email:{required:!0,email:!0},url:{required:!0,url:!0},number:{required:!0,number:!0},digits:{required:!0,digits:!0},creditcard:{required:!0,creditcard:!0},occupation:{minlength:5},select:{required:!0},select_multi:{required:!0,minlength:1,maxlength:3}},invalidHandler:function(e,t){i.hide(),r.show(),App.scrollTo(r,-200)},errorPlacement:function(e,r){var i=$(r).parent(".input-group");i.size()>0?i.after(e):r.after(e)},highlight:function(e){$(e).closest(".form-group").addClass("has-error")},unhighlight:function(e){$(e).closest(".form-group").removeClass("has-error")},success:function(e){e.closest(".form-group").removeClass("has-error")},submitHandler:function(e){i.show(),r.hide()}})},r=function(){var e=$("#form_sample_2"),r=$(".alert-danger",e),i=$(".alert-success",e);e.validate({errorElement:"span",errorClass:"help-block help-block-error",focusInvalid:!1,ignore:"",rules:{name:{minlength:2,required:!0},email:{required:!0,email:!0},email:{required:!0,email:!0},url:{required:!0,url:!0},number:{required:!0,number:!0},digits:{required:!0,digits:!0},creditcard:{required:!0,creditcard:!0}},invalidHandler:function(e,t){i.hide(),r.show(),App.scrollTo(r,-200)},errorPlacement:function(e,r){var i=$(r).parent(".input-icon").children("i");i.removeClass("fa-check").addClass("fa-warning"),i.attr("data-original-title",e.text()).tooltip({container:"body"})},highlight:function(e){$(e).closest(".form-group").removeClass("has-success").addClass("has-error")},unhighlight:function(e){},success:function(e,r){var i=$(r).parent(".input-icon").children("i");$(r).closest(".form-group").removeClass("has-error").addClass("has-success"),i.removeClass("fa-warning").addClass("fa-check")},submitHandler:function(e){i.show(),r.hide(),e[0].submit()}})},i=function(){var e=$("#form_sample_3"),r=$(".alert-danger",e),i=$(".alert-success",e);e.on("submit",function(){for(var e in CKEDITOR.instances)CKEDITOR.instances[e].updateElement()}),e.validate({errorElement:"span",errorClass:"help-block help-block-error",focusInvalid:!1,ignore:"",rules:{name:{minlength:2,required:!0},email:{required:!0,email:!0},options1:{required:!0},options2:{required:!0},select2tags:{required:!0},datepicker:{required:!0},occupation:{minlength:5},membership:{required:!0},service:{required:!0,minlength:2},markdown:{required:!0},editor1:{required:!0},editor2:{required:!0}},messages:{membership:{required:"Please select a Membership type"},service:{required:"Please select at least 2 types of Service",minlength:jQuery.validator.format("Please select at least {0} types of Service")}},errorPlacement:function(e,r){r.parents(".mt-radio-list").size()>0||r.parents(".mt-checkbox-list").size()>0?(r.parents(".mt-radio-list").size()>0&&e.appendTo(r.parents(".mt-radio-list")[0]),r.parents(".mt-checkbox-list").size()>0&&e.appendTo(r.parents(".mt-checkbox-list")[0])):r.parents(".mt-radio-inline").size()>0||r.parents(".mt-checkbox-inline").size()>0?(r.parents(".mt-radio-inline").size()>0&&e.appendTo(r.parents(".mt-radio-inline")[0]),r.parents(".mt-checkbox-inline").size()>0&&e.appendTo(r.parents(".mt-checkbox-inline")[0])):r.parent(".input-group").size()>0?e.insertAfter(r.parent(".input-group")):r.attr("data-error-container")?e.appendTo(r.attr("data-error-container")):e.insertAfter(r)},invalidHandler:function(e,t){i.hide(),r.show(),App.scrollTo(r,-200)},highlight:function(e){$(e).closest(".form-group").addClass("has-error")},unhighlight:function(e){$(e).closest(".form-group").removeClass("has-error")},success:function(e){e.closest(".form-group").removeClass("has-error")},submitHandler:function(e){i.show(),r.hide()}}),$(".select2me",e).change(function(){e.validate().element($(this))}),$(".date-picker").datepicker({rtl:App.isRTL(),autoclose:!0}),$(".date-picker .form-control").change(function(){e.validate().element($(this))})},t=function(){jQuery().wysihtml5&&$(".wysihtml5").size()>0&&$(".wysihtml5").wysihtml5({stylesheets:["../assets/global/plugins/bootstrap-wysihtml5/wysiwyg-color.css"]})};return{init:function(){t(),e(),r(),i()}}}();jQuery(document).ready(function(){FormValidation.init()});

Some files were not shown because too many files have changed in this diff Show More