// }
// //console.log('ul = ' + menuImg);
// //console.log('menu-id = ' + menuNum);
-// });
-
+// });
+
var page = $('body');
var submit_form = page.find("#ticket_form");
var oc_submit_form = page.find("#oc-ticket_form");
var oc_guides = oc_ticket_form.find('.guide_books');
var oc_valet = oc_ticket_form.find('.valetCount');
var oc_nights = oc_ticket_form.find(".oc-valet-nights");
-
+
var ticket_total = ticket_form.find($('.ticket-total'));
var oc_ticket_total = oc_ticket_form.find($('.ticket-total'));
-
+
var total = {key: 0},adult_total = {key: 0},kid_total = {key: 0},kid_5_total = {key: 0},bikes_total = {key: 0}, nights_total = {key: 0}, valet_total = {key: 0}, guides_total = {key: 0};
var oc_total = 0,oc_adult_total = 0,oc_kid_total = 0,oc_kid_5_total = 0,oc_bikes_total = 0, oc_nights_total = 0, oc_valet_total = 0, oc_guides_total = 0;
-
+
// DROPDOWN TICKETS CALC /////////////////////////////////
$('.pseudo-dropdown').on("click", function(e){
e.preventDefault();
});
// set up blur function for the options dropdowns
var mouse_is_inside = false;
- $('.pseudo-content').hover(function(){
- mouse_is_inside=true;
- }, function(){
- mouse_is_inside=false;
+ $('.pseudo-content').hover(function(){
+ mouse_is_inside=true;
+ }, function(){
+ mouse_is_inside=false;
});
- $("body").mouseup(function(){
+ $("body").mouseup(function(){
if(! mouse_is_inside) $('.pseudo-content').hide();
});
el.parent().css("display",'none');
el.parent().prev().text( el.text());
var options = el.parent().next().children();
-
+
options.each(function(){
if(el.text() === $(this).val() ){
$(this).attr('selected','selected');
});
if( el.parent().hasClass('valetCount') ){
if( parseInt( el.text() ) > 0 ){
- $('.valet-nights-wrapper').fadeIn(300);
+ $('.valet-nights-wrapper').fadeIn(300);
} else {
- $('.valet-nights-wrapper').fadeOut(300);
+ $('.valet-nights-wrapper').fadeOut(300);
}
}
if( el.parent().hasClass('ticketCounter_4')){
el.parent().css("top",'0px');
}
}
-
+
adults.on('click', function(){
getValue($(this), adult_total, 24);
});
kids.on('click', function(){
getValue($(this), kid_total, 13);
});
-
+
kids_5.on('click', function(){
getValue($(this), kid_5_total, 0);
});
-
+
bikes.on('click', function(){
getValue($(this), bikes_total, 10);
});
-
+
guides.on("click", function(){
getValue($(this), guides_total, 2);
});
-
+
valet.on("click", function(){
getValue($(this), valet_total, 10);
});
-
+
nights.on("click", function(){
getValue($(this), nights_total, 1);
});
submit_form.find('select').on("change", function(){
total.key = adult_total.key + kid_5_total.key + kid_total.key + bikes_total.key + guides_total.key + (valet_total.key * nights_total.key);
-
+
ticket_total.text("$" + total.key);
});
submit_form.find('.pseudo-element').on("click", function(){
total.key = adult_total.key + kid_5_total.key + kid_total.key + bikes_total.key + guides_total.key + (valet_total.key * nights_total.key);
-
+
ticket_total.text("$" + total.key);
});
-
+
// OC TICKETS CALC EVENTS ////////////////////////////////
oc_adults.on('change', function(){
oc_adult_total = 0;
oc_adult_total = parseInt($(this).val()) * 24;
});
-
+
oc_kids.on('change', function(){
oc_kid_total = 0;
oc_kid_total = parseInt($(this).val()) * 13;
});
-
+
oc_kids_5.on('change', function(){
oc_kid_5_total = 0;
oc_kid_5_total = parseInt($(this).val()) * 0;
});
-
+
oc_bikes.on('change', function(){
oc_bikes_total = 0;
oc_bikes_total = parseInt($(this).val()) * 10;
});
-
+
oc_guides.on("change", function(){
oc_guides_total = 0;
oc_guides_total = parseInt($(this).val()) * 2;
});
-
+
oc_valet.on("change", function(){
oc_valet_total = 0;
oc_valet_total = parseInt($(this).val()) * 10;
});
-
+
oc_nights.on("change", function(){
oc_nights_total = 0;
oc_nights_total = parseInt($(this).val());
oc_total = oc_adult_total + oc_kid_5_total + oc_kid_total + oc_bikes_total + oc_guides_total + (oc_valet_total * oc_nights_total);
oc_ticket_total.text("$" + oc_total);
});
-
+
// end ticket form calculations and validation ///////////
-
+
address_1.on("click", function(){
var address = $(this).children('.address_1_street').text().replace(/ /g,'') + $(this).children(".address_1_region").text().replace(/ /g,'');
window.open('https://maps.google.com/?q=' + address, '_blank');
});
-
+
address_2.on("click", function(){
var address = $(this).children('.address_2_street').text().replace(/ /g,'') + $(this).children(".address_2_region").text().replace(/ /g,'');
window.open('https://maps.google.com/?q=' + address, '_blank');
});
-
+
oc_menu_items.each(function(index, value) {
- var title = $(this).children('a').text();
+ var title = $(this).children('a').text();
if( title === 'Schedules'){
$(this).remove();
}
});
-
+
tickets_menu.removeClass('drop-left').addClass('drop-right');
sub_menu_items.each(function(index, value){
var link = $(this).children('a');
link.addClass("submenu-link");
link = link[0].href;
-
+
$(this).on('click', function(e){
window.location = link;
});
-
+
});
$(menu_items).each(function(index, value){
schedules = $(this);
}
});
-
+
schedules.append( $('.schedules-dropdown') );
schedules.addClass("menu-item-has-children has-dropdown drop-right parent not-click");
tickets.children('ul').append( $('#ticket-form') );
tickets.children('ul').removeClass("medium-block-grid-5").addClass("medium-block-grid-1");
-
+
$(window).on("resize", function(){
if( $(window).width() > 1024){
schedules_widget.fadeIn(300);
});
schedules_widget.fadeIn(300);
ticket_form.fadeIn(300);
-
+
$('#valetCount').on("change", function(){
- $('.valet-nights-wrapper').fadeIn(300);
+ $('.valet-nights-wrapper').fadeIn(300);
if( $(this).val() === '0'){
nights.val('0');
nights_total = 0;
- $('.valet-nights-wrapper').fadeOut(300);
+ $('.valet-nights-wrapper').fadeOut(300);
}
});
$('#oc-valetCount').on("change", function(){
- $('.oc-valet-nights-wrapper').fadeIn(300);
+ $('.oc-valet-nights-wrapper').fadeIn(300);
if( $(this).val() === '0'){
oc_nights.val('0');
oc_nights_total = 0;
- $('.valet-nights-wrapper').fadeOut(300);
-
+ $('.valet-nights-wrapper').fadeOut(300);
+
}
});
oc_submit_form.submit(function(){
if($('.oc-valet-nights').val() === '0' && $('#oc-valetCount').val() !== '0'){
alert("Please enter the number of nights");
return false;
- }
+ }
});
submit_form.submit(function(){
if( $('.valet-nights').prev().text() === '0' && $('.valetCount').prev('button').text() !== '0'){
return false;
}
});
-
+
// This is better to be created dynamically
// This is ugly code, we just don't have time right now to make it more elegant
$('#dd-sched-1').parent().children('.google-map-link').after('<div class="newdd-sched-wrapper"></div>');
$('#newdd-sched-3').addClass('opened');
}
});
-
+
// redirect any clicks on the list items to the appropriate page
$('.newdd-sched-option').on('click', function() {
- location.href = "https://mackinacferry.gaslightmedia.com/ferry-rates-schedules/?dockId=" + $(this).attr('value') + "&scheduleId=" + $(this).parent().attr('id').slice(-1) + "#edit-divy";
+ location.href = "https://www.mackinacferry.com/ferry-rates-schedules/?dockId=" + $(this).attr('value') + "&scheduleId=" + $(this).parent().attr('id').slice(-1) + "#edit-divy";
});
});
// }
// //console.log('ul = ' + menuImg);
// //console.log('menu-id = ' + menuNum);
-// });
-
+// });
+
var page = $('body');
var submit_form = page.find("#ticket_form");
var oc_submit_form = page.find("#oc-ticket_form");
var oc_guides = oc_ticket_form.find('.guide_books');
var oc_valet = oc_ticket_form.find('.valetCount');
var oc_nights = oc_ticket_form.find(".oc-valet-nights");
-
+
var ticket_total = ticket_form.find($('.ticket-total'));
var oc_ticket_total = oc_ticket_form.find($('.ticket-total'));
-
+
var total = {key: 0},adult_total = {key: 0},kid_total = {key: 0},kid_5_total = {key: 0},bikes_total = {key: 0}, nights_total = {key: 0}, valet_total = {key: 0}, guides_total = {key: 0};
var oc_total = 0,oc_adult_total = 0,oc_kid_total = 0,oc_kid_5_total = 0,oc_bikes_total = 0, oc_nights_total = 0, oc_valet_total = 0, oc_guides_total = 0;
-
+
// DROPDOWN TICKETS CALC /////////////////////////////////
$('.pseudo-dropdown').on("click", function(e){
e.preventDefault();
});
// set up blur function for the options dropdowns
var mouse_is_inside = false;
- $('.pseudo-content').hover(function(){
- mouse_is_inside=true;
- }, function(){
- mouse_is_inside=false;
+ $('.pseudo-content').hover(function(){
+ mouse_is_inside=true;
+ }, function(){
+ mouse_is_inside=false;
});
- $("body").mouseup(function(){
+ $("body").mouseup(function(){
if(! mouse_is_inside) $('.pseudo-content').hide();
});
el.parent().css("display",'none');
el.parent().prev().text( el.text());
var options = el.parent().next().children();
-
+
options.each(function(){
if(el.text() === $(this).val() ){
$(this).attr('selected','selected');
});
if( el.parent().hasClass('valetCount') ){
if( parseInt( el.text() ) > 0 ){
- $('.valet-nights-wrapper').fadeIn(300);
+ $('.valet-nights-wrapper').fadeIn(300);
} else {
- $('.valet-nights-wrapper').fadeOut(300);
+ $('.valet-nights-wrapper').fadeOut(300);
}
}
if( el.parent().hasClass('ticketCounter_4')){
el.parent().css("top",'0px');
}
}
-
+
adults.on('click', function(){
getValue($(this), adult_total, 24);
});
kids.on('click', function(){
getValue($(this), kid_total, 13);
});
-
+
kids_5.on('click', function(){
getValue($(this), kid_5_total, 0);
});
-
+
bikes.on('click', function(){
getValue($(this), bikes_total, 10);
});
-
+
guides.on("click", function(){
getValue($(this), guides_total, 2);
});
-
+
valet.on("click", function(){
getValue($(this), valet_total, 10);
});
-
+
nights.on("click", function(){
getValue($(this), nights_total, 1);
});
submit_form.find('select').on("change", function(){
total.key = adult_total.key + kid_5_total.key + kid_total.key + bikes_total.key + guides_total.key + (valet_total.key * nights_total.key);
-
+
ticket_total.text("$" + total.key);
});
submit_form.find('.pseudo-element').on("click", function(){
total.key = adult_total.key + kid_5_total.key + kid_total.key + bikes_total.key + guides_total.key + (valet_total.key * nights_total.key);
-
+
ticket_total.text("$" + total.key);
});
-
+
// OC TICKETS CALC EVENTS ////////////////////////////////
oc_adults.on('change', function(){
oc_adult_total = 0;
oc_adult_total = parseInt($(this).val()) * 24;
});
-
+
oc_kids.on('change', function(){
oc_kid_total = 0;
oc_kid_total = parseInt($(this).val()) * 13;
});
-
+
oc_kids_5.on('change', function(){
oc_kid_5_total = 0;
oc_kid_5_total = parseInt($(this).val()) * 0;
});
-
+
oc_bikes.on('change', function(){
oc_bikes_total = 0;
oc_bikes_total = parseInt($(this).val()) * 10;
});
-
+
oc_guides.on("change", function(){
oc_guides_total = 0;
oc_guides_total = parseInt($(this).val()) * 2;
});
-
+
oc_valet.on("change", function(){
oc_valet_total = 0;
oc_valet_total = parseInt($(this).val()) * 10;
});
-
+
oc_nights.on("change", function(){
oc_nights_total = 0;
oc_nights_total = parseInt($(this).val());
oc_total = oc_adult_total + oc_kid_5_total + oc_kid_total + oc_bikes_total + oc_guides_total + (oc_valet_total * oc_nights_total);
oc_ticket_total.text("$" + oc_total);
});
-
+
// end ticket form calculations and validation ///////////
-
+
address_1.on("click", function(){
var address = $(this).children('.address_1_street').text().replace(/ /g,'') + $(this).children(".address_1_region").text().replace(/ /g,'');
window.open('https://maps.google.com/?q=' + address, '_blank');
});
-
+
address_2.on("click", function(){
var address = $(this).children('.address_2_street').text().replace(/ /g,'') + $(this).children(".address_2_region").text().replace(/ /g,'');
window.open('https://maps.google.com/?q=' + address, '_blank');
});
-
+
oc_menu_items.each(function(index, value) {
- var title = $(this).children('a').text();
+ var title = $(this).children('a').text();
if( title === 'Schedules'){
$(this).remove();
}
});
-
+
tickets_menu.removeClass('drop-left').addClass('drop-right');
sub_menu_items.each(function(index, value){
var link = $(this).children('a');
link.addClass("submenu-link");
link = link[0].href;
-
+
$(this).on('click', function(e){
window.location = link;
});
-
+
});
$(menu_items).each(function(index, value){
schedules = $(this);
}
});
-
+
schedules.append( $('.schedules-dropdown') );
schedules.addClass("menu-item-has-children has-dropdown drop-right parent not-click");
tickets.children('ul').append( $('#ticket-form') );
tickets.children('ul').removeClass("medium-block-grid-5").addClass("medium-block-grid-1");
-
+
$(window).on("resize", function(){
if( $(window).width() > 1024){
schedules_widget.fadeIn(300);
});
schedules_widget.fadeIn(300);
ticket_form.fadeIn(300);
-
+
$('#valetCount').on("change", function(){
- $('.valet-nights-wrapper').fadeIn(300);
+ $('.valet-nights-wrapper').fadeIn(300);
if( $(this).val() === '0'){
nights.val('0');
nights_total = 0;
- $('.valet-nights-wrapper').fadeOut(300);
+ $('.valet-nights-wrapper').fadeOut(300);
}
});
$('#oc-valetCount').on("change", function(){
- $('.oc-valet-nights-wrapper').fadeIn(300);
+ $('.oc-valet-nights-wrapper').fadeIn(300);
if( $(this).val() === '0'){
oc_nights.val('0');
oc_nights_total = 0;
- $('.valet-nights-wrapper').fadeOut(300);
-
+ $('.valet-nights-wrapper').fadeOut(300);
+
}
});
oc_submit_form.submit(function(){
if($('.oc-valet-nights').val() === '0' && $('#oc-valetCount').val() !== '0'){
alert("Please enter the number of nights");
return false;
- }
+ }
});
submit_form.submit(function(){
if( $('.valet-nights').prev().text() === '0' && $('.valetCount').prev('button').text() !== '0'){
return false;
}
});
-
+
// This is better to be created dynamically
// This is ugly code, we just don't have time right now to make it more elegant
$('#dd-sched-1').parent().children('.google-map-link').after('<div class="newdd-sched-wrapper"></div>');
$('#newdd-sched-3').addClass('opened');
}
});
-
+
// redirect any clicks on the list items to the appropriate page
$('.newdd-sched-option').on('click', function() {
- location.href = "https://mackinacferry.gaslightmedia.com/ferry-rates-schedules/?dockId=" + $(this).attr('value') + "&scheduleId=" + $(this).parent().attr('id').slice(-1) + "#edit-divy";
+ location.href = "https://www.mackinacferry.com/ferry-rates-schedules/?dockId=" + $(this).attr('value') + "&scheduleId=" + $(this).parent().attr('id').slice(-1) + "#edit-divy";
});
});
Author: Gaslight Media
Author URI: http://www.gaslightmedia.com
Description: A theme for Star Line
-Version: 1.0.0
+Version: 1.0.1
*/