$(document).ready(function(e) { setupCopy(); setupTooltips(); $('.showInfo').unbind("click"); $('.showInfo').click(function(){ swal.fire({ type:'info', title:$(this).attr('data-title'), html:$(this).attr('data-text') }) }); $('.show_click').click(function(){ $('#' + $(this).attr('data-show')).slideDown(800); }) $('#resendVerification').click(function(){ $.ajax({ url: 'controllers/user/verify_email.php', dataType: 'JSON', success: function (data) { $('#resendVerification').fadeOut(); $('#changeEmail').fadeOut(); } }) }) $('#changeEmail').click(function(){ swal.fire({ title:"Correct Your Email Address", html:"
\
Update your email address here.

Once your email address is verified, you will not be able to change again.
\
\ \
\
", showCancelButton:true, confirmButtonText:"Update Email Address" }).then(function(){ var email = $('#correct_email').val(); swal.fire({ type:'question', title:"Confirm Email Address", html:"Please confirm your email address is now correct

" + $('#correct_email').val() + "

", showCancelButton:true, confirmButtonText:"It's Correct!" }).then(function(){ $.ajax({ url: 'controllers/user/update_email.php', dataType: 'JSON', type:'POST', data:{ email:email }, success: function (data) { console.log(data); if(data.error == 1){ swal.fire({ type:"error", title:"Error updating email", html:data.message }) } else{ swal.fire({ type:"success", title:"Email Updated", html:"We've updated your email address.

Please check your Inbox/Junk folders for a message to verify the new email address." }) } } }) }) }) }) }); function checkRequest(request, handler="requestReturnMethod", cancelOnError=false, delay=2000){ var check = setInterval(function() { $.ajax({ url: 'controllers/request/check_request.php', type: 'POST', dataType: 'JSON', data: { check: 'check_request', request: request }, success: function (data) { if(data.is_complete == 1){ clearInterval(check); } if(data.error==1 && cancelOnError){ clearInterval(check); } window[handler](data); } }); }, delay); return check; } function setupTooltips(){ /* Code for attribute data-custom-class for adding custom class to tooltip */ if (typeof $.fn.tooltip.Constructor === 'undefined') { throw new Error('Bootstrap Tooltip must be included first!'); } var Tooltip = $.fn.tooltip.Constructor; // add customClass option to Bootstrap Tooltip $.extend(Tooltip.Default, { customClass: '' }); var _show = Tooltip.prototype.show; Tooltip.prototype.show = function() { // invoke parent method _show.apply(this, Array.prototype.slice.apply(arguments)); if (this.config.customClass) { var tip = this.getTipElement(); $(tip).addClass(this.config.customClass); } }; $('[data-toggle="tooltip"]').tooltip(); } function setupCopy(){ //console.log("Setup copy"); $('.copyText').unbind('click'); $('.copyText').click(function(e){ console.log("Copy"); e.preventDefault(); var copyTextarea = document.querySelector("#" + $(this).attr('data-target')); copyTextarea.select(); try { var successful = document.execCommand('copy'); toastr["success"]("The item was copied to your clipboard...", "Item Copied"); } catch (err) { } }) }