$(document).ready(function() { $(".copytext").click(function() { from = $(this).prev().attr('id'); copyText(from); }); $(".confirm_getout").click(function() { document.$loc_array $.get('/php/passenger_getout.php', "pce="+$(this).attr("data-pce")).done(function(check) { $(".confirm_getout").parent().parent().hide(); if(check=="error") document.location.href = "?done=error"; else document.location.href = "?done=getout"; }); }); //$(".copylink").click(function() { // copyText("copyfrom"); //}); $(".invitetab").click(function() { $('.withlink').toggle(); $('.viaemail').toggle(); $('.invitetab').toggleClass("selected"); }); $(".openInvite, .closeInvite").click(function() { $('.inviteLink').toggleClass('hideondesktop'); $('.invite').toggleClass('hideonmobile'); $('.closeInvite').toggleClass('hideondesktop'); }); $('body').on('click','#addcar_button',function(e){ if($(this).attr("data-type")=="private") addcartype = "private"; else addcartype = "public"; parent = $(this).closest(".normal_window"); $.post('/_addcar_'+addcartype+'.php', function(data) { $.getScript("/js/addcar.js"); $(data).insertBefore(parent); $('.nocar').remove(); }); }); $('body').on('click','#addacar .close',function(){ $('#addacar').remove(); $.get("/_nocar.php", function(data){ $(data).prependTo($('.right_col')); }); }); $('body').on('click','.carbox .close',function(){ var parent = $(this).closest("form"); $.post('/_car.php', "carid="+parent.data('carid'), function(data) { parent.find('.normal_window').remove(); parent.append(data); }); }); $('body').on('click','#addreminder .close',function(){ parent = $(this).closest(".left_col, .right_col"); $('#addreminder').remove(); $.get("/_reminder.php", function(data){ $(parent).append(data); }); }); $('body').on('click','.grabaseat',function(){ var parent = $(this).closest("form"); $.post('/_grabaseat.php', "carid="+$(this).data('carid'), function(data) { parent.find('.normal_window').remove(); parent.append(data); $.getScript("/js/grabaseat.js"); }); }); $('body').on('click','#addreminder_button',function(){ parent = $(this).closest(".normal_window"); $.post('/_addreminder.php', function(data) { $.getScript("/js/addreminder.js"); $(data).insertBefore(parent); $('.noseat').remove(); }); }); function validateEmail(value) { var regex = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; return (regex.test(value)) ? true : false; } $.getScript("/js/map.js"); $('body').on('click','.sendinvite',function(){ $("#emails").removeClass("missing"); $("#emails").next().hide(); var emailText = $('#emails').val(); var emailarray = emailText.replace(/\s/g, "").split(/,|;/); var ret = true; if(emailText!="") { for(var i = 0;i < emailarray.length;i++) { if(!validateEmail(emailarray[i])) { $("#emails").addClass("missing"); $("#emails").next().show(); ret = false; } } } else { $("#emails").addClass("missing"); $("#emails").next().show(); ret = false; } if(ret) { $(".sendinvite").prop('disabled', true); datastring = "recipients="+emailarray+"&mailingtodo=invite"; $.post('/php/mailing.php', datastring, function(check) { $("#emails").val(''); $(".sendinvite").prop('disabled', false); notify("Your invitation has been sent to these email addresses: "+emailarray,"zold"); }); } }); }); //# sourceURL=dashboard.js