Added Docs - Initial draft
This commit is contained in:
59
assets/demo/dashboard/free/demo.css
Normal file
59
assets/demo/dashboard/free/demo.css
Normal file
@ -0,0 +1,59 @@
|
||||
.tim-row{
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.tim-white-buttons {
|
||||
background-color: #777777;
|
||||
}
|
||||
.typography-line{
|
||||
padding-left: 25%;
|
||||
margin-bottom: 35px;
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
.typography-line span{
|
||||
bottom: 10px;
|
||||
color: #c0c1c2;
|
||||
display: block;
|
||||
font-weight: 400;
|
||||
font-size: 13px;
|
||||
line-height: 13px;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
width: 260px;
|
||||
text-transform: none;
|
||||
}
|
||||
.tim-row{
|
||||
padding-top: 60px;
|
||||
}
|
||||
.tim-row h3{
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.offline-doc .page-header{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.offline-doc .footer{
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
background: transparent;
|
||||
bottom: 0;
|
||||
color: #fff;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
@media all and (min-width: 992px) {
|
||||
.sidebar .nav>li.active-pro {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.card.card-upgrade .card-category{
|
||||
max-width: 530px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
792
assets/demo/dashboard/free/demo.js
Normal file
792
assets/demo/dashboard/free/demo.js
Normal file
@ -0,0 +1,792 @@
|
||||
type = ['primary','info','success','warning','danger'];
|
||||
|
||||
demo = {
|
||||
initPickColor: function(){
|
||||
$('.pick-class-label').click(function(){
|
||||
var new_class = $(this).attr('new-class');
|
||||
var old_class = $('#display-buttons').attr('data-class');
|
||||
var display_div = $('#display-buttons');
|
||||
if(display_div.length) {
|
||||
var display_buttons = display_div.find('.btn');
|
||||
display_buttons.removeClass(old_class);
|
||||
display_buttons.addClass(new_class);
|
||||
display_div.attr('data-class', new_class);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
initDocChart: function(){
|
||||
chartColor = "#FFFFFF";
|
||||
|
||||
// General configuration for the charts with Line gradientStroke
|
||||
gradientChartOptionsConfiguration = {
|
||||
maintainAspectRatio: false,
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
tooltips: {
|
||||
bodySpacing: 4,
|
||||
mode:"nearest",
|
||||
intersect: 0,
|
||||
position:"nearest",
|
||||
xPadding:10,
|
||||
yPadding:10,
|
||||
caretPadding:10
|
||||
},
|
||||
responsive: true,
|
||||
scales: {
|
||||
yAxes: [{
|
||||
display:0,
|
||||
gridLines:0,
|
||||
ticks: {
|
||||
display: false
|
||||
},
|
||||
gridLines: {
|
||||
zeroLineColor: "transparent",
|
||||
drawTicks: false,
|
||||
display: false,
|
||||
drawBorder: false
|
||||
}
|
||||
}],
|
||||
xAxes: [{
|
||||
display:0,
|
||||
gridLines:0,
|
||||
ticks: {
|
||||
display: false
|
||||
},
|
||||
gridLines: {
|
||||
zeroLineColor: "transparent",
|
||||
drawTicks: false,
|
||||
display: false,
|
||||
drawBorder: false
|
||||
}
|
||||
}]
|
||||
},
|
||||
layout:{
|
||||
padding:{left:0,right:0,top:15,bottom:15}
|
||||
}
|
||||
};
|
||||
|
||||
ctx = document.getElementById('lineChartExample').getContext("2d");
|
||||
|
||||
gradientStroke = ctx.createLinearGradient(500, 0, 100, 0);
|
||||
gradientStroke.addColorStop(0, '#80b6f4');
|
||||
gradientStroke.addColorStop(1, chartColor);
|
||||
|
||||
gradientFill = ctx.createLinearGradient(0, 170, 0, 50);
|
||||
gradientFill.addColorStop(0, "rgba(128, 182, 244, 0)");
|
||||
gradientFill.addColorStop(1, "rgba(249, 99, 59, 0.40)");
|
||||
|
||||
myChart = new Chart(ctx, {
|
||||
type: 'line',
|
||||
responsive: true,
|
||||
data: {
|
||||
labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
||||
datasets: [{
|
||||
label: "Active Users",
|
||||
borderColor: "#f96332",
|
||||
pointBorderColor: "#FFF",
|
||||
pointBackgroundColor: "#f96332",
|
||||
pointBorderWidth: 2,
|
||||
pointHoverRadius: 4,
|
||||
pointHoverBorderWidth: 1,
|
||||
pointRadius: 4,
|
||||
fill: true,
|
||||
backgroundColor: gradientFill,
|
||||
borderWidth: 2,
|
||||
data: [542, 480, 430, 550, 530, 453, 380, 434, 568, 610, 700, 630]
|
||||
}]
|
||||
},
|
||||
options: gradientChartOptionsConfiguration
|
||||
});
|
||||
},
|
||||
|
||||
initDashboardPageCharts: function(){
|
||||
|
||||
gradientChartOptionsConfigurationWithTooltipBlue = {
|
||||
maintainAspectRatio: false,
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
|
||||
tooltips: {
|
||||
backgroundColor: '#f5f5f5',
|
||||
titleFontColor: '#333',
|
||||
bodyFontColor: '#666',
|
||||
bodySpacing: 4,
|
||||
xPadding: 12,
|
||||
mode: "nearest",
|
||||
intersect: 0,
|
||||
position: "nearest"
|
||||
},
|
||||
responsive: true,
|
||||
scales:{
|
||||
yAxes: [{
|
||||
barPercentage: 1.6,
|
||||
gridLines: {
|
||||
drawBorder: false,
|
||||
color: 'rgba(29,140,248,0.0)',
|
||||
zeroLineColor: "transparent",
|
||||
},
|
||||
ticks: {
|
||||
suggestedMin: 60,
|
||||
suggestedMax: 125,
|
||||
padding: 20,
|
||||
fontColor: "#2380f7"
|
||||
}
|
||||
}],
|
||||
|
||||
xAxes: [{
|
||||
barPercentage: 1.6,
|
||||
gridLines: {
|
||||
drawBorder: false,
|
||||
color: 'rgba(29,140,248,0.1)',
|
||||
zeroLineColor: "transparent",
|
||||
},
|
||||
ticks: {
|
||||
padding: 20,
|
||||
fontColor: "#2380f7"
|
||||
}
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
gradientChartOptionsConfigurationWithTooltipPurple = {
|
||||
maintainAspectRatio: false,
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
|
||||
tooltips: {
|
||||
backgroundColor: '#f5f5f5',
|
||||
titleFontColor: '#333',
|
||||
bodyFontColor: '#666',
|
||||
bodySpacing: 4,
|
||||
xPadding: 12,
|
||||
mode: "nearest",
|
||||
intersect: 0,
|
||||
position: "nearest"
|
||||
},
|
||||
responsive: true,
|
||||
scales:{
|
||||
yAxes: [{
|
||||
barPercentage: 1.6,
|
||||
gridLines: {
|
||||
drawBorder: false,
|
||||
color: 'rgba(29,140,248,0.0)',
|
||||
zeroLineColor: "transparent",
|
||||
},
|
||||
ticks: {
|
||||
suggestedMin: 60,
|
||||
suggestedMax: 125,
|
||||
padding: 20,
|
||||
fontColor: "#9a9a9a"
|
||||
}
|
||||
}],
|
||||
|
||||
xAxes: [{
|
||||
barPercentage: 1.6,
|
||||
gridLines: {
|
||||
drawBorder: false,
|
||||
color: 'rgba(225,78,202,0.1)',
|
||||
zeroLineColor: "transparent",
|
||||
},
|
||||
ticks: {
|
||||
padding: 20,
|
||||
fontColor: "#9a9a9a"
|
||||
}
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
gradientChartOptionsConfigurationWithTooltipOrange = {
|
||||
maintainAspectRatio: false,
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
|
||||
tooltips: {
|
||||
backgroundColor: '#f5f5f5',
|
||||
titleFontColor: '#333',
|
||||
bodyFontColor: '#666',
|
||||
bodySpacing: 4,
|
||||
xPadding: 12,
|
||||
mode: "nearest",
|
||||
intersect: 0,
|
||||
position: "nearest"
|
||||
},
|
||||
responsive: true,
|
||||
scales:{
|
||||
yAxes: [{
|
||||
barPercentage: 1.6,
|
||||
gridLines: {
|
||||
drawBorder: false,
|
||||
color: 'rgba(29,140,248,0.0)',
|
||||
zeroLineColor: "transparent",
|
||||
},
|
||||
ticks: {
|
||||
suggestedMin:50,
|
||||
suggestedMax: 110,
|
||||
padding: 20,
|
||||
fontColor: "#ff8a76"
|
||||
}
|
||||
}],
|
||||
|
||||
xAxes: [{
|
||||
barPercentage: 1.6,
|
||||
gridLines: {
|
||||
drawBorder: false,
|
||||
color: 'rgba(220,53,69,0.1)',
|
||||
zeroLineColor: "transparent",
|
||||
},
|
||||
ticks: {
|
||||
padding: 20,
|
||||
fontColor: "#ff8a76"
|
||||
}
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
gradientChartOptionsConfigurationWithTooltipGreen = {
|
||||
maintainAspectRatio: false,
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
|
||||
tooltips: {
|
||||
backgroundColor: '#f5f5f5',
|
||||
titleFontColor: '#333',
|
||||
bodyFontColor: '#666',
|
||||
bodySpacing: 4,
|
||||
xPadding: 12,
|
||||
mode: "nearest",
|
||||
intersect: 0,
|
||||
position: "nearest"
|
||||
},
|
||||
responsive: true,
|
||||
scales:{
|
||||
yAxes: [{
|
||||
barPercentage: 1.6,
|
||||
gridLines: {
|
||||
drawBorder: false,
|
||||
color: 'rgba(29,140,248,0.0)',
|
||||
zeroLineColor: "transparent",
|
||||
},
|
||||
ticks: {
|
||||
suggestedMin: 50,
|
||||
suggestedMax: 125,
|
||||
padding: 20,
|
||||
fontColor: "#9e9e9e"
|
||||
}
|
||||
}],
|
||||
|
||||
xAxes: [{
|
||||
barPercentage: 1.6,
|
||||
gridLines: {
|
||||
drawBorder: false,
|
||||
color: 'rgba(0,242,195,0.1)',
|
||||
zeroLineColor: "transparent",
|
||||
},
|
||||
ticks: {
|
||||
padding: 20,
|
||||
fontColor: "#9e9e9e"
|
||||
}
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
gradientBarChartConfiguration = {
|
||||
maintainAspectRatio: false,
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
|
||||
tooltips: {
|
||||
backgroundColor: '#f5f5f5',
|
||||
titleFontColor: '#333',
|
||||
bodyFontColor: '#666',
|
||||
bodySpacing: 4,
|
||||
xPadding: 12,
|
||||
mode: "nearest",
|
||||
intersect: 0,
|
||||
position: "nearest"
|
||||
},
|
||||
responsive: true,
|
||||
scales:{
|
||||
yAxes: [{
|
||||
|
||||
gridLines: {
|
||||
drawBorder: false,
|
||||
color: 'rgba(29,140,248,0.1)',
|
||||
zeroLineColor: "transparent",
|
||||
},
|
||||
ticks: {
|
||||
suggestedMin: 60,
|
||||
suggestedMax: 120,
|
||||
padding: 20,
|
||||
fontColor: "#9e9e9e"
|
||||
}
|
||||
}],
|
||||
|
||||
xAxes: [{
|
||||
|
||||
gridLines: {
|
||||
drawBorder: false,
|
||||
color: 'rgba(29,140,248,0.1)',
|
||||
zeroLineColor: "transparent",
|
||||
},
|
||||
ticks: {
|
||||
padding: 20,
|
||||
fontColor: "#9e9e9e"
|
||||
}
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
var ctx = document.getElementById("chartLinePurple").getContext("2d");
|
||||
|
||||
var gradientStroke = ctx.createLinearGradient(0,230,0,50);
|
||||
|
||||
gradientStroke.addColorStop(1, 'rgba(72,72,176,0.2)');
|
||||
gradientStroke.addColorStop(0.2, 'rgba(72,72,176,0.0)');
|
||||
gradientStroke.addColorStop(0, 'rgba(119,52,169,0)'); //purple colors
|
||||
|
||||
var data = {
|
||||
labels: ['JUL','AUG','SEP','OCT','NOV','DEC'],
|
||||
datasets: [{
|
||||
label: "Data",
|
||||
fill: true,
|
||||
backgroundColor: gradientStroke,
|
||||
borderColor: '#d048b6',
|
||||
borderWidth: 2,
|
||||
borderDash: [],
|
||||
borderDashOffset: 0.0,
|
||||
pointBackgroundColor: '#d048b6',
|
||||
pointBorderColor:'rgba(255,255,255,0)',
|
||||
pointHoverBackgroundColor: '#d048b6',
|
||||
pointBorderWidth: 20,
|
||||
pointHoverRadius: 4,
|
||||
pointHoverBorderWidth: 15,
|
||||
pointRadius: 4,
|
||||
data: [ 80, 100, 70, 80, 120, 80],
|
||||
}]
|
||||
};
|
||||
|
||||
var myChart = new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: data,
|
||||
options: gradientChartOptionsConfigurationWithTooltipPurple
|
||||
});
|
||||
|
||||
|
||||
var ctxGreen = document.getElementById("chartLineGreen").getContext("2d");
|
||||
|
||||
var gradientStroke = ctx.createLinearGradient(0,230,0,50);
|
||||
|
||||
gradientStroke.addColorStop(1, 'rgba(66,134,121,0.15)');
|
||||
gradientStroke.addColorStop(0.4, 'rgba(66,134,121,0.0)'); //green colors
|
||||
gradientStroke.addColorStop(0, 'rgba(66,134,121,0)'); //green colors
|
||||
|
||||
var data = {
|
||||
labels: ['JUL','AUG','SEP','OCT','NOV'],
|
||||
datasets: [{
|
||||
label: "My First dataset",
|
||||
fill: true,
|
||||
backgroundColor: gradientStroke,
|
||||
borderColor: '#00d6b4',
|
||||
borderWidth: 2,
|
||||
borderDash: [],
|
||||
borderDashOffset: 0.0,
|
||||
pointBackgroundColor: '#00d6b4',
|
||||
pointBorderColor:'rgba(255,255,255,0)',
|
||||
pointHoverBackgroundColor: '#00d6b4',
|
||||
pointBorderWidth: 20,
|
||||
pointHoverRadius: 4,
|
||||
pointHoverBorderWidth: 15,
|
||||
pointRadius: 4,
|
||||
data: [ 90, 27, 60, 12, 80],
|
||||
}]
|
||||
};
|
||||
|
||||
var myChart = new Chart(ctxGreen, {
|
||||
type: 'line',
|
||||
data: data,
|
||||
options: gradientChartOptionsConfigurationWithTooltipGreen
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
var chart_labels = ['JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC'];
|
||||
var chart_data = [ 100, 70, 90, 70, 85, 60, 75, 60, 90, 80,110, 100];
|
||||
|
||||
|
||||
var ctx = document.getElementById("chartBig1").getContext('2d');
|
||||
|
||||
var gradientStroke = ctx.createLinearGradient(0,230,0,50);
|
||||
|
||||
gradientStroke.addColorStop(1, 'rgba(72,72,176,0.1)');
|
||||
gradientStroke.addColorStop(0.4, 'rgba(72,72,176,0.0)');
|
||||
gradientStroke.addColorStop(0, 'rgba(119,52,169,0)'); //purple colors
|
||||
var config = {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: chart_labels,
|
||||
datasets: [{
|
||||
label: "My First dataset",
|
||||
fill: true,
|
||||
backgroundColor: gradientStroke,
|
||||
borderColor: '#d346b1',
|
||||
borderWidth: 2,
|
||||
borderDash: [],
|
||||
borderDashOffset: 0.0,
|
||||
pointBackgroundColor: '#d346b1',
|
||||
pointBorderColor:'rgba(255,255,255,0)',
|
||||
pointHoverBackgroundColor: '#d346b1',
|
||||
pointBorderWidth: 20,
|
||||
pointHoverRadius: 4,
|
||||
pointHoverBorderWidth: 15,
|
||||
pointRadius: 4,
|
||||
data: chart_data,
|
||||
}]
|
||||
},
|
||||
options: gradientChartOptionsConfigurationWithTooltipPurple
|
||||
};
|
||||
var myChartData = new Chart(ctx, config);
|
||||
$("#0").click(function() {
|
||||
var data = myChartData.config.data;
|
||||
data.datasets[0].data = chart_data;
|
||||
data.labels = chart_labels;
|
||||
myChartData.update();
|
||||
});
|
||||
$("#1").click(function() {
|
||||
var chart_data = [ 80, 120, 105, 110, 95, 105, 90, 100, 80, 95,70, 120];
|
||||
var data = myChartData.config.data;
|
||||
data.datasets[0].data = chart_data;
|
||||
data.labels = chart_labels;
|
||||
myChartData.update();
|
||||
});
|
||||
|
||||
$("#2").click(function() {
|
||||
var chart_data = [ 60, 80, 65, 130, 80, 105, 90, 130, 70, 115,60, 130];
|
||||
var data = myChartData.config.data;
|
||||
data.datasets[0].data = chart_data;
|
||||
data.labels = chart_labels;
|
||||
myChartData.update();
|
||||
});
|
||||
|
||||
|
||||
var ctx = document.getElementById("CountryChart").getContext("2d");
|
||||
|
||||
var gradientStroke = ctx.createLinearGradient(0,230,0,50);
|
||||
|
||||
gradientStroke.addColorStop(1, 'rgba(29,140,248,0.2)');
|
||||
gradientStroke.addColorStop(0.4, 'rgba(29,140,248,0.0)');
|
||||
gradientStroke.addColorStop(0, 'rgba(29,140,248,0)'); //blue colors
|
||||
|
||||
|
||||
var myChart = new Chart(ctx, {
|
||||
type: 'bar',
|
||||
responsive: true,
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
data: {
|
||||
labels: ['USA','GER','AUS','UK','RO','BR'],
|
||||
datasets: [{
|
||||
label: "Countries",
|
||||
fill: true,
|
||||
backgroundColor: gradientStroke,
|
||||
hoverBackgroundColor: gradientStroke,
|
||||
borderColor: '#1f8ef1',
|
||||
borderWidth: 2,
|
||||
borderDash: [],
|
||||
borderDashOffset: 0.0,
|
||||
data: [ 53, 20, 10, 80, 100, 45],
|
||||
}]
|
||||
},
|
||||
options: gradientBarChartConfiguration
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
initGoogleMaps: function(){
|
||||
var myLatlng = new google.maps.LatLng(40.748817, -73.985428);
|
||||
var mapOptions = {
|
||||
zoom: 13,
|
||||
center: myLatlng,
|
||||
scrollwheel: false, //we disable de scroll over the map, it is a really annoing when you scroll through page
|
||||
styles: [
|
||||
{
|
||||
"elementType": "geometry",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#1d2c4d"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"elementType": "labels.text.fill",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#8ec3b9"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"elementType": "labels.text.stroke",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#1a3646"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "administrative.country",
|
||||
"elementType": "geometry.stroke",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#4b6878"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "administrative.land_parcel",
|
||||
"elementType": "labels.text.fill",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#64779e"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "administrative.province",
|
||||
"elementType": "geometry.stroke",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#4b6878"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "landscape.man_made",
|
||||
"elementType": "geometry.stroke",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#334e87"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "landscape.natural",
|
||||
"elementType": "geometry",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#023e58"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "poi",
|
||||
"elementType": "geometry",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#283d6a"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "poi",
|
||||
"elementType": "labels.text.fill",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#6f9ba5"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "poi",
|
||||
"elementType": "labels.text.stroke",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#1d2c4d"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "poi.park",
|
||||
"elementType": "geometry.fill",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#023e58"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "poi.park",
|
||||
"elementType": "labels.text.fill",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#3C7680"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "road",
|
||||
"elementType": "geometry",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#304a7d"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "road",
|
||||
"elementType": "labels.text.fill",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#98a5be"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "road",
|
||||
"elementType": "labels.text.stroke",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#1d2c4d"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "road.highway",
|
||||
"elementType": "geometry",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#2c6675"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "road.highway",
|
||||
"elementType": "geometry.fill",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#9d2a80"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "road.highway",
|
||||
"elementType": "geometry.stroke",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#9d2a80"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "road.highway",
|
||||
"elementType": "labels.text.fill",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#b0d5ce"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "road.highway",
|
||||
"elementType": "labels.text.stroke",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#023e58"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "transit",
|
||||
"elementType": "labels.text.fill",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#98a5be"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "transit",
|
||||
"elementType": "labels.text.stroke",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#1d2c4d"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "transit.line",
|
||||
"elementType": "geometry.fill",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#283d6a"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "transit.station",
|
||||
"elementType": "geometry",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#3a4762"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "water",
|
||||
"elementType": "geometry",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#0e1626"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "water",
|
||||
"elementType": "labels.text.fill",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#4e6d70"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
|
||||
|
||||
var marker = new google.maps.Marker({
|
||||
position: myLatlng,
|
||||
title:"Hello World!"
|
||||
});
|
||||
|
||||
// To add the marker to the map, call setMap();
|
||||
marker.setMap(map);
|
||||
},
|
||||
|
||||
showNotification: function(from, align){
|
||||
color = Math.floor((Math.random() * 4) + 1);
|
||||
|
||||
$.notify({
|
||||
icon: "tim-icons icon-bell-55",
|
||||
message: "Welcome to <b>Black Dashboard</b> - a beautiful freebie for every web developer."
|
||||
|
||||
},{
|
||||
type: type[color],
|
||||
timer: 8000,
|
||||
placement: {
|
||||
from: from,
|
||||
align: align
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
1418
assets/demo/docs.css
Normal file
1418
assets/demo/docs.css
Normal file
File diff suppressed because it is too large
Load Diff
BIN
assets/demo/docs.min.css
vendored
Normal file
BIN
assets/demo/docs.min.css
vendored
Normal file
Binary file not shown.
19
assets/demo/docs.min.js
vendored
Normal file
19
assets/demo/docs.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
585
assets/demo/jquery.sharrre.js
Normal file
585
assets/demo/jquery.sharrre.js
Normal file
@ -0,0 +1,585 @@
|
||||
/*!
|
||||
* Sharrre.com - Make your sharing widget!
|
||||
* Version: beta 1.3.5
|
||||
* Author: Julien Hany
|
||||
* License: MIT http://en.wikipedia.org/wiki/MIT_License or GPLv2 http://en.wikipedia.org/wiki/GNU_General_Public_License
|
||||
*/
|
||||
|
||||
;(function ( $, window, document, undefined ) {
|
||||
|
||||
/* Defaults
|
||||
================================================== */
|
||||
var pluginName = 'sharrre',
|
||||
defaults = {
|
||||
className: 'sharrre',
|
||||
share: {
|
||||
googlePlus: false,
|
||||
facebook: false,
|
||||
twitter: false,
|
||||
digg: false,
|
||||
delicious: false,
|
||||
stumbleupon: false,
|
||||
linkedin: false,
|
||||
pinterest: false
|
||||
},
|
||||
shareTotal: 0,
|
||||
template: '',
|
||||
title: '',
|
||||
url: document.location.href,
|
||||
text: document.title,
|
||||
urlCurl: 'sharrre.php', //PHP script for google plus...
|
||||
count: {}, //counter by social network
|
||||
total: 0, //total of sharing
|
||||
shorterTotal: true, //show total by k or M when number is to big
|
||||
enableHover: true, //disable if you want to personalize hover event with callback
|
||||
enableCounter: true, //disable if you just want use buttons
|
||||
enableTracking: false, //tracking with google analitycs
|
||||
hover: function(){}, //personalize hover event with this callback function
|
||||
hide: function(){}, //personalize hide event with this callback function
|
||||
click: function(){}, //personalize click event with this callback function
|
||||
render: function(){}, //personalize render event with this callback function
|
||||
buttons: { //settings for buttons
|
||||
googlePlus : { //http://www.google.com/webmasters/+1/button/
|
||||
url: '', //if you need to personnalize button url
|
||||
urlCount: false, //if you want to use personnalize button url on global counter
|
||||
size: 'medium',
|
||||
lang: 'en-US',
|
||||
annotation: ''
|
||||
},
|
||||
facebook: { //http://developers.facebook.com/docs/reference/plugins/like/
|
||||
url: '', //if you need to personalize url button
|
||||
urlCount: false, //if you want to use personnalize button url on global counter
|
||||
action: 'like',
|
||||
layout: 'button_count',
|
||||
width: '',
|
||||
send: 'false',
|
||||
faces: 'false',
|
||||
colorscheme: '',
|
||||
font: '',
|
||||
lang: 'en_US'
|
||||
},
|
||||
twitter: { //http://twitter.com/about/resources/tweetbutton
|
||||
url: '', //if you need to personalize url button
|
||||
urlCount: false, //if you want to use personnalize button url on global counter
|
||||
count: 'horizontal',
|
||||
hashtags: '',
|
||||
via: '',
|
||||
related: '',
|
||||
lang: 'en'
|
||||
},
|
||||
digg: { //http://about.digg.com/downloads/button/smart
|
||||
url: '', //if you need to personalize url button
|
||||
urlCount: false, //if you want to use personnalize button url on global counter
|
||||
type: 'DiggCompact'
|
||||
},
|
||||
delicious: {
|
||||
url: '', //if you need to personalize url button
|
||||
urlCount: false, //if you want to use personnalize button url on global counter
|
||||
size: 'medium' //medium or tall
|
||||
},
|
||||
stumbleupon: { //http://www.stumbleupon.com/badges/
|
||||
url: '', //if you need to personalize url button
|
||||
urlCount: false, //if you want to use personnalize button url on global counter
|
||||
layout: '1'
|
||||
},
|
||||
linkedin: { //http://developer.linkedin.com/plugins/share-button
|
||||
url: '', //if you need to personalize url button
|
||||
urlCount: false, //if you want to use personnalize button url on global counter
|
||||
counter: ''
|
||||
},
|
||||
pinterest: { //http://pinterest.com/about/goodies/
|
||||
url: '', //if you need to personalize url button
|
||||
media: '',
|
||||
description: '',
|
||||
layout: 'horizontal'
|
||||
}
|
||||
}
|
||||
},
|
||||
/* Json URL to get count number
|
||||
================================================== */
|
||||
urlJson = {
|
||||
googlePlus: "",
|
||||
|
||||
//new FQL method by Sire
|
||||
facebook: "https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?",
|
||||
//old method facebook: "http://graph.facebook.com/?id={url}&callback=?",
|
||||
//facebook : "http://api.ak.facebook.com/restserver.php?v=1.0&method=links.getStats&urls={url}&format=json"
|
||||
|
||||
twitter: "http://cdn.api.twitter.com/1/urls/count.json?url={url}&callback=?",
|
||||
digg: "http://services.digg.com/2.0/story.getInfo?links={url}&type=javascript&callback=?",
|
||||
delicious: 'http://feeds.delicious.com/v2/json/urlinfo/data?url={url}&callback=?',
|
||||
//stumbleupon: "http://www.stumbleupon.com/services/1.01/badge.getinfo?url={url}&format=jsonp&callback=?",
|
||||
stumbleupon: "",
|
||||
linkedin: "http://www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?",
|
||||
pinterest: "http://api.pinterest.com/v1/urls/count.json?url={url}&callback=?"
|
||||
},
|
||||
/* Load share buttons asynchronously
|
||||
================================================== */
|
||||
loadButton = {
|
||||
googlePlus : function(self){
|
||||
var sett = self.options.buttons.googlePlus;
|
||||
//$(self.element).find('.buttons').append('<div class="button googleplus"><g:plusone size="'+self.options.buttons.googlePlus.size+'" href="'+self.options.url+'"></g:plusone></div>');
|
||||
$(self.element).find('.buttons').append('<div class="button googleplus"><div class="g-plusone" data-size="'+sett.size+'" data-href="'+(sett.url !== '' ? sett.url : self.options.url)+'" data-annotation="'+sett.annotation+'"></div></div>');
|
||||
window.___gcfg = {
|
||||
lang: self.options.buttons.googlePlus.lang
|
||||
};
|
||||
var loading = 0;
|
||||
if(typeof gapi === 'undefined' && loading == 0){
|
||||
loading = 1;
|
||||
(function() {
|
||||
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
|
||||
po.src = '//apis.google.com/js/plusone.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
|
||||
})();
|
||||
}
|
||||
else{
|
||||
gapi.plusone.go();
|
||||
}
|
||||
},
|
||||
facebook : function(self){
|
||||
var sett = self.options.buttons.facebook;
|
||||
$(self.element).find('.buttons').append('<div class="button facebook"><div id="fb-root"></div><div class="fb-like" data-href="'+(sett.url !== '' ? sett.url : self.options.url)+'" data-send="'+sett.send+'" data-layout="'+sett.layout+'" data-width="'+sett.width+'" data-show-faces="'+sett.faces+'" data-action="'+sett.action+'" data-colorscheme="'+sett.colorscheme+'" data-font="'+sett.font+'" data-via="'+sett.via+'"></div></div>');
|
||||
var loading = 0;
|
||||
if(typeof FB === 'undefined' && loading == 0){
|
||||
loading = 1;
|
||||
(function(d, s, id) {
|
||||
var js, fjs = d.getElementsByTagName(s)[0];
|
||||
if (d.getElementById(id)) {return;}
|
||||
js = d.createElement(s); js.id = id;
|
||||
js.src = '//connect.facebook.net/'+sett.lang+'/all.js#xfbml=1';
|
||||
fjs.parentNode.insertBefore(js, fjs);
|
||||
}(document, 'script', 'facebook-jssdk'));
|
||||
}
|
||||
else{
|
||||
FB.XFBML.parse();
|
||||
}
|
||||
},
|
||||
twitter : function(self){
|
||||
var sett = self.options.buttons.twitter;
|
||||
$(self.element).find('.buttons').append('<div class="button twitter"><a href="https://twitter.com/share" class="twitter-share-button" data-url="'+(sett.url !== '' ? sett.url : self.options.url)+'" data-count="'+sett.count+'" data-text="'+self.options.text+'" data-via="'+sett.via+'" data-hashtags="'+sett.hashtags+'" data-related="'+sett.related+'" data-lang="'+sett.lang+'">Tweet</a></div>');
|
||||
var loading = 0;
|
||||
if(typeof twttr === 'undefined' && loading == 0){
|
||||
loading = 1;
|
||||
(function() {
|
||||
var twitterScriptTag = document.createElement('script');
|
||||
twitterScriptTag.type = 'text/javascript';
|
||||
twitterScriptTag.async = true;
|
||||
twitterScriptTag.src = '//platform.twitter.com/widgets.js';
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(twitterScriptTag, s);
|
||||
})();
|
||||
}
|
||||
else{
|
||||
$.ajax({ url: '//platform.twitter.com/widgets.js', dataType: 'script', cache:true}); //http://stackoverflow.com/q/6536108
|
||||
}
|
||||
},
|
||||
digg : function(self){
|
||||
var sett = self.options.buttons.digg;
|
||||
$(self.element).find('.buttons').append('<div class="button digg"><a class="DiggThisButton '+sett.type+'" rel="nofollow external" href="http://digg.com/submit?url='+encodeURIComponent((sett.url !== '' ? sett.url : self.options.url))+'"></a></div>');
|
||||
var loading = 0;
|
||||
if(typeof __DBW === 'undefined' && loading == 0){
|
||||
loading = 1;
|
||||
(function() {
|
||||
var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];
|
||||
s.type = 'text/javascript';
|
||||
s.async = true;
|
||||
s.src = '//widgets.digg.com/buttons.js';
|
||||
s1.parentNode.insertBefore(s, s1);
|
||||
})();
|
||||
}
|
||||
},
|
||||
delicious : function(self){
|
||||
if(self.options.buttons.delicious.size == 'tall'){//tall
|
||||
var css = 'width:50px;',
|
||||
cssCount = 'height:35px;width:50px;font-size:15px;line-height:35px;',
|
||||
cssShare = 'height:18px;line-height:18px;margin-top:3px;';
|
||||
}
|
||||
else{//medium
|
||||
var css = 'width:93px;',
|
||||
cssCount = 'float:right;padding:0 3px;height:20px;width:26px;line-height:20px;',
|
||||
cssShare = 'float:left;height:20px;line-height:20px;';
|
||||
}
|
||||
var count = self.shorterTotal(self.options.count.delicious);
|
||||
if(typeof count === "undefined"){
|
||||
count = 0;
|
||||
}
|
||||
$(self.element).find('.buttons').append(
|
||||
'<div class="button delicious"><div style="'+css+'font:12px Arial,Helvetica,sans-serif;cursor:pointer;color:#666666;display:inline-block;float:none;height:20px;line-height:normal;margin:0;padding:0;text-indent:0;vertical-align:baseline;">'+
|
||||
'<div style="'+cssCount+'background-color:#fff;margin-bottom:5px;overflow:hidden;text-align:center;border:1px solid #ccc;border-radius:3px;">'+count+'</div>'+
|
||||
'<div style="'+cssShare+'display:block;padding:0;text-align:center;text-decoration:none;width:50px;background-color:#7EACEE;border:1px solid #40679C;border-radius:3px;color:#fff;">'+
|
||||
'<img src="http://www.delicious.com/static/img/delicious.small.gif" height="10" width="10" alt="Delicious" /> Add</div></div></div>');
|
||||
|
||||
$(self.element).find('.delicious').on('click', function(){
|
||||
self.openPopup('delicious');
|
||||
});
|
||||
},
|
||||
stumbleupon : function(self){
|
||||
var sett = self.options.buttons.stumbleupon;
|
||||
$(self.element).find('.buttons').append('<div class="button stumbleupon"><su:badge layout="'+sett.layout+'" location="'+(sett.url !== '' ? sett.url : self.options.url)+'"></su:badge></div>');
|
||||
var loading = 0;
|
||||
if(typeof STMBLPN === 'undefined' && loading == 0){
|
||||
loading = 1;
|
||||
(function() {
|
||||
var li = document.createElement('script');li.type = 'text/javascript';li.async = true;
|
||||
li.src = '//platform.stumbleupon.com/1/widgets.js';
|
||||
var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(li, s);
|
||||
})();
|
||||
s = window.setTimeout(function(){
|
||||
if(typeof STMBLPN !== 'undefined'){
|
||||
STMBLPN.processWidgets();
|
||||
clearInterval(s);
|
||||
}
|
||||
},500);
|
||||
}
|
||||
else{
|
||||
STMBLPN.processWidgets();
|
||||
}
|
||||
},
|
||||
linkedin : function(self){
|
||||
var sett = self.options.buttons.linkedin;
|
||||
$(self.element).find('.buttons').append('<div class="button linkedin"><script type="in/share" data-url="'+(sett.url !== '' ? sett.url : self.options.url)+'" data-counter="'+sett.counter+'"></script></div>');
|
||||
var loading = 0;
|
||||
if(typeof window.IN === 'undefined' && loading == 0){
|
||||
loading = 1;
|
||||
(function() {
|
||||
var li = document.createElement('script');li.type = 'text/javascript';li.async = true;
|
||||
li.src = '//platform.linkedin.com/in.js';
|
||||
var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(li, s);
|
||||
})();
|
||||
}
|
||||
else{
|
||||
window.IN.init();
|
||||
}
|
||||
},
|
||||
pinterest : function(self){
|
||||
var sett = self.options.buttons.pinterest;
|
||||
$(self.element).find('.buttons').append('<div class="button pinterest"><a href="http://pinterest.com/pin/create/button/?url='+(sett.url !== '' ? sett.url : self.options.url)+'&media='+sett.media+'&description='+sett.description+'" class="pin-it-button" count-layout="'+sett.layout+'">Pin It</a></div>');
|
||||
|
||||
(function() {
|
||||
var li = document.createElement('script');li.type = 'text/javascript';li.async = true;
|
||||
li.src = '//assets.pinterest.com/js/pinit.js';
|
||||
var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(li, s);
|
||||
})();
|
||||
}
|
||||
},
|
||||
/* Tracking for Google Analytics
|
||||
================================================== */
|
||||
tracking = {
|
||||
googlePlus: function(){},
|
||||
facebook: function(){
|
||||
//console.log('facebook');
|
||||
fb = window.setInterval(function(){
|
||||
if (typeof FB !== 'undefined') {
|
||||
FB.Event.subscribe('edge.create', function(targetUrl) {
|
||||
_gaq.push(['_trackSocial', 'facebook', 'like', targetUrl]);
|
||||
});
|
||||
FB.Event.subscribe('edge.remove', function(targetUrl) {
|
||||
_gaq.push(['_trackSocial', 'facebook', 'unlike', targetUrl]);
|
||||
});
|
||||
FB.Event.subscribe('message.send', function(targetUrl) {
|
||||
_gaq.push(['_trackSocial', 'facebook', 'send', targetUrl]);
|
||||
});
|
||||
//console.log('ok');
|
||||
clearInterval(fb);
|
||||
}
|
||||
},1000);
|
||||
},
|
||||
twitter: function(){
|
||||
//console.log('twitter');
|
||||
tw = window.setInterval(function(){
|
||||
if (typeof twttr !== 'undefined') {
|
||||
twttr.events.bind('tweet', function(event) {
|
||||
if (event) {
|
||||
_gaq.push(['_trackSocial', 'twitter', 'tweet']);
|
||||
}
|
||||
});
|
||||
//console.log('ok');
|
||||
clearInterval(tw);
|
||||
}
|
||||
},1000);
|
||||
},
|
||||
digg: function(){
|
||||
//if somenone find a solution, mail me !
|
||||
/*$(this.element).find('.digg').on('click', function(){
|
||||
_gaq.push(['_trackSocial', 'digg', 'add']);
|
||||
});*/
|
||||
},
|
||||
delicious: function(){},
|
||||
stumbleupon: function(){},
|
||||
linkedin: function(){
|
||||
function LinkedInShare() {
|
||||
_gaq.push(['_trackSocial', 'linkedin', 'share']);
|
||||
}
|
||||
},
|
||||
pinterest: function(){
|
||||
//if somenone find a solution, mail me !
|
||||
}
|
||||
},
|
||||
/* Popup for each social network
|
||||
================================================== */
|
||||
popup = {
|
||||
googlePlus: function(opt){
|
||||
window.open("https://plus.google.com/share?hl="+opt.buttons.googlePlus.lang+"&url="+encodeURIComponent((opt.buttons.googlePlus.url !== '' ? opt.buttons.googlePlus.url : opt.url)), "", "toolbar=0, status=0, width=900, height=500");
|
||||
},
|
||||
facebook: function(opt){
|
||||
window.open("http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent((opt.buttons.facebook.url !== '' ? opt.buttons.facebook.url : opt.url))+"&t="+opt.text+"", "", "toolbar=0, status=0, width=900, height=500");
|
||||
},
|
||||
twitter: function(opt){
|
||||
window.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(opt.text)+"&url="+encodeURIComponent((opt.buttons.twitter.url !== '' ? opt.buttons.twitter.url : opt.url))+(opt.buttons.twitter.via !== '' ? '&via='+opt.buttons.twitter.via : ''), "", "toolbar=0, status=0, width=650, height=360");
|
||||
},
|
||||
digg: function(opt){
|
||||
window.open("http://digg.com/tools/diggthis/submit?url="+encodeURIComponent((opt.buttons.digg.url !== '' ? opt.buttons.digg.url : opt.url))+"&title="+opt.text+"&related=true&style=true", "", "toolbar=0, status=0, width=650, height=360");
|
||||
},
|
||||
delicious: function(opt){
|
||||
window.open('http://www.delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent((opt.buttons.delicious.url !== '' ? opt.buttons.delicious.url : opt.url))+'&title='+opt.text, 'delicious', 'toolbar=no,width=550,height=550');
|
||||
},
|
||||
stumbleupon: function(opt){
|
||||
window.open('http://www.stumbleupon.com/badge/?url='+encodeURIComponent((opt.buttons.stumbleupon.url !== '' ? opt.buttons.stumbleupon.url : opt.url)), 'stumbleupon', 'toolbar=no,width=550,height=550');
|
||||
},
|
||||
linkedin: function(opt){
|
||||
window.open('https://www.linkedin.com/cws/share?url='+encodeURIComponent((opt.buttons.linkedin.url !== '' ? opt.buttons.linkedin.url : opt.url))+'&token=&isFramed=true', 'linkedin', 'toolbar=no,width=550,height=550');
|
||||
},
|
||||
pinterest: function(opt){
|
||||
window.open('http://pinterest.com/pin/create/button/?url='+encodeURIComponent((opt.buttons.pinterest.url !== '' ? opt.buttons.pinterest.url : opt.url))+'&media='+encodeURIComponent(opt.buttons.pinterest.media)+'&description='+opt.buttons.pinterest.description, 'pinterest', 'toolbar=no,width=700,height=300');
|
||||
}
|
||||
};
|
||||
|
||||
/* Plugin constructor
|
||||
================================================== */
|
||||
function Plugin( element, options ) {
|
||||
this.element = element;
|
||||
|
||||
this.options = $.extend( true, {}, defaults, options);
|
||||
this.options.share = options.share; //simple solution to allow order of buttons
|
||||
|
||||
this._defaults = defaults;
|
||||
this._name = pluginName;
|
||||
|
||||
this.init();
|
||||
};
|
||||
|
||||
/* Initialization method
|
||||
================================================== */
|
||||
Plugin.prototype.init = function () {
|
||||
var self = this;
|
||||
if(this.options.urlCurl !== ''){
|
||||
urlJson.googlePlus = this.options.urlCurl + '?url={url}&type=googlePlus'; // PHP script for GooglePlus...
|
||||
urlJson.stumbleupon = this.options.urlCurl + '?url={url}&type=stumbleupon'; // PHP script for Stumbleupon...
|
||||
}
|
||||
$(this.element).addClass(this.options.className); //add class
|
||||
|
||||
//HTML5 Custom data
|
||||
if(typeof $(this.element).data('title') !== 'undefined'){
|
||||
this.options.title = $(this.element).attr('data-title');
|
||||
}
|
||||
if(typeof $(this.element).data('url') !== 'undefined'){
|
||||
this.options.url = $(this.element).data('url');
|
||||
}
|
||||
if(typeof $(this.element).data('text') !== 'undefined'){
|
||||
this.options.text = $(this.element).data('text');
|
||||
}
|
||||
|
||||
//how many social website have been selected
|
||||
$.each(this.options.share, function(name, val) {
|
||||
if(val === true){
|
||||
self.options.shareTotal ++;
|
||||
}
|
||||
});
|
||||
|
||||
if(self.options.enableCounter === true){ //if for some reason you don't need counter
|
||||
//get count of social share that have been selected
|
||||
$.each(this.options.share, function(name, val) {
|
||||
if(val === true){
|
||||
//self.getSocialJson(name);
|
||||
try {
|
||||
self.getSocialJson(name);
|
||||
} catch(e){
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else if(self.options.template !== ''){ //for personalized button (with template)
|
||||
this.options.render(this, this.options);
|
||||
}
|
||||
else{ // if you want to use official button like example 3 or 5
|
||||
this.loadButtons();
|
||||
}
|
||||
|
||||
//add hover event
|
||||
$(this.element).hover(function(){
|
||||
//load social button if enable and 1 time
|
||||
if($(this).find('.buttons').length === 0 && self.options.enableHover === true){
|
||||
self.loadButtons();
|
||||
}
|
||||
self.options.hover(self, self.options);
|
||||
}, function(){
|
||||
self.options.hide(self, self.options);
|
||||
});
|
||||
|
||||
//click event
|
||||
$(this.element).click(function(){
|
||||
self.options.click(self, self.options);
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
/* loadButtons methode
|
||||
================================================== */
|
||||
Plugin.prototype.loadButtons = function () {
|
||||
var self = this;
|
||||
$(this.element).append('<div class="buttons"></div>');
|
||||
$.each(self.options.share, function(name, val) {
|
||||
if(val == true){
|
||||
loadButton[name](self);
|
||||
if(self.options.enableTracking === true){ //add tracking
|
||||
tracking[name]();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* getSocialJson methode
|
||||
================================================== */
|
||||
Plugin.prototype.getSocialJson = function (name) {
|
||||
var self = this,
|
||||
count = 0,
|
||||
url = urlJson[name].replace('{url}', encodeURIComponent(this.options.url));
|
||||
if(this.options.buttons[name].urlCount === true && this.options.buttons[name].url !== ''){
|
||||
url = urlJson[name].replace('{url}', this.options.buttons[name].url);
|
||||
}
|
||||
//console.log('name : ' + name + ' - url : '+url); //debug
|
||||
if(url != '' && self.options.urlCurl !== ''){ //urlCurl = '' if you don't want to used PHP script but used social button
|
||||
$.getJSON(url, function(json){
|
||||
if(typeof json.count !== "undefined"){ //GooglePlus, Stumbleupon, Twitter, Pinterest and Digg
|
||||
var temp = json.count + '';
|
||||
temp = temp.replace('\u00c2\u00a0', ''); //remove google plus special chars
|
||||
count += parseInt(temp, 10);
|
||||
}
|
||||
//get the FB total count (shares, likes and more)
|
||||
else if(json.data && json.data.length > 0 && typeof json.data[0].total_count !== "undefined"){ //Facebook total count
|
||||
count += parseInt(json.data[0].total_count, 10);
|
||||
}
|
||||
else if(typeof json[0] !== "undefined"){ //Delicious
|
||||
count += parseInt(json[0].total_posts, 10);
|
||||
}
|
||||
else if(typeof json[0] !== "undefined"){ //Stumbleupon
|
||||
}
|
||||
self.options.count[name] = count;
|
||||
self.options.total += count;
|
||||
self.renderer();
|
||||
self.rendererPerso();
|
||||
//console.log(json); //debug
|
||||
})
|
||||
.error(function() {
|
||||
self.options.count[name] = 0;
|
||||
self.rendererPerso();
|
||||
});
|
||||
}
|
||||
else{
|
||||
self.renderer();
|
||||
self.options.count[name] = 0;
|
||||
self.rendererPerso();
|
||||
}
|
||||
};
|
||||
|
||||
/* launch render methode
|
||||
================================================== */
|
||||
Plugin.prototype.rendererPerso = function () {
|
||||
//check if this is the last social website to launch render
|
||||
var shareCount = 0;
|
||||
for (e in this.options.count) { shareCount++; }
|
||||
if(shareCount === this.options.shareTotal){
|
||||
this.options.render(this, this.options);
|
||||
}
|
||||
};
|
||||
|
||||
/* render methode
|
||||
================================================== */
|
||||
Plugin.prototype.renderer = function () {
|
||||
var total = this.options.total,
|
||||
template = this.options.template;
|
||||
if(this.options.shorterTotal === true){ //format number like 1.2k or 5M
|
||||
total = this.shorterTotal(total);
|
||||
}
|
||||
|
||||
if(template !== ''){ //if there is a template
|
||||
template = template.replace('{total}', total);
|
||||
$(this.element).html(template);
|
||||
}
|
||||
else{ //template by defaults
|
||||
$(this.element).html(
|
||||
'<div class="box"><a class="count" href="#">' + total + '</a>' +
|
||||
(this.options.title !== '' ? '<a class="share" href="#">' + this.options.title + '</a>' : '') +
|
||||
'</div>'
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/* format total numbers like 1.2k or 5M
|
||||
================================================== */
|
||||
Plugin.prototype.shorterTotal = function (num) {
|
||||
if (num >= 1e6){
|
||||
num = (num / 1e6).toFixed(2) + "M"
|
||||
} else if (num >= 1e3){
|
||||
num = (num / 1e3).toFixed(1) + "k"
|
||||
}
|
||||
return num;
|
||||
};
|
||||
|
||||
/* Methode for open popup
|
||||
================================================== */
|
||||
Plugin.prototype.openPopup = function (site) {
|
||||
popup[site](this.options); //open
|
||||
if(this.options.enableTracking === true){ //tracking!
|
||||
var tracking = {
|
||||
googlePlus: {site: 'Google', action: '+1'},
|
||||
facebook: {site: 'facebook', action: 'like'},
|
||||
twitter: {site: 'twitter', action: 'tweet'},
|
||||
digg: {site: 'digg', action: 'add'},
|
||||
delicious: {site: 'delicious', action: 'add'},
|
||||
stumbleupon: {site: 'stumbleupon', action: 'add'},
|
||||
linkedin: {site: 'linkedin', action: 'share'},
|
||||
pinterest: {site: 'pinterest', action: 'pin'}
|
||||
};
|
||||
_gaq.push(['_trackSocial', tracking[site].site, tracking[site].action]);
|
||||
}
|
||||
};
|
||||
|
||||
/* Methode for add +1 to a counter
|
||||
================================================== */
|
||||
Plugin.prototype.simulateClick = function () {
|
||||
var html = $(this.element).html();
|
||||
$(this.element).html(html.replace(this.options.total, this.options.total+1));
|
||||
};
|
||||
|
||||
/* Methode for add +1 to a counter
|
||||
================================================== */
|
||||
Plugin.prototype.update = function (url, text) {
|
||||
if(url !== ''){
|
||||
this.options.url = url;
|
||||
}
|
||||
if(text !== ''){
|
||||
this.options.text = text;
|
||||
}
|
||||
};
|
||||
|
||||
/* A really lightweight plugin wrapper around the constructor, preventing against multiple instantiations
|
||||
================================================== */
|
||||
$.fn[pluginName] = function ( options ) {
|
||||
var args = arguments;
|
||||
if (options === undefined || typeof options === 'object') {
|
||||
return this.each(function () {
|
||||
if (!$.data(this, 'plugin_' + pluginName)) {
|
||||
$.data(this, 'plugin_' + pluginName, new Plugin( this, options ));
|
||||
}
|
||||
});
|
||||
} else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
|
||||
return this.each(function () {
|
||||
var instance = $.data(this, 'plugin_' + pluginName);
|
||||
if (instance instanceof Plugin && typeof instance[options] === 'function') {
|
||||
instance[options].apply( instance, Array.prototype.slice.call( args, 1 ) );
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
})(jQuery, window, document);
|
||||
119
assets/demo/src/application.js
Normal file
119
assets/demo/src/application.js
Normal file
@ -0,0 +1,119 @@
|
||||
// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
|
||||
// IT'S ALL JUST JUNK FOR OUR DOCS!
|
||||
// ++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
/*!
|
||||
* JavaScript for Bootstrap's docs (https://getbootstrap.com)
|
||||
* Copyright 2011-2017 The Bootstrap Authors
|
||||
* Copyright 2011-2017 Twitter, Inc.
|
||||
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
|
||||
* details, see https://creativecommons.org/licenses/by/3.0/.
|
||||
*/
|
||||
|
||||
/* global Clipboard, anchors */
|
||||
|
||||
(function($) {
|
||||
'use strict';
|
||||
|
||||
$(function() {
|
||||
// Indeterminate checkbox example
|
||||
$('.bd-example-indeterminate [type="checkbox"]').prop(
|
||||
'indeterminate',
|
||||
true
|
||||
);
|
||||
|
||||
// Tooltip and popover demos
|
||||
$('.tooltip-demo').tooltip({
|
||||
selector: '[data-toggle="tooltip"]',
|
||||
container: 'body',
|
||||
});
|
||||
|
||||
$('[data-toggle="popover"]').popover();
|
||||
|
||||
// Demos within modals
|
||||
$('.tooltip-test').tooltip();
|
||||
$('.popover-test').popover();
|
||||
|
||||
// Indeterminate checkbox example
|
||||
$('.bd-example-indeterminate [type="checkbox"]').prop(
|
||||
'indeterminate',
|
||||
true
|
||||
);
|
||||
|
||||
// Disable empty links in docs examples
|
||||
$('.bd-content [href="#"]').click(function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// Modal relatedTarget demo
|
||||
$('#exampleModal').on('show.bs.modal', function(event) {
|
||||
var $button = $(event.relatedTarget); // Button that triggered the modal
|
||||
var recipient = $button.data('whatever'); // Extract info from data-* attributes
|
||||
// If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
|
||||
// Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
|
||||
var $modal = $(this);
|
||||
$modal.find('.modal-title').text('New message to ' + recipient);
|
||||
$modal.find('.modal-body input').val(recipient);
|
||||
});
|
||||
|
||||
// Activate animated progress bar
|
||||
$('.bd-toggle-animated-progress').on('click', function() {
|
||||
$(this)
|
||||
.siblings('.progress')
|
||||
.find('.progress-bar-striped')
|
||||
.toggleClass('progress-bar-animated');
|
||||
});
|
||||
|
||||
// Insert copy to clipboard button before .highlight
|
||||
$('.highlight').each(function() {
|
||||
var btnHtml =
|
||||
'<div class="bd-clipboard"><button class="btn-clipboard" title="Copy to clipboard">Copy</button></div>';
|
||||
$(this).before(btnHtml);
|
||||
$('.btn-clipboard').tooltip().on('mouseleave', function() {
|
||||
// explicitly hide tooltip, since after clicking it remains
|
||||
// focused (as it's a button), so tooltip would otherwise
|
||||
// remain visible until focus is moved away
|
||||
$(this).tooltip('hide');
|
||||
});
|
||||
});
|
||||
|
||||
var clipboard = new Clipboard('.btn-clipboard', {
|
||||
target: function(trigger) {
|
||||
return trigger.parentNode.nextElementSibling;
|
||||
},
|
||||
});
|
||||
|
||||
clipboard.on('success', function(e) {
|
||||
$(e.trigger)
|
||||
.attr('title', 'Copied!')
|
||||
.tooltip('_fixTitle')
|
||||
.tooltip('show')
|
||||
.attr('title', 'Copy to clipboard')
|
||||
.tooltip('_fixTitle');
|
||||
|
||||
e.clearSelection();
|
||||
});
|
||||
|
||||
clipboard.on('error', function(e) {
|
||||
var modifierKey = /Mac/i.test(navigator.userAgent) ? '\u2318' : 'Ctrl-';
|
||||
var fallbackMsg = 'Press ' + modifierKey + 'C to copy';
|
||||
|
||||
$(e.trigger)
|
||||
.attr('title', fallbackMsg)
|
||||
.tooltip('_fixTitle')
|
||||
.tooltip('show')
|
||||
.attr('title', 'Copy to clipboard')
|
||||
.tooltip('_fixTitle');
|
||||
});
|
||||
|
||||
anchors.options = {
|
||||
icon: '#',
|
||||
};
|
||||
anchors.add(
|
||||
'.bd-content > h2, .bd-content > h3, .bd-content > h4, .bd-content > h5'
|
||||
);
|
||||
$(
|
||||
'.bd-content > h2, .bd-content > h3, .bd-content > h4, .bd-content > h5'
|
||||
).wrapInner('<div></div>');
|
||||
});
|
||||
})(jQuery);
|
||||
6
assets/demo/vendor/anchor.min.js
vendored
Normal file
6
assets/demo/vendor/anchor.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
assets/demo/vendor/clipboard.min.js
vendored
Normal file
7
assets/demo/vendor/clipboard.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
13
assets/demo/vendor/holder.min.js
vendored
Normal file
13
assets/demo/vendor/holder.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
21
assets/demo/vendor/split.min.js
vendored
Normal file
21
assets/demo/vendor/split.min.js
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
var _gaq=_gaq||[]
|
||||
Split=(function(){var config={},defaults={cookieName:'abTest',cookieAge:30,customVariableName:'AB Test alternative',customVariableIndex:1}
|
||||
function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
|
||||
else var expires="";document.cookie=name+"="+value+expires+"; path=/";}
|
||||
function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
|
||||
return null;}
|
||||
function eraseCookie(name){createCookie(name,"",-1);}
|
||||
function getKeys(obj)
|
||||
{var keys=[];for(var i in obj)if(obj.hasOwnProperty(i))
|
||||
{keys.push(i);}
|
||||
return keys;}
|
||||
function init(){alternatives=arguments[0]
|
||||
options=arguments[1]
|
||||
keys=getKeys(alternatives);config={}
|
||||
if(options!=undefined){for(k in defaults){config[k]=(options[k]!=undefined)?options[k]:defaults[k];}}else{config=defaults;}
|
||||
var alternative=readCookie(config.cookieName)
|
||||
if(alternative){}else{alternative=keys[Math.floor(Math.random()*keys.length)]
|
||||
createCookie(config.cookieName,alternative,config.cookieAge)}
|
||||
_gaq.push(['_setCustomVar',config.customVariableIndex,config.customVariableName,alternative,1]);alternatives[alternative]();}
|
||||
return{setup:function(args,options){init(args,options)}}})();
|
||||
Reference in New Issue
Block a user