17 Nov - Static Sites to laravel

This commit is contained in:
Kevin Adametz 2018-11-17 02:01:22 +01:00
parent 610aa1e202
commit 5ff57a21a7
3661 changed files with 569001 additions and 771 deletions

View file

@ -0,0 +1,11 @@
/** CONTACT FORM
*************************************************** **/
var _hash = window.location.hash;
/**
BROWSER HASH - from php/contact.php redirect!
#alert_success = email sent
#alert_failed = email not sent - internal server error (404 error or SMTP problem)
#alert_mandatory = email not sent - required fields empty
**/ jQuery(_hash).show();

View file

@ -0,0 +1,96 @@
(function() {
$(document).ready(function() {
var $contact_form = $('#plugin-contact-form');
$contact_form.show();
$contact_email = $('#sender_email_repeat');
$contact_email.parent('div').parent('div').parent('div').hide();
//$('#message').expanding();
$sender_token = $('#sender_token');
if($sender_token.length){
set_token();
}
function set_token(){
var url = $contact_form.prop('action');
var load = "token";
var data = {};
$.ajax({
url: url + "?load=" + load,
type: 'POST',
dataType: 'JSON',
data: data
})
.done(function(data, textStatus, jqXHR) {
//_log(data);
$sender_token.val(data.token);
})
.fail(function(jqXHR, textStatus, errorThrown) {
//_log(jqXHR.responseText);
display_general_error('There was a problem submitting the form: ' + textStatus + ' ' + errorThrown);
});
}
function display_general_error(msg) {
var $error_msg = $('#plugin-contact-form-error');
if (!$error_msg.length) {
$error_msg = $('<p id="plugin-contact-form-error" class="plugin-contact-form-error" style="display: none;"></p>');
$contact_form.prepend($error_msg);
}
$error_msg.html(msg);
$error_msg.fadeIn();
}
$contact_form.submit(function() {
$('.error', this).removeClass('.error');
$('.plugin-contact-form-error', this).hide();
var data = $(this).serialize();
var url = $(this).prop('action');
var load = $(this).data('load');
$.ajax({
url: url + "?load=" + load,
type: 'POST',
dataType: 'JSON',
data: data
})
.done(function(data, textStatus, jqXHR) {
console.log(data);
if (typeof data.errors != 'undefined') {
set_token();
for (key in data.errors) {
if (key == 'general') {
display_general_error(data.errors[key]);
continue;
}
var html_id = '#error-' + key + '-' + data.errors[key];
var $container = $(html_id);
if (!$container.length) {
$container = $('<div id="' + html_id.substring(1) + '" class="alert alert-danger plugin-contact-form-error"><button type="button" class="close" data-dismiss="alert">×</button>' + 'Bitte Feld ausfüllen.' + '</div>');
$('[name=' + key + ']').after($container).addClass('error');
}
$container.hide().fadeIn();
}
}
else {
$contact_form.hide();
var $success_msg = $('#plugin-contact-form-success');
if (!$success_msg.length) {
$success_msg = $('<p id="plugin-contact-form-success" style="display: none;">Nachricht gesendet. Vielen Dank!</p>');
$contact_form.after($success_msg);
}
$success_msg.hide().fadeIn();
}
})
.fail(function(jqXHR, textStatus, errorThrown) {
//_log(jqXHR.responseText);
display_general_error('There was a problem submitting the form: ' + textStatus + ' ' + errorThrown);
});
return false;
});
});
})(jQuery);

4292
public/assets/js/scripts.js Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,44 @@
/** ********************************************** **
@Swiper Slider
@Last Update 11:24 AM Friday, April 17, 2015
@URL http://nivo.dev7studios.com
REQUIRED:
CSS
<link href="assets/plugins/slider.camera/css/camera.css" rel="stylesheet" type="text/css" />
JS
<script type="text/javascript" src="assets/plugins/slider.camera/scripts/jquery.camera.js"></script>
<script type="text/javascript" src="assets/js/view/demo.camera_slider.js"></script>
*************************************************** **/
jQuery(document).ready(function() {
if(jQuery(".camera_wrap").length > 0) {
_cameraInit();
}
});
/** _cameraInit()
******************************* **/
function _cameraInit() {
var _slider = jQuery('#camera_wrap_1'),
_height = _slider.attr('data-height') || '40%';
jQuery(_slider).camera({
thumbnails: true,
height: _height,
loader: 'pie',
loaderPadding: 1,
loaderStroke: 5,
onLoaded: function() {
$('#camera_wrap_1 .camera_next').html('<i class="fa fa-angle-right"></i>');
$('#camera_wrap_1 .camera_prev').html('<i class="fa fa-angle-left"></i>');
}
});
}

View file

@ -0,0 +1,48 @@
/** ********************************************** **
@Swiper Slider
@Last Update 11:24 AM Friday, April 17, 2015
@URL http://nivo.dev7studios.com
REQUIRED:
CSS
<link href="assets/plugins/slider.elastic/css/style.css" rel="stylesheet" type="text/css" />
JS
<script type="text/javascript" src="assets/plugins/slider.elastic/js/jquery.eislideshow.js"></script>
<script type="text/javascript" src="assets/js/view/demo.elastic_slider.js"></script>
*************************************************** **/
jQuery(document).ready(function() {
if(jQuery(".ei-slider").length > 0) {
_elasticInit();
}
});
/** _elasticInit()
******************************* **/
function _elasticInit() {
var _slider = jQuery('#ei-slider'),
_controlNav = _slider.attr('data-controlNav'),
_pauseOnHover = _slider.attr('data-pauseOnHover'),
_thumbMaxWidth = _slider.attr('data-tumbwidth') || 120;
_controlNav = (_controlNav == "true") ? true : false;
_pauseOnHover = (_pauseOnHover == "true") ? true : false;
jQuery('#ei-slider').eislideshow({
animation : 'center',
autoplay : true,
slideshow_interval : 3000,
titlesFactor : 0,
titlespeed : 1200,
titleeasing : 'easeOutExpo',
easing : 'easeOutExpo',
thumbMaxWidth : parseInt(_thumbMaxWidth),
});
}

View file

@ -0,0 +1,525 @@
/** Graphs : Flot
graphs-flot.html
<!-- PAGE LEVEL SCRIPTS -->
loadScript(plugin_path + "chart.flot/jquery.flot.min.js", function(){
loadScript(plugin_path + "chart.flot/jquery.flot.resize.min.js", function(){
loadScript(plugin_path + "chart.flot/jquery.flot.time.min.js", function(){
loadScript(plugin_path + "chart.flot/jquery.flot.fillbetween.min.js", function(){
loadScript(plugin_path + "chart.flot/jquery.flot.orderBars.min.js", function(){
loadScript(plugin_path + "chart.flot/jquery.flot.pie.min.js", function(){
loadScript(plugin_path + "chart.flot/jquery.flot.tooltip.min.js", function(){
// demo js script
loadScript("assets/js/view/demo.graphs.flot.js");
});
});
});
});
});
});
});
------------------------------------------------------------------------------------------
01. SALES CHART
02. SIN CHART
03. BAR CHART
04. BAR CHART HORIZONTAL
05. PIE CHART
06. STATS CHART
07. REALTIME CHART
http://www.flotcharts.org/flot/examples/
************************************************* **/
jQuery(window).ready(function() {
_flot();
});
function _flot() {
/* DEFAULTS FLOT COLORS */
var $color_border_color = "#eaeaea"; /* light gray */
$color_grid_color = "#dddddd" /* silver */
$color_main = "#E24913"; /* red */
$color_second = "#6595b4"; /* blue */
$color_third = "#FF9F01"; /* orange */
$color_fourth = "#7e9d3a"; /* green */
$color_fifth = "#BD362F"; /* dark red */
$color_mono = "#000000"; /* black */
/** 01. SALES CHART
******************************************* **/
if (jQuery("#flot-sales").length > 0) {
var d = [[1196463600000, 0], [1196550000000, 0], [1196636400000, 0], [1196722800000, 77], [1196809200000, 3636], [1196895600000, 3575], [1196982000000, 2736], [1197068400000, 1086], [1197154800000, 676], [1197241200000, 1205], [1197327600000, 906], [1197414000000, 710], [1197500400000, 639], [1197586800000, 540], [1197673200000, 435], [1197759600000, 301], [1197846000000, 575], [1197932400000, 481], [1198018800000, 591], [1198105200000, 608], [1198191600000, 459], [1198278000000, 234], [1198364400000, 1352], [1198450800000, 686], [1198537200000, 279], [1198623600000, 449], [1198710000000, 468], [1198796400000, 392], [1198882800000, 282], [1198969200000, 208], [1199055600000, 229], [1199142000000, 177], [1199228400000, 374], [1199314800000, 436], [1199401200000, 404], [1199487600000, 253], [1199574000000, 218], [1199660400000, 476], [1199746800000, 462], [1199833200000, 500], [1199919600000, 700], [1200006000000, 750], [1200092400000, 600], [1200178800000, 500], [1200265200000, 900], [1200351600000, 930], [1200438000000, 1200], [1200524400000, 980], [1200610800000, 950], [1200697200000, 900], [1200783600000, 1000], [1200870000000, 1050], [1200956400000, 1150], [1201042800000, 1100], [1201129200000, 1200], [1201215600000, 1300], [1201302000000, 1700], [1201388400000, 1450], [1201474800000, 1500], [1201561200000, 546], [1201647600000, 614], [1201734000000, 954], [1201820400000, 1700], [1201906800000, 1800], [1201993200000, 1900], [1202079600000, 2000], [1202166000000, 2100], [1202252400000, 2200], [1202338800000, 2300], [1202425200000, 2400], [1202511600000, 2550], [1202598000000, 2600], [1202684400000, 2500], [1202770800000, 2700], [1202857200000, 2750], [1202943600000, 2800], [1203030000000, 3245], [1203116400000, 3345], [1203202800000, 3000], [1203289200000, 3200], [1203375600000, 3300], [1203462000000, 3400], [1203548400000, 3600], [1203634800000, 3700], [1203721200000, 3800], [1203807600000, 4000], [1203894000000, 4500]];
for (var i = 0; i < d.length; ++i) {
d[i][0] += 60 * 60 * 1000;
}
function weekendAreas(axes) {
var markings = [];
var d = new Date(axes.xaxis.min);
// go to the first Saturday
d.setUTCDate(d.getUTCDate() - ((d.getUTCDay() + 1) % 7))
d.setUTCSeconds(0);
d.setUTCMinutes(0);
d.setUTCHours(0);
var i = d.getTime();
do {
// when we don't set yaxis, the rectangle automatically
// extends to infinity upwards and downwards
markings.push({
xaxis : {
from : i,
to : i + 2 * 24 * 60 * 60 * 1000
}
});
i += 7 * 24 * 60 * 60 * 1000;
} while (i < axes.xaxis.max);
return markings;
}
var options = {
xaxis : {
mode : "time",
tickLength : 5
},
series : {
lines : {
show : true,
lineWidth : 1,
fill : true,
fillColor : {
colors : [{
opacity : 0.1
}, {
opacity : 0.15
}]
}
},
//points: { show: true },
shadowSize : 0
},
selection : {
mode : "x"
},
grid : {
hoverable : true,
clickable : true,
tickColor : $color_border_color,
borderWidth : 0,
borderColor : $color_border_color,
},
tooltip : true,
tooltipOpts : {
content : "Your sales for <b>%x</b> was <span>$%y</span>",
dateFormat : "%y-%0m-%0d",
defaultTheme : false
},
colors : [$color_second],
};
var plot = jQuery.plot(jQuery("#flot-sales"), [d], options);
}
/** 02. SIN CHART
******************************************* **/
if (jQuery("#flot-sin").length > 0) {
var sin = [], cos = [];
for (var i = 0; i < 16; i += 0.5) {
sin.push([i, Math.sin(i)]);
cos.push([i, Math.cos(i)]);
}
var plot = jQuery.plot(jQuery("#flot-sin"), [{
data : sin,
label : "sin(x)"
}, {
data : cos,
label : "cos(x)"
}], {
series : {
lines : {
show : true
},
points : {
show : true
}
},
grid : {
hoverable : true,
clickable : true,
tickColor : $color_border_color,
borderWidth : 0,
borderColor : $color_border_color,
},
tooltip : true,
tooltipOpts : {
//content : "Value <b>$x</b> Value <span>$y</span>",
defaultTheme : false
},
colors : [$color_second, $color_fourth],
yaxis : {
min : -1.1,
max : 1.1
},
xaxis : {
min : 0,
max : 15
}
});
jQuery("#flot-sin").bind("plotclick", function(event, pos, item) {
if (item) {
jQuery("#clickdata").text("You clicked point " + item.dataIndex + " in " + item.series.label + ".");
plot.highlight(item.series, item.datapoint);
}
});
}
/** 03. BAR CHART
******************************************* **/
if (jQuery("#flot-bar").length > 0) {
var data1 = [];
for (var i = 0; i <= 12; i += 1)
data1.push([i, parseInt(Math.random() * 30)]);
var data2 = [];
for (var i = 0; i <= 12; i += 1)
data2.push([i, parseInt(Math.random() * 30)]);
var data3 = [];
for (var i = 0; i <= 12; i += 1)
data3.push([i, parseInt(Math.random() * 30)]);
var ds = new Array();
ds.push({
data : data1,
bars : {
show : true,
barWidth : 0.2,
order : 1,
}
});
ds.push({
data : data2,
bars : {
show : true,
barWidth : 0.2,
order : 2
}
});
ds.push({
data : data3,
bars : {
show : true,
barWidth : 0.2,
order : 3
}
});
//Display graph
jQuery.plot(jQuery("#flot-bar"), ds, {
colors : [$color_second, $color_fourth, "#666", "#BBB"],
grid : {
show : true,
hoverable : true,
clickable : true,
tickColor : $color_border_color,
borderWidth : 0,
borderColor : $color_border_color,
},
legend : true,
tooltip : true,
tooltipOpts : {
content : "<b>%x</b> = <span>%y</span>",
defaultTheme : false
}
});
}
/** 04. BAR CHART HORIZONTAL
******************************************* **/
if (jQuery("#flot-bar-horizontal").length > 0) {
//Display horizontal graph
var d1_h = [];
for (var i = 0; i <= 3; i += 1)
d1_h.push([parseInt(Math.random() * 30), i]);
var d2_h = [];
for (var i = 0; i <= 3; i += 1)
d2_h.push([parseInt(Math.random() * 30), i]);
var d3_h = [];
for (var i = 0; i <= 3; i += 1)
d3_h.push([parseInt(Math.random() * 30), i]);
var ds_h = new Array();
ds_h.push({
data : d1_h,
bars : {
horizontal : true,
show : true,
barWidth : 0.2,
order : 1,
}
});
ds_h.push({
data : d2_h,
bars : {
horizontal : true,
show : true,
barWidth : 0.2,
order : 2
}
});
ds_h.push({
data : d3_h,
bars : {
horizontal : true,
show : true,
barWidth : 0.2,
order : 3
}
});
// display graph
jQuery.plot(jQuery("#flot-bar-horizontal"), ds_h, {
colors : [$color_second, $color_fourth, "#666", "#BBB"],
grid : {
show : true,
hoverable : true,
clickable : true,
tickColor : $color_border_color,
borderWidth : 0,
borderColor : $color_border_color,
},
legend : true,
tooltip : true,
tooltipOpts : {
content : "<b>%x</b> = <span>%y</span>",
defaultTheme : false
}
});
}
/** 05. PIE CHART
******************************************* **/
if (jQuery("#flot-pie").length > 0) {
var data_pie = [];
var series = Math.floor(Math.random() * 10) + 1;
for (var i = 0; i < series; i++) {
data_pie[i] = {
label : "Series" + (i + 1),
data : Math.floor(Math.random() * 100) + 1
}
}
jQuery.plot(jQuery("#flot-pie"), data_pie, {
series : {
pie : {
show : true,
innerRadius : 0.5,
radius : 1,
label : {
show : false,
radius : 2 / 3,
formatter : function(label, series) {
return '<div style="font-size:11px;text-align:center;padding:4px;color:white;">' + label + '<br/>' + Math.round(series.percent) + '%</div>';
},
threshold : 0.1
}
}
},
legend : {
show : true,
noColumns : 1, // number of colums in legend table
labelFormatter : null, // fn: string -> string
labelBoxBorderColor : "#000", // border color for the little label boxes
container : null, // container (as jQuery object) to put legend in, null means default on top of graph
position : "ne", // position of default legend container within plot
margin : [5, 10], // distance from grid edge to default legend container within plot
backgroundColor : "#efefef", // null means auto-detect
backgroundOpacity : 1 // set to 0 to avoid background
},
grid : {
hoverable : true,
clickable : true
},
});
}
/** 06. STATS CHART
******************************************* **/
if (jQuery("#flot-stats").length) {
var pageviews = [[1, 75], [3, 87], [4, 93], [5, 127], [6, 116], [7, 137], [8, 135], [9, 130], [10, 167], [11, 169], [12, 179], [13, 185], [14, 176], [15, 180], [16, 174], [17, 193], [18, 186], [19, 177], [20, 153], [21, 149], [22, 130], [23, 100], [24, 50]];
var visitors = [[1, 65], [3, 50], [4, 73], [5, 100], [6, 95], [7, 103], [8, 111], [9, 97], [10, 125], [11, 100], [12, 95], [13, 141], [14, 126], [15, 131], [16, 146], [17, 158], [18, 160], [19, 151], [20, 125], [21, 110], [22, 100], [23, 85], [24, 37]];
var plot = jQuery.plot(jQuery("#flot-stats"), [{
data : pageviews,
label : "Your pageviews"
}, {
data : visitors,
label : "Site visitors"
}], {
series : {
lines : {
show : true,
lineWidth : 1,
fill : true,
fillColor : {
colors : [{
opacity : 0.1
}, {
opacity : 0.15
}]
}
},
points : {
show : true
},
shadowSize : 0
},
xaxis : {
mode : "time",
tickLength : 10
},
yaxes : [{
min : 20,
tickLength : 5
}],
grid : {
hoverable : true,
clickable : true,
tickColor : $color_border_color,
borderWidth : 0,
borderColor : $color_border_color,
},
tooltip : true,
tooltipOpts : {
content : "%s for <b>%x:00 hrs</b> was %y",
dateFormat : "%y-%0m-%0d",
defaultTheme : false
},
colors : [$color_main, $color_second],
xaxis : {
ticks : 15,
tickDecimals : 2
},
yaxis : {
ticks : 15,
tickDecimals : 0
},
});
}
/** 07. REALTIME CHART
******************************************* **/
if (jQuery("#flot-realtime").length) {
// For the demo we use generated data, but normally it would be coming from the server
var data = [], totalPoints = 200;
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;
}
// setup control widget
var updateInterval = 1000;
jQuery("#flot-realtime").val(updateInterval).change(function() {
var v = jQuery(this).val();
if (v && !isNaN(+v)) {
updateInterval = +v;
if (updateInterval < 1)
updateInterval = 1;
if (updateInterval > 2000)
updateInterval = 2000;
jQuery(this).val("" + updateInterval);
}
});
// setup plot
var options = {
yaxis : {
min : 0,
max : 100
},
xaxis : {
min : 0,
max : 100
},
colors : [$color_fourth],
series : {
lines : {
lineWidth : 1,
fill : true,
fillColor : {
colors : [{
opacity : 0.4
}, {
opacity : 0
}]
},
steps : false
}
}
};
var plot = jQuery.plot(jQuery("#flot-realtime"), [getRandomData()], options);
function update() {
plot.setData([getRandomData()]);
// since the axes don't change, we don't need to call plot.setupGrid()
plot.draw();
setTimeout(update, updateInterval);
}
update();
}
}

View file

@ -0,0 +1,34 @@
/** ********************************************** **
@Swiper Slider
@Last Update 11:24 AM Friday, April 17, 2015
@URL http://nivo.dev7studios.com
REQUIRED:
CSS
<link href="assets/plugins/slider.layerslider/css/layerslider.css" rel="stylesheet" type="text/css" />
JS
<script type="text/javascript" src="assets/plugins/slider.layerslider/js/layerslider_pack.js"></script>
<script type="text/javascript" src="assets/js/view/demo.layerslider_slider.js"></script>
*************************************************** **/
jQuery(document).ready(function() {
if(jQuery(".layerslider").length > 0) {
_layersliderInit();
}
});
/** _layersliderInit()
******************************* **/
function _layersliderInit() {
if(jQuery().layerSlider && jQuery("div.layerslider").length > 0) {
jQuery("div.layerslider").each(function() {
jQuery(this).layerSlider(layer_options);
});
}
}

View file

@ -0,0 +1,274 @@
/** ********************************************** **
@Music Demo [usage example]
@Last Update 2:00 PM Saturday, August 08, 2015
*************************************************** **/
jQuery(document).ready(function() {
_music();
});
/** _shop()
******************************* **/
function _music() {
/** AUDIO PLAYER
** *********************** **/
loadScript(plugin_path + 'mediaelement/mediaelement-and-player.min.js', function() { // load mediaelement plugin first!
/* global mejs, _wpmejsSettings */
(function ($) {
// add mime-type aliases to MediaElement plugin support
mejs.plugins.silverlight[0].types.push('video/x-ms-wmv');
mejs.plugins.silverlight[0].types.push('audio/x-ms-wma');
jQuery(function () {
var settings = {};
if ( typeof _wpmejsSettings !== 'undefined' ) {
settings = _wpmejsSettings;
}
settings.success = settings.success || function (mejs) {
var autoplay, loop;
if ( 'flash' === mejs.pluginType ) {
autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay;
loop = mejs.attributes.loop && 'false' !== mejs.attributes.loop;
autoplay && mejs.addEventListener( 'canplay', function () {
mejs.play();
}, false );
loop && mejs.addEventListener( 'ended', function () {
mejs.play();
}, false );
}
};
jQuery('audio,video').mediaelementplayer(settings);
});
}(jQuery));
/** ********************************* PLAYER REWRITE ********************************** **/
var theplayer = jQuery('audio').closest('.music-float-top-player, .music-top-player');
control = jQuery('audio').parent('.mejs-mediaelement').siblings('.mejs-controls');
// play pause next previous button
var play_control = jQuery('<div class="music-play-control"></div>');
control.prepend(play_control);
var previous = jQuery('<div class="music-previous-button"></div>');
previous.click(function(){
theplayer.siblings('.music-player-list').children('.active').prev().trigger('click');
});
previous.append('<i class="fa fa-backward"></i>');
previous.appendTo(play_control);
var play = control.children('.mejs-playpause-button');
play.children('button').remove();
play.append('<i class="fa"></i>');
play.appendTo(play_control)
var next = jQuery('<div class="music-next-button"></div>');
next.click(function(){
theplayer.siblings('.music-player-list').children('.active').next().trigger('click');
});
next.append('<i class="icon-forward"></i>')
next.appendTo(play_control);
// time elapse
var time_rail = control.children('.mejs-time-rail');
var time_elapse = jQuery('<div class="music-time-elapse">(</div>');
time_elapse.appendTo(time_rail);
time_elapse.append(control.children('.mejs-currenttime-container'));
time_elapse.append(jQuery('<span class="music-seperator"> / </span>'));
time_elapse.append(control.children('.mejs-duration-container'));
time_elapse.append(')');
// title and album thumbnail
theplayer.children('.music-top-player-title').prependTo(time_rail);
theplayer.children('.music-top-player-thumbnail').appendTo(time_rail);
// download section
theplayer.children('.music-top-player-download').each(function(){
jQuery(this).children('.top-player-list').click(function(){
theplayer.siblings('.music-player-list').slideToggle();
return false;
});
jQuery(this).appendTo(control);
});
// volumn bar
var volume_bar = jQuery('<div class="music-volumn-bar"></div>');
control.append(volume_bar);
control.children('.mejs-volume-button').appendTo(volume_bar);
control.children('.mejs-horizontal-volume-slider').appendTo(volume_bar);
// close bar
var open_bar = jQuery('#music-open-float-player');
var close_bar = jQuery('<div id="music-player-close" class="music-hide-float-bar"></div>');
close_bar.append('<i class="glyphicon glyphicon-remove"></i>');
control.append(close_bar);
/** ******************************************************************************* **/
/** *********************************** PLAYLIST ********************************** **/
function _playlist() {
jQuery(".music-player-list>li").click(function(){
if( jQuery(this).hasClass('active') ) return;
// case for album category page
jQuery('.music-player-list li').eq(jQuery(this).index()).each(function(){
jQuery(this).addClass('active');
jQuery(this).siblings().removeClass('active');
});
jQuery(this).addClass('active').siblings().removeClass('active');
var file = [];
if( jQuery(this).attr('data-mp3') ){
file.push({src: jQuery(this).attr('data-mp3'), type:'audio/mpeg'});
}
if( jQuery(this).attr('data-ogg') ){
file.push({src: jQuery(this).attr('data-ogg'), type:'audio/ogg'});
}
if( jQuery(this).attr('data-wav') ){
file.push({src: jQuery(this).attr('data-wav'), type:'audio/wav'});
}
var top_player = jQuery(this).parent('.music-player-list').siblings('.music-top-player, .music-float-top-player');
var song_title = (jQuery(this).attr('data-title'))? jQuery(this).attr('data-title'): jQuery(this).html();
top_player.find('.music-top-player-title').html(song_title);
if( jQuery(this).attr('data-download') ){
top_player.find('.top-player-download').attr('href', jQuery(this).attr('data-download')).show();
}else{
top_player.find('.top-player-download').hide();
}
if( jQuery(this).attr('data-apple') ){
top_player.find('.top-player-apple').attr('href', jQuery(this).attr('data-apple')).show();
}else{
top_player.find('.top-player-apple').hide();
}
if( jQuery(this).attr('data-amazon') ){
top_player.find('.top-player-amazon').attr('href', jQuery(this).attr('data-amazon')).show();
}else{
top_player.find('.top-player-amazon').hide();
}
top_player.find('audio:first').each(function(){
var temp_player;
if( typeof(this.player) == 'undefined' ){
temp_player = this;
}else{
temp_player = this.player;
}
temp_player.pause();
temp_player.setSrc(file);
temp_player.load();
temp_player.play();
});
});
} _playlist();
/** ******************************************************************************* **/
/** ******************************** SELECT ALBUM ********************************* **/
// select album
jQuery('.music-play-album').click(function(){
jQuery('.music-album-playing').removeClass('music-album-playing');
jQuery(this).addClass('music-album-playing');
var float_player = jQuery('#music-player');
var play_list = float_player.find('.music-player-list');
if( jQuery(this).siblings('.music-album-thumbnail').html() ){
float_player.find('.music-top-player-thumbnail').html( jQuery(this).siblings('.music-album-thumbnail').html() );
}
play_list.html( jQuery(this).siblings('.music-album-list').html() );
play_list.children('li').gdlr_play_list();
play_list.children('li:first').trigger('click');
});
// single album
jQuery('.music-album-song-list li .music-list-icon').click(function(){
jQuery(".music-album-song-list li").removeClass('active');
jQuery(this).closest('li').addClass('active');
var float_player = jQuery('#music-player');
var play_list = float_player.find('#music-player-list');
play_list.children().eq(jQuery(this).parent().index()).trigger('click');
});
/** ******************************************************************************* **/
/** ********************************* ALBUM PLAY ********************************** **/
jQuery('.album-play').click(function() {
jQuery('.album-play').removeClass('active');
jQuery(this).addClass('active');
var float_player = jQuery('#music-player');
var play_list = float_player.find('#music-player-list');
// if( jQuery(this).siblings('.music-top-player-thumbnail').html() ){
jQuery('.music-top-player-thumbnail').html(jQuery(this).siblings('.music-album-thumbnail').html());
// }
play_list.html( jQuery(this).siblings('.music-album-list').html() );
// play_list.attr('id', 'music-player-list');
_playlist();
play_list.children('li:first').trigger('click');
});
/** ******************************************************************************* **/
// play audio - [bottom player]
jQuery("#music-player .mejs-playpause-button").bind("click", function(e) {
e.preventDefault();
if(jQuery(this).hasClass('mejs-pause')) {
jQuery(".music-player-list>li").removeClass('active');
jQuery(".music-album-song-list li").removeClass('active');
}
});
// show player [bottom player]
jQuery("#music-player-open").bind("click", function(e) {
e.preventDefault();
jQuery("#music-player-open").animate({"bottom":"-70px"}, 400);
jQuery("#music-player").animate({"bottom":"0px"}, 400);
});
// hide player [bottom player]
jQuery("#music-player-close").bind("click", function(e) {
e.preventDefault();
jQuery("#music-player").animate({"bottom":"-160px"}, 400);
jQuery("#music-player-open").animate({"bottom":"6px"}, 400);
});
});
}

View file

@ -0,0 +1,53 @@
/** ********************************************** **
@Swiper Slider
@Last Update 11:24 AM Friday, April 17, 2015
@URL http://nivo.dev7studios.com
REQUIRED:
CSS
<link href="assets/plugins/slider.nivo/nivo-slider.css" rel="stylesheet" type="text/css" />
JS
<script type="text/javascript" src="assets/plugins/slider.nivo/jquery.nivo.slider.pack.js"></script>
<script type="text/javascript" src="assets/js/view/demo.nivo_slider.js"></script>
*************************************************** **/
jQuery(document).ready(function() {
if(jQuery(".nivoSlider").length > 0) {
_nivoInit();
}
});
/** _nivoInit()
******************************* **/
function _nivoInit() {
var _slider = jQuery('.nivoSlider'),
_controlNav = _slider.attr('data-controlNav'),
_pauseOnHover = _slider.attr('data-pauseOnHover');
_controlNav = (_controlNav == "true") ? true : false;
_pauseOnHover = (_pauseOnHover == "true") ? true : false;
_slider.nivoSlider({
effect: 'random',
slices: 15,
boxCols: 12,
boxRows: 6,
animSpeed: 500,
pauseTime: 6000,
directionNav: true,
controlNav: _controlNav,
pauseOnHover: _pauseOnHover,
prevText: '<i class="fa fa-angle-left"></i>',
nextText: '<i class="fa fa-angle-right"></i>',
afterLoad: function(){
// jQuery('#slider').find('.nivo-caption').addClass('slider-caption-bg');
}
});
}

View file

@ -0,0 +1,86 @@
/** ********************************************** **
@Ajax Portfolio
@Last Update Wednesday, April 22, 2015
*************************************************** **/
jQuery(window).ready(function() {
_portfolioAjaxOpen();
});
/** Ajax Page Open
**************************************************************** **/
function _portfolioAjaxOpen() {
jQuery("a.portfolio-ajax-page").bind("click", function(e) {
e.preventDefault();
// Get href URL
var _href = jQuery(this).attr('href');
// Continue if href is not empty!
if(_href != '' && _href != "#") {
// Hide if already open
if(jQuery("#portfolio_ajax_container").is(":visible")) {
jQuery("#portfolio_ajax_container").append('<span class="overlay light-4"><span><i class="fa fa-refresh fa-spin"></i><span></span>');
}
// LOAD AJAX CONTENT
jQuery.ajax({
url: _href,
data: {ajax:"true"},
type: 'GET',
// Error
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert(errorThrown); // usualy on headers 404 or Internal Server Error
},
// Success
success: function(data) {
jQuery('html,body').stop().animate({scrollTop: jQuery("#portfolio_ajax_container").offset().top - 120}, 800, 'easeInOutExpo');
jQuery("#portfolio_ajax_container .overlay").fadeOut();
jQuery("#portfolio_ajax_container").empty().append(data);
jQuery("#portfolio_ajax_container").slideDown(500, function() {
/**
REINIT PLUGINS
Required for ajax pages (owl carousel, tooltips, etc)
*/
Init(true);
// Init Close Button
_portfolioAjaxClose();
// Reinint Portfolio Open for next/prev buttons
_portfolioAjaxOpen(true);
});
}
});
}
});
}
/** Ajax Page Close
**************************************************************** **/
function _portfolioAjaxClose() {
jQuery("a.portfolio-ajax-close").bind("click", function(e) {
e.preventDefault();
jQuery("#portfolio_ajax_container").slideUp(500).empty();
jQuery("a.portfolio-ajax-page").unbind();
_portfolioAjaxOpen();
});
}

View file

@ -0,0 +1,279 @@
jQuery(document).ready(function() {
var revapi;
// Make Content Visible
jQuery(".fullwidthbanner ul , .fullscreenbanner ul").removeClass('hide');
/**
@HALFSCREEN SLIDER
**/
if(jQuery(".fullwidthbanner").length > 0) {
// Default Thumbs [small]
var thumbWidth = 100,
thumbHeight = 50,
hideThumbs = 200,
navigationType = "bullet",
navigationArrows = "solo",
navigationVOffset = 10;
// Shadow
_shadow = jQuery(".fullwidthbanner").attr('data-shadow') || 0;
// Small Thumbnails
if(jQuery(".fullwidthbanner").hasClass('thumb-small')) {
var navigationType = "thumb";
}
// Large Thumbnails
if(jQuery(".fullwidthbanner").hasClass('thumb-large')) {
var navigationType = "thumb";
thumbWidth = 195,
thumbHeight = 95,
hideThumbs = 0,
navigationArrows = "solo",
navigationVOffset = -94;
// Hide thumbs on mobile - Avoid gaps
/**
if(jQuery(window).width() < 800) {
setTimeout(function() {
var navigationVOffset = 10;
jQuery("div.tp-thumbs").addClass('hidden');
}, 100);
}
**/
}
// Init Revolution Slider
revapi = jQuery('.fullwidthbanner').revolution({
dottedOverlay:"none",
delay:9000,
startwidth:1170,
startheight: jQuery(".fullwidthbanner").attr('data-height') || 500,
hideThumbs:hideThumbs,
thumbWidth:thumbWidth,
thumbHeight:thumbHeight,
thumbAmount: parseInt(jQuery(".fullwidthbanner ul li").length) || 2,
navigationType:navigationType,
navigationArrows:navigationArrows,
navigationStyle:jQuery('.fullwidthbanner').attr('data-navigationStyle') || "round", // round,square,navbar,round-old,square-old,navbar-old (see docu - choose between 50+ different item)
touchenabled:"on",
onHoverStop:"on",
navigationHAlign:"center",
navigationVAlign:"bottom",
navigationHOffset:0,
navigationVOffset:navigationVOffset,
soloArrowLeftHalign:"left",
soloArrowLeftValign:"center",
soloArrowLeftHOffset:20,
soloArrowLeftVOffset:0,
soloArrowRightHalign:"right",
soloArrowRightValign:"center",
soloArrowRightHOffset:20,
soloArrowRightVOffset:0,
parallax:"mouse",
parallaxBgFreeze:"on",
parallaxLevels:[7,4,3,2,5,4,3,2,1,0],
shadow: parseInt(_shadow),
fullWidth:"on",
fullScreen:"off",
stopLoop:"off",
stopAfterLoops:-1,
stopAtSlide:-1,
spinner:"spinner0",
shuffle:"off",
autoHeight:"off",
forceFullWidth:"off",
hideThumbsOnMobile:"off",
hideBulletsOnMobile:"on",
hideArrowsOnMobile:"on",
hideThumbsUnderResolution:0,
hideSliderAtLimit:0,
hideCaptionAtLimit:768,
hideAllCaptionAtLilmit:0,
startWithSlide:0,
fullScreenOffsetContainer: ""
});
// Used by styleswitcher onle - delete this on production!
jQuery("#is_wide, #is_boxed").bind("click", function() { revapi.revredraw(); });
}
/**
@FULLSCREEN SLIDER
**/
if(jQuery(".fullscreenbanner").length > 0) {
var tpj=jQuery;
tpj.noConflict();
var revapi25;
// Shadow
_shadow = jQuery(".fullscreenbanner").attr('data-shadow') || 0;
tpj(document).ready(function() {
if(tpj('.fullscreenbanner').revolution != undefined) {
revapi25 = tpj('.fullscreenbanner').show().revolution({
dottedOverlay:"none",
delay:9000,
startwidth:1200,
startheight:700,
hideThumbs:10,
thumbWidth:100,
thumbHeight:50,
thumbAmount:4,
navigationType:"none",
navigationArrows:"solo",
navigationStyle:jQuery('.fullscreenbanner').attr('data-navigationStyle') || "round",
touchenabled:"on",
onHoverStop:"on",
swipe_velocity: 0.7,
swipe_min_touches: 1,
swipe_max_touches: 1,
drag_block_vertical: false,
keyboardNavigation:"on",
navigationHAlign:"center",
navigationVAlign:"bottom",
navigationHOffset:0,
navigationVOffset:30,
soloArrowLeftHalign:"left",
soloArrowLeftValign:"center",
soloArrowLeftHOffset:20,
soloArrowLeftVOffset:0,
soloArrowRightHalign:"right",
soloArrowRightValign:"center",
soloArrowRightHOffset:20,
soloArrowRightVOffset:0,
parallax:"mouse",
parallaxBgFreeze:"on",
parallaxLevels:[7,4,3,2,5,4,3,2,1,0],
shadow: parseInt(_shadow),
fullWidth:"off",
fullScreen:"on",
stopLoop:"off",
stopAfterLoops:-1,
stopAtSlide:-1,
shuffle:"off",
forceFullWidth:"off",
fullScreenAlignForce:"off",
hideThumbsOnMobile:"off",
hideBulletsOnMobile:"on",
hideArrowsOnMobile:"off",
hideThumbsUnderResolution:0,
hideSliderAtLimit:0,
hideCaptionAtLimit:768,
hideAllCaptionAtLilmit:0,
startWithSlide:0,
fullScreenOffsetContainer: jQuery("#header").hasClass('transparent') || jQuery("#header").hasClass('translucent') ? null : "#header"
});
}
}); //ready
}
/**
@KEN BURNS
**/
if(jQuery(".fullscreenbanner.ken-burns").length > 0) {
revapi = jQuery('.fullwidthbanner').revolution({
dottedOverlay:"none",
delay:9000,
startwidth:1170,
startheight:400,
hideThumbs:200,
thumbWidth:100,
thumbHeight:50,
thumbAmount:5,
navigationType:"bullet",
navigationArrows:"solo",
navigationStyle:jQuery('.fullwidthbanner').attr('data-navigationStyle') || "round",
touchenabled:"on",
onHoverStop:"off",
navigationHAlign:"center",
navigationVAlign:"bottom",
navigationHOffset:0,
navigationVOffset:10,
soloArrowLeftHalign:"left",
soloArrowLeftValign:"center",
soloArrowLeftHOffset:20,
soloArrowLeftVOffset:0,
soloArrowRightHalign:"right",
soloArrowRightValign:"center",
soloArrowRightHOffset:20,
soloArrowRightVOffset:0,
shadow:0,
fullWidth:"on",
fullScreen:"off",
stopLoop:"off",
stopAfterLoops:-1,
stopAtSlide:-1,
shuffle:"off",
autoHeight:"off",
forceFullWidth:"off",
hideThumbsOnMobile:"off",
hideBulletsOnMobile:"off",
hideArrowsOnMobile:"off",
hideThumbsUnderResolution:0,
hideSliderAtLimit:0,
hideCaptionAtLimit:0,
hideAllCaptionAtLilmit:0,
startWithSlide:0,
fullScreenOffsetContainer: ""
});
// Used by styleswitcher only - delete this on production!
jQuery("#is_wide, #is_boxed").bind("click", function() { revapi.revredraw(); });
}
}); //ready

View file

@ -0,0 +1,226 @@
/** ********************************************** **
@Shop Demo [usage example]
@Last Update 10:19 AM Wednesday, May 13, 2015
*************************************************** **/
jQuery(document).ready(function() {
_shop();
});
/** _shop()
******************************* **/
function _shop() {
/* ******************* PHP URL TO POST *************** */
var URL_POST = 'php/view/demo.shop.php'; // CHANGE IT!
/* *************************************************** */
/** ADD TO WISHLIST
** *********************** **/
jQuery("a.add-wishlist").bind("click", function(e) {
e.preventDefault();
var item_id = jQuery(this).attr('data-item-id');
if(parseInt(item_id) < 1) {
return false;
}
$.ajax({
url: URL_POST,
data: {ajax:"true", action:'add_to_wishlist', item_id:item_id},
type: "POST",
error: function(XMLHttpRequest, textStatus, errorThrown) {
// usualy on headers 404 or Internal Server Error
_toastr("ERROR 404 - Item Not Added to wishlist!","top-right","error",false);
},
success: function(data) {
data = data.trim(); // remove output spaces
// PHP RETURN: INVALID ITEM ID
if(data == '_invalid_id_') {
_toastr("INVALID ID - Item Not Added to wishlist!","top-right","error",false);
} else
// PHP RETURN: OK, ADDED TO WISHLIST
if(data == '_ok_') {
_toastr("Item Added to Your wishlist!","top-right","success",false);
// PHP RETURN: SOMETHING ELSE THAN EXPECTED
} else {
// if the php output is not _invalid_id_ OR _ok_ - maybe you have a php errors/warnings
_toastr("UNKNOWN ERROR - Item Not Added to wishlist!","top-right","error",false);
}
}
});
});
/** ADD TO COMPARE
** *********************** **/
jQuery("a.add-compare").bind("click", function(e) {
e.preventDefault();
var item_id = jQuery(this).attr('data-item-id');
if(parseInt(item_id) < 1) {
return false;
}
$.ajax({
url: URL_POST,
data: {ajax:"true", action:'add_to_compare', item_id:item_id},
type: "POST",
error: function(XMLHttpRequest, textStatus, errorThrown) {
// usualy on headers 404 or Internal Server Error
_toastr("ERROR 404 - Item Not Added to Compare List!","top-right","error",false);
},
success: function(data) {
data = data.trim(); // remove output spaces
// PHP RETURN: INVALID ITEM ID
if(data == '_invalid_id_') {
_toastr("INVALID ID - Item Not Added to Compare List!","top-right","error",false);
} else
// PHP RETURN: OK, ADDED TO WISHLIST
if(data == '_ok_') {
_toastr("Item Added to Your Compare List!","top-right","success",false); // OPTIONAL: REPLACE false WITH YOUR COMPARE LINK
// PHP RETURN: SOMETHING ELSE THAN EXPECTED
} else {
// if the php output is not _invalid_id_ OR _ok_ - maybe you have a php errors/warnings
_toastr("UNKNOWN ERROR - Item Not Added to Compare List!","top-right","error",false);
}
}
});
});
/** PRODUCT SINGLE
** *********************** **/
/**
@COLOR SELECTOR
**/
jQuery("#product-color-dd li a").bind("click", function(e) {
e.preventDefault();
var data_val = jQuery(this).attr('data-val').trim();
_color = jQuery(this).attr('href').trim();
/* change visual value and hidden input */
jQuery("#product-selected-color").css({"background-color":_color});
jQuery("#color").val(data_val); // UPDATE HIDDEN FIELD
});
/**
@SIZE SELECTOR
**/
jQuery("#product-size-dd li a").bind("click", function(e) {
e.preventDefault();
var data_val = jQuery(this).attr('data-val').trim();
/* change visual value and hidden input */
jQuery("#product-selected-size>span").empty().append(data_val);
jQuery("#size").val(data_val); // UPDATE HIDDEN FIELD
/* change visual selected */
jQuery("#product-size-dd li").removeClass('active');
jQuery(this).parent().addClass('active');
});
/**
@QTY SELECTOR
**/
jQuery("#product-qty-dd li a").bind("click", function(e) {
e.preventDefault();
var data_val = jQuery(this).attr('data-val').trim();
/* change visual value and hidden input */
jQuery("#product-selected-qty>span").empty().append(data_val);
jQuery("#qty").val(data_val); // UPDATE HIDDEN FIELD
/* change visual selected */
jQuery("#product-qty-dd li").removeClass('active');
jQuery(this).parent().addClass('active');
});
/** CHECKOUT
** *********************** **/
// New Account show|hide
jQuery("#accountswitch").bind("click", function() {
jQuery('#newaccount').slideToggle(200);
});
// Shipping Address show|hide
jQuery("#shipswitch").bind("click", function() {
jQuery('#shipping').slideToggle(200, function() {
// scroll down to shipping area.
if(jQuery('#shipping').is(":visible")) {
_scrollTo('#shipping', 150);
}
});
});
// Payment Check/Money Order
jQuery("#payment_check").bind("click", function() {
jQuery("#ccPayment").slideUp(200);
});
// Credit Card
jQuery("#payment_card").bind("click", function() {
jQuery("#ccPayment").slideDown(200);
});
}

View file

@ -0,0 +1,74 @@
/** ********************************************** **
@Swiper Slider
@Last Update 12:30 PM Sunday, April 12, 2015
@URL http://www.idangero.us/swiper/
REQUIRED:
CSS
<link href="assets/plugins/swiper/dist/css/swiper.min.css" rel="stylesheet" type="text/css" />
JS
<script type="text/javascript" src="assets/plugins/swiper/dist/js/swiper.jquery.min.js"></script>
<script type="text/javascript" src="assets/js/view/demo.swiper_slider.js"></script>
*************************************************** **/
jQuery(document).ready(function() {
if(jQuery(".swiper-container").length > 0) {
_swipperInit();
}
});
/** _swipperInit()
******************************* **/
function _swipperInit() {
var _swiper_container = jQuery(".swiper-container"),
_effect = _swiper_container.attr('data-effect') || 'slide',
_autoplay = _swiper_container.attr('data-autoplay') || false,
_speed = _swiper_container.attr('data-speed') || 1000,
_columns = _swiper_container.attr('data-columns') || 1,
_loop = _swiper_container.attr('data-loop') || false;
// Force Int
if(_autoplay != false || _autoplay != 'false') {
_autoplay = parseInt(_autoplay);
}
if(_loop == "true") {
_loop = true;
}
if(_effect == 'cube') {
var swiperSlider = new Swiper(_swiper_container, {
effect: _effect,
grabCursor: true,
speed: parseInt(_speed),
cube: {
shadow: true,
slideShadows: true,
shadowOffset: 20,
shadowScale: 0.94
}
});
} else {
var swiperSlider = new Swiper(_swiper_container, {
pagination: '.swiper-pagination',
paginationClickable: '.swiper-pagination',
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
spaceBetween: 1,
speed: parseInt(_speed),
loop: _loop,
autoplay: _autoplay || false,
effect: _effect,
grabCursor: false,
slidesPerView: parseInt(_columns)
});
}
}

View file

@ -0,0 +1,128 @@
/** ********************************************** **
@HOTEL PACK DEMO [usage example]
pack-hotel-*.html
*************************************************** **/
jQuery(document).ready(function() {
_init_();
});
/** _init_()
******************************* **/
function _init_() {
/* CALCULATE TOTAL BOOKING PRICE
pack-hotel-booking.html
*********************************** */
var _bookingData = []; // set as a default array
// Get Booking Details in array format
// Using a function is easier for multiple use
function _getBookingData() {
// room type
_bookingData[0] = jQuery("ul.booking-option-list>li>label.radio>input:checked").val() || '';
// room price
_bookingData[1] = jQuery("ul.booking-option-list>li>label.radio>input:checked").attr('data-price') || 0;
// check in date
_bookingData[2] = jQuery("input#client_checkin").val() || '';
// check out date
_bookingData[3] = jQuery("input#client_checkout").val() || '';
// Total Days [1 by default]
_bookingData[4] = 1;
// Calculate checkin-checkout in days when we have both dates (check in/out)
if(_bookingData[2] != '' && _bookingData[3] != '') {
var timeStampA = Date.parse(_bookingData[2]) / 1000, // convert checkin to timestamp
timeStampB = Date.parse(_bookingData[3]) / 1000, // convert checkout to timestamp
oneDay = 24 * 60 * 60 * 1000, // hours * minutes * seconds * milliseconds
firstDate = new Date(timeStampA * 1000),
secondDate = new Date(timeStampB * 1000),
diffDays = Math.round(Math.abs((firstDate.getTime() - secondDate.getTime())/(oneDay)));
// now we know in days - minimum 1 day, no matter what!
_bookingData[4] = diffDays == 0 ? 1 : diffDays;
}
// No. of rooms
_bookingData[5] = jQuery("select#client_rooms").val() || 1;
// Children
_bookingData[6] = jQuery("select#client_adults").val() || 1;
// Children
_bookingData[7] = jQuery("select#client_children").val() || 0;
// return array
return _bookingData;
}
// Calculate everything
function _computeBooking() {
// Call functions below to get current data
_bookingData = _getBookingData();
// set as a simple variables (easier to understand the code)
// commented - not used here (uncomment if you want to expand the code)
//_bookingDataType = _bookingData[0];
_bookingDataPrice = _bookingData[1];
//_bookingDataCheckIn = _bookingData[2];
//_bookingDataCheckOut = _bookingData[3];
_bookingDataDays = _bookingData[4];
_bookingDataRooms = _bookingData[5];
//_bookingDataAdults = _bookingData[6];
//_bookingDataChildren = _bookingData[7];
// Update total payment & nights
jQuery("#total_payment").html(_bookingDataDays * _bookingDataPrice * _bookingDataRooms);
jQuery("#total_nights").html(_bookingDataDays);
}
// On change
jQuery("form#bookingForm input, form#bookingForm select").on("change", function() {
_computeBooking();
});
// On load
_computeBooking();
}

View file

@ -0,0 +1,281 @@
/** ********************************************** **
@REALESTATE PACK DEMO [usage example]
pack-realestate-*.html
*************************************************** **/
var googleMapKey = "AIzaSyCqCn84CgZN6o1Xc3P4dM657HIxkX3jzPY";
jQuery(document).ready(function() {
_init_();
});
/** _init_()
******************************* **/
function _init_() {
/* LIST MODE
pack-realestate-property-list-1.html
pack-realestate-property-list-2.html
*********************************** */
window._lastClass = null;
jQuery('div.property-list-opt .property-list-btn>a').bind("click", function(e) {
e.preventDefault();
var _t = jQuery(this),
_class = _t.attr('data-class') || null;
if(window._lastClass == null) {
if(_class != null && _class != 'property-item-box') {
window._lastClass = _class;
} else {
window._lastClass = 'col-xs-12 col-md-4'; // fail safe
}
}
jQuery('div.property-list-opt .property-list-btn>a').removeClass('active');
_t.addClass('active');
if(_class != 'property-item-box') {
jQuery('div.property-item-list div.property-item').removeClass('property-item-box').parent().removeClass('col-md-6 col-md-5 col-md-4 col-md-3 col-md-2 col-lg-6 col-lg-5 col-lg-4 col-lg-3 col-lg-2');
// add to cookie (for php use if needed)
_setCookie('property-list-mode','unboxed', 30); // in days
} else {
jQuery('div.property-item-list div.property-item').addClass('property-item-box');
jQuery('div.property-item-list>div').addClass(window._lastClass);
// add to cookie (for php use if needed)
_setCookie('property-list-mode','boxed', 30); // in days
}
});
/* SAVE BUTTON
pack-realestate-property-item.html
*********************************** */
jQuery("#restate-save").bind('click', function(e) {
e.preventDefault();
var _this = jQuery(this),
_href = _this.attr('href');
jQuery.ajax({
url : _href,
dataType : 'html',
type : 'POST',
cache : true, // warning: this will cause a timestamp and will call the request twice
async : true,
beforeSend : function() {
jQuery('i', _this).toggleClass('fa fa-heart-o , fa fa-cog fa-spin');
},
success : function(data) {
_toastr("Successfully Saved!",'top-right',"success",false);
jQuery('i', _this).toggleClass('fa fa-heart-o , fa fa-cog fa-spin');
},
complete: function(){},
// 404 ERROR MESSAGE
error : function(xhr, ajaxOptions, thrownError) {
_toastr("ERROR: Please try again later!",'top-right',"error",false);
jQuery('i', _this).toggleClass('fa fa-heart-o , fa fa-cog fa-spin');
}
});
});
/* FULLSCREEN GOOGLE MAP
pack-realestate-property-item.html
*********************************** */
jQuery("a.togglemap").bind('click', function(e) {
e.preventDefault();
// get latitude and longitude
var _lat = jQuery(this).attr('data-lat') || 0,
_lng = jQuery(this).attr('data-lng') || 0;
// load scripts first
loadScript('//maps.google.com/maps/api/js?key=' + googleMapKey, function() {
loadScript(plugin_path + 'gmaps.js', function() {
// show map & init
jQuery("#map-fullscreen").show(0, function() {
/**
@BASIC GOOGLE MAP
**/
var map = new GMaps({
div: '#gmap-init',
lat: Number(_lat),
lng: Number(_lng)
});
var marker = map.addMarker({
lat: Number(_lat),
lng: Number(_lng),
title: 'Company, Inc.'
});
});
// close map
jQuery("#map-fullscreen>button").bind('click', function(e) {
e.preventDefault();
jQuery("#map-fullscreen").hide();
});
});
});
});
/* GOOGLE MAP ON SLIDER
pack-realestate-property-item-2.html
*********************************** */
var _gs_container = "#gmap-slider";
if(jQuery(_gs_container).length > 0) {
jQuery(window).on("load", function() {
// get latitude and longitude
var _gs_this = jQuery(_gs_container),
_gs_lat = _gs_this.attr('data-lat') || 0,
_gs_lng = _gs_this.attr('data-lng') || 0,
_sliderH = jQuery("#slider").outerHeight(); // slider height
// load scripts first
loadScript('//maps.google.com/maps/api/js?key=' + googleMapKey, function() {
loadScript(plugin_path + 'gmaps.js', function() {
// Slider and google map shouyld have the same height
_gs_this.height(_sliderH);
/**
@PANORAMA GOOGLE MAP
**/
var panorama = GMaps.createPanorama({
el: _gs_container,
lat: Number(_gs_lat),
lng: Number(_gs_lng)
});
});
});
});
}
/* MORTGAGE CALCULATOR
pack-realestate-property-item.html
*********************************** */
// Recalculate on change
jQuery("#mcalc-price, #mcalc-dpayment, #mcalc-rate").keyup(function() {
_mcalc();
});
jQuery("#mcalc-term").change(function() {
_mcalc();
});
// Morgage Calculator
function _mcalc() {
var _mcalc_price = jQuery("#mcalc-price").val() || 0, // price
_mcalc_term = jQuery("#mcalc-term").val() || 10, // term
_mcalc_dpayment = jQuery("#mcalc-dpayment").val() || 0, // % down payment
_mcalc_rate = jQuery("#mcalc-rate").val() || 0, // rate
_mcalc_charges = jQuery("#mcalc-charges").html() || 0, // monthyl charges
_mcalc_charges = Number(_mcalc_charges.replace(',',''));
// it's a rare case scenario when interest rate is 0
// it's not accurate but we cover it - info only!
if(_mcalc_rate == 0)
_mcalc_rate = 0.000000000001;
// DOWN PAYMENT AMOUNT
_result_amount = _mcalc_price / 100 * _mcalc_dpayment;
jQuery("#mcalc-result-downpayment").html(_result_amount.formatMoney(2, '.', ','));
// MORTGAGE AMOUNT
_result_mamount = _mcalc_price - _result_amount;
jQuery("#mcalc-result-mamount").html(_result_mamount.formatMoney(2, '.', ','));
// MONTHLY MORTGAGE PAYMENT
// Formula: M = P [ i(1 + i)^n ] / [ (1 + i)^n 1]
var P = _result_mamount; //principle / initial amount borrowed
var I = _mcalc_rate / 100 / 12; //monthly interest rate
var N = _mcalc_term * 12; //number of payments months
_result_mortgage = P * I * (Math.pow(1 + I, N)) / (Math.pow(1 + I, N) - 1);
jQuery("#mcalc-mortgage").html(_result_mortgage.formatMoney(2, '.', ','));
// TOTAL MONTHLY PAYMENT
_result_pmonthly = _result_mortgage + _mcalc_charges;
jQuery("#mcalc-pmonthly").html(_result_pmonthly.formatMoney(2, '.', ','));
}
if(jQuery("#mcalc-price").length > 0) {
_mcalc(); // init on load
}
}