// JavaScript Document
function init_user_notification(){
// ============== Datatable ================
// --- Notification ----
if($('#notification_datatable').length){
$('#notification_datatable').dataTable( {
"deferRender": true,
"responsive": true,
"language": datatable_lang,
"lengthMenu": [[25, 50, -1], [25, 50, "All"]],
"order": [[ 0, "desc" ]],
"fnDrawCallback": function( oSettings ) {
if($('.details').length){
$('.details').click(function(e) {
//alert($(this).parent().parent().find('form').attr('action'));
$(this).unbind();
$(this).removeAttr('href');
$(this).parent().parent().find('form').submit();
});
}
} // "fnDrawCallback": function( oSettings ) {
} );
$('#notification_datatable .accept, #notification_datatable .ignore').each(function(){
$(this).click(function(e) {
// -------- AJAX ------
$.ajax({
url: local_url+'lib/ajax/orgrolerequest/?isr='+(($(this).hasClass('accept')) ? 1 : 0),
data: $('form').serialize(),
type:"POST",
dataType:'json',
beforeSend: function(msg){
ajax_show_loading_mask(true);
},
complete: function(msg){
setTimeout(function() {
//ajax_show_loading_mask(false);
}, 500);
},
success: function(json_data){
setTimeout(function() {
//alert(json_data.status);
//return;
if(json_data.status == 1){
if(json_data.odr){
$(location).attr('href', json_data.odr);
} else {
window.location.reload();
}
} else {
ajax_show_loading_mask(false);
if(json_data.status == -4003){
$(location).attr('href', local_url+'logout/');
} else if(json_data.status == -1001){
ajax_form_show_topBarMessage(1);
}
}
}, 500);
},
error:function(xhr, ajaxOptions, thrownError){
setTimeout(function() {
ajax_show_loading_mask(false);
ajax_form_show_topBarMessage(1);
}, 500);
}
});
// -- END --- AJAX ----
});
});
}
} // function init_user_notification(){
//------ signup ------------------------------------------------------------------
var signupFBHandler = function(e) {
if(e != null){
if(($(e.currentTarget).is('input') || $(e.currentTarget).is('textarea')) && e.which != 13){
return;
} // if(($(e.currentTarget).is('input') || $(e.currentTarget).is('textarea')) && e.which != 13){
}
var ajax_url = '';
var ajax_form = null;
ajax_form = ($('#register_form').length ? $('#register_form') : ($('#reserve_eticket_onhold').length ? $('#reserve_eticket_onhold') : $('#waitlist_eticket_onhold') ) );
ajax_url = local_url+'lib/ajax/'+(($(e.currentTarget).attr('id') == 'fbsignup_submitBtn') ? 'loginfb' : 'logingo' )+'/';
$.ajax({
url: ajax_url,
headers: { 'X-Etickets-Key': $('#h').val() },
data: ajax_form.serialize(),
type:"POST",
dataType:'json',
beforeSend: function(msg){
ajax_show_loading_mask(true);
ajax_submitBtn_setInProgress_withLoadingBar($("#"+(($(e.currentTarget).attr('id') == 'fbsignup_submitBtn') ? 'fb': 'g')+"signup_submitBtn"), function(){}, true);
if($('#login_err_msg').length){
$("#login_err_msg").stop();
$("#login_err_msg").height("0");
$("#login_err_msg").css("opacity", 0);
$("#login_err_msg").css("padding", 0);
}
if($('#login_err_msg').length){
$("#login_err_msg_fb").stop();
$("#login_err_msg_fb").height("0");
$("#login_err_msg_fb").css("opacity", 0);
$("#login_err_msg_fb").css("padding", 0);
}
if($('#signup_form').length){
$('#login_email').css("border", "1px solid #CCCCCC");
$('#login_pw').css("border", "1px solid #CCCCCC");
$('#login_pw_re').css("border", "1px solid #CCCCCC");
$("#signup_form input[type!='hidden']").each(function(){
$(this).prop('disabled', true);
})
}
if($('#register_form').length){
$('#login_email').css("border", "1px solid #CCCCCC");
$('#login_pw').css("border", "1px solid #CCCCCC");
$("#register_form input[type!='hidden']").each(function(){
$(this).prop('disabled', true);
})
}
},
complete: function(msg){
if($('#signup_form').length){
$("#signup_form input[type!='hidden']").each(function(){
$(this).prop('disabled', false);
})
}
if($('#register_form').length){
$("#register_form input[type!='hidden']").each(function(){
$(this).prop('disabled', false);
})
}
},
success: function(json_data){
//alert(json_data.url);
//return;
setTimeout(function() {
if(json_data.status == 1){
$(location).attr('href', json_data.url);
} else {
ajax_show_loading_mask(false);
ajax_submitBtn_setInProgress_withLoadingBar($("#"+(($(e.currentTarget).attr('id') == 'fbsignup_submitBtn') ? 'fb': 'g')+"signup_submitBtn"), signupFBHandler, false);
if($('#login_err_msg_fb').length){
$("#login_err_msg_fb").stop();
$("#login_err_msg_fb").html(((isMobileWesite) ? '' : '')+ajax_showStatusMessage(json_data.status));
$("#login_err_msg_fb").animate((json_data.status == -5001 ? {height: ((isMobileWesite) ? "350px" : "300px"), padding:"30px 0 50px 0"} : {height: "10px", padding:"30px 0 50px 0"}), "fast");
$("#login_err_msg_fb").animate({"opacity": "1"}, "fast");
}
$("html, body").animate({ scrollTop:0 }, "fast");
}
}, 500);
},
error:function(xhr, ajaxOptions, thrownError){
setTimeout(function() {
ajax_show_loading_mask(false);
ajax_submitBtn_setInProgress_withLoadingBar($("#"+(($(e.currentTarget).attr('id') == 'fbsignup_submitBtn') ? 'fb': 'g')+"signup_submitBtn"), signupFBHandler, false);
if($('#login_err_msg_fb').length){
$("#login_err_msg_fb").stop();
$("#login_err_msg_fb").html(((isMobileWesite) ? '' : '')+ajax_showStatusMessage(-1001));
$("#login_err_msg_fb").animate({height: "10px", padding:"30px 0 50px 0"}, "fast");
$("#login_err_msg_fb").animate({"opacity": "1"}, "fast");
}
$("html, body").animate({ scrollTop:0 }, "fast");
}, 500);
}
}); //$.ajax({
}
var signupHandler = function(e) {
if(e != null){
if(($(e.currentTarget).is('input') || $(e.currentTarget).is('textarea')) && e.which != 13){
return;
} // if(($(e.currentTarget).is('input') || $(e.currentTarget).is('textarea')) && e.which != 13){
}
var ajax_url = '';
var ajax_form = null;
$('form').each(function(){
switch($(this).attr('id')){
case 'signup_form':
ajax_form = $('#signup_form');
ajax_url = local_url+'lib/ajax/signup/';
break;
case 'forgot_form':
ajax_form = $('#forgot_form');
ajax_url = local_url+'lib/ajax/forgot/';
break;
case 'register_form':
ajax_form = $('#register_form');
ajax_url = local_url+'lib/ajax/login/';
break;
default:
return;
break;
}
})
$.ajax({
url: ajax_url,
headers: { 'X-Etickets-Key': $('#h').val() },
data: ajax_form.serialize(),
type:"POST",
dataType:'json',
beforeSend: function(msg){
ajax_show_loading_mask(true);
ajax_submitBtn_setInProgress_withLoadingBar($(".form_submitBtn"), function(){}, true);
$("#login_err_msg").stop();
$("#login_err_msg").height("0");
$("#login_err_msg").css("opacity", 0);
$("#login_err_msg").css("padding", 0);
$("#login_err_msg_fb").stop();
$("#login_err_msg_fb").height("0");
$("#login_err_msg_fb").css("opacity", 0);
$("#login_err_msg_fb").css("padding", 0);
if($('#signup_form').length){
$("#signup_form input[type!='hidden']").each(function(){
$(this).prop('disabled', true);
})
}
if($('#forgot_form').length){
$("#forgot_form input[type!='hidden']").each(function(){
$(this).prop('disabled', true);
})
}
if($('#register_form').length){
$("#register_form input[type!='hidden']").each(function(){
$(this).prop('disabled', true);
})
}
},
complete: function(msg){
if($('#signup_form').length){
$("#signup_form input[type!='hidden']").each(function(){
$(this).prop('disabled', false);
})
}
if($('#forgot_form').length){
$("#forgot_form input[type!='hidden']").each(function(){
$(this).prop('disabled', false);
})
}
if($('#register_form').length){
$("#register_form input[type!='hidden']").each(function(){
$(this).prop('disabled', false);
})
}
},
success: function(json_data){
//alert(json_data.status);
setTimeout(function() {
if(json_data.status != 1){
ajax_show_loading_mask(false);
ajax_submitBtn_setInProgress_withLoadingBar($("#loginsignup_submitBtn"), signupHandler, false);
}
signup_showMessage(json_data);
}, 500);
},
error:function(xhr, ajaxOptions, thrownError){
//alert(xhr.responseText);
setTimeout(function() {
ajax_show_loading_mask(false);
ajax_submitBtn_setInProgress_withLoadingBar($("#loginsignup_submitBtn"), signupHandler, false);
signup_showMessage({status:-1001});
}, 500);
}
});
};
function signup_showMessage(json_data){
var status_number = json_data.status;
$("#login_err_msg").stop();
if(status_number != 1){
if(status_number == -5001){
$("#login_err_msg").animate({height: ((isMobileWesite) ? "350px" : "300px"), padding:"30px 0 50px 0"}, "fast");
} else {
$("#login_err_msg").animate({height: "10px", padding:"30px 0 50px 0"}, "fast");
}
}
if(status_number != 2){
$("#login_err_msg").animate({"opacity": "1"}, "fast");
$("html, body").animate({ scrollTop:$('#login_err_msg').offset().top }, "fast");
}
$('#login_email').css("border", "1px solid #CCCCCC");
$('#login_pw').css("border", "1px solid #CCCCCC");
if($('#login_pw_re').length){
$('#login_pw_re').css("border", "1px solid #CCCCCC");
}
switch(status_number){
case -1005:
window.location.reload();
break;
case -2:
$('#login_pw').css("border", "1px solid #FF8000");
break;
case -3:
case -8:
$('#login_email').css("border", "1px solid #FF8000");
$('#login_pw').css("border", "1px solid #FF8000");
break;
case -1:
case -4:
case -5:
case -7:
$('#login_email').css("border", "1px solid #FF8000");
break;
case -6:
case -12:
$('#login_pw').css("border", "1px solid #FF8000");
$('#login_pw_re').css("border", "1px solid #FF8000");
break;
case -9:
case -10:
case -23:
$('#login_email').css("border", "1px solid #FF8000");
$('#login_email_re').css("border", "1px solid #FF8000");
break;
case 1:
$(location).attr('href', json_data.gurl);
break;
case 2:
if($('#signup_form').length){
if($('#fbsignup_submitBtn').length){
$('#fbsignup_submitBtn').parent().parent().remove();
} // if($('#fbsignup_submitBtn').length){
if($('#gsignup_submitBtn').length){
$('#gsignup_submitBtn').parent().parent().remove();
} //if($('#gsignup_submitBtn').length){
setTimeout(function() {
$(location).attr('href', local_url+'account/profile/');
}, 1000*20);
} // if($('#signup_form').length){
if($('#login_email').length){
$('#login_email').hide();
} //if($('#login_email').length){
if($('#login_email_re').length){
$('#login_email_re').hide();
} // if($('#login_email_re').length){
if($('#loginsignup_submitBtn').length){
$("#loginsignup_submitBtn").hide();
} // if($('#loginsignup_submitBtn').length){
if($('.forgot_tag_wordings').length){
$('.forgot_tag_wordings').hide();
}
if($('#login_pw').length){
$('#login_pw').hide();
} // if($('#login_pw').length){
if($('#login_pw_re').length){
$('#login_pw_re').hide();
} // if($('#login_pw_re').length){
if($('.loginsignup_terms').length){
$('.loginsignup_terms').hide();
} // if($('#loginsignup_terms').length){
$("#login_err_msg").stop();
$("#login_err_msg").css('color', 'green');
$("#login_err_msg").animate({height: "10px", padding:"30px 0 50px 0", opacity:"1"}, "fast");
break;
}
$("#login_err_msg").html(ajax_showStatusMessage(status_number));
}
function init_user_login_signup_form_event(){
if($('#ms').length){
// force logout message
if($( "#dialog" ).length){
setTimeout(function() {
var t = $('#mt').val();
var cancelBtn_t = $('#btn00').val();
var confirmBtn_t = $('#btn01').val();
$( "#dialog" ).html($('#ms').val());
$( "#dialog" ).dialog({
dialogClass:"ui-datepicker-dialog",
open: function(){
$('.ui-widget-overlay').hide().fadeIn();
$('.ui-widget-overlay').bind('click', function() {
$('#dialog').dialog('close');
})
},
show: {
effect: "clip",
duration: 200
},
hide: {
effect: "clip",
duration: 200
},
resizable: false,
autoOpen: true,
draggable: false,
width: 'auto',
modal: true,
closeOnEscape: false,
title: t,
create: function( event, ui ) {
if(!isMobileWesite)
$(this).css("maxWidth", "420px");
},
buttons: [
{
text: confirmBtn_t,
click: function() {
$( this ).dialog( "close" );
}
},
{
text: cancelBtn_t,
click: function() {
$( this ).dialog( "close" );
$(location).attr('href', local_url+'forgot/?message='+$('#message').val())
}
}
]
});
}, 500);
} // if($( "#dialog" ).length){
} // if($('#wa').length){
if($('#loginsignup_submitBtn').length){
$("#loginsignup_submitBtn").bind("click", signupHandler);
}
if($('#login_email').length){
$('#login_email').bind("keypress", signupHandler);
}
if($('#login_pw').length){
$('#login_pw').bind("keypress", signupHandler);
}
if($('#login_pw_re').length){
$('#login_pw_re').bind("keypress", signupHandler);
}
if($('#login_email_re').length){
$('#login_email_re').bind("keypress", signupHandler);
}
if($('#fbsignup_submitBtn').length){
$("#fbsignup_submitBtn").bind("click", signupFBHandler);
}
if($('#gsignup_submitBtn').length){
$("#gsignup_submitBtn").bind("click", signupFBHandler);
}
}
//--- END signup -------------------------------------------------------------------
//--- Change password language -------------------------------------------------------------------
function ajax_show_loading_mask(boo){
if($('.ajax-mask').length){
$('.ajax-mask').remove();
}
if(boo){
var loading_str_name = 'ajax-loading.gif';
switch(Number(global_js_params.lang)){
default:
case 1:
loading_str_name = 'ajax-loading.gif';
break;
case 2:
loading_str_name = 'ajax-loading_tc.gif';
break;
case 3:
loading_str_name = 'ajax-loading_sc.gif';
break;
}
var loadingDiv = $('
').css({
//'top': ((fullscreenBoo) ? 0 : $(window).scrollTop()+'px'),
'top': 0,
'left':0,
'width': $(document).width(),
//'height': ((fullscreenBoo) ? $(document).height() : $(window).height()+'px'),
'height': $(document).height(),
});
//isMobileWesite
loadingDiv.find('.loading_img').css('top', ($(window).scrollTop()+$(window).height()/2-30)+'px');
$('#page_content').append(loadingDiv);
//$('.ajax-mask').css('width', '100% !important');
//$('.ajax-mask').css('height', '100% !important');
}
}
var changeLangHandler = function(e) {
if(e != null){
if(($(e.currentTarget).is('input') || $(e.currentTarget).is('textarea')) && e.which != 13){
return;
} // if(($(e.currentTarget).is('input') || $(e.currentTarget).is('textarea')) && e.which != 13){
}
ajax_form_show_topBarMessage(0);
ajax_submitBtn_setInProgress_withLoadingBar($("#changelang_submitBtn"), function(){}, true);
if(!changelang_checkNoErr()){
// ---------------- scroll top --------------------
var pos_top = 0;
if($('#changelang_form').find('div[id*="err"]').length > 0){
if(typeof($(this).attr('id')) != 'undefined'){
var id = $('#changelang_form').find('div[id*="err"]').first().attr('id').replace('_err', '');
//id = (id == 'project_description_eng' || id == 'project_description_chi')? 'project_description_tabs' : id;
//id = (id == 'project_profile')? 'project_name_tabs' : id;
pos_top = $('#'+id+'').offset().top;
}
}
// filter err
pos_top -= 160;
$("html, body").animate({ scrollTop:pos_top }, "fast");
// --- END ----- scroll top ----------------------
// button
ajax_submitBtn_setInProgress_withLoadingBar($("#changelang_submitBtn"), changeLangHandler, false);
} else { // if(changelang_checkNoErr()){
$.ajax({
url: local_url+'lib/ajax/change_lang/',
headers: { 'X-Etickets-Key': $('#h').val() },
data: $('#changelang_form').serialize(),
type:"POST",
dataType:'json',
beforeSend: function(msg){
ajax_show_loading_mask(true);
},
complete: function(msg){
setTimeout(function() {
ajax_show_loading_mask(false);
ajax_submitBtn_setInProgress_withLoadingBar($("#changelang_submitBtn"), changeLangHandler, false);
}, 500);
},
success: function(json_data){
if(json_data.status == 1){
window.location.reload();
} else {
setTimeout(function() {
changepw_showMessage(-1001);
ajax_form_show_topBarMessage(1);
}, 500);
}
},
error:function(xhr, ajaxOptions, thrownError){
setTimeout(function() {
changepw_showMessage(-1001);
ajax_form_show_topBarMessage(1);
}, 500);
}
});
} // if(changelang_checkNoErr()){
};
var changePasswordHandler = function(e) {
if(e != null){
if(($(e.currentTarget).is('input') || $(e.currentTarget).is('textarea')) && e.which != 13){
return;
} // if(($(e.currentTarget).is('input') || $(e.currentTarget).is('textarea')) && e.which != 13){
}
ajax_form_show_topBarMessage(0);
ajax_submitBtn_setInProgress_withLoadingBar($("#changepw_submitBtn"), function(){}, true);
if(!changepw_checkNoErr()){
// ---------------- scroll top --------------------
var pos_top = 0;
if($('#changepw_form').find('div[id*="err"]').length > 0){
if(typeof($(this).attr('id')) != 'undefined'){
var id = $('#changepw_form').find('div[id*="err"]').first().attr('id').replace('_err', '');
//id = (id == 'project_description_eng' || id == 'project_description_chi')? 'project_description_tabs' : id;
//id = (id == 'project_profile')? 'project_name_tabs' : id;
pos_top = $('#'+id+'').offset().top;
}
}
// filter err
pos_top -= 160;
$("html, body").animate({ scrollTop:pos_top }, "fast");
// --- END ----- scroll top ----------------------
// button
ajax_submitBtn_setInProgress_withLoadingBar($("#changepw_submitBtn"), changePasswordHandler, false);
} else { // if(changepw_checkNoErr()){
$.ajax({
url: local_url+'lib/ajax/change/',
headers: { 'X-Etickets-Key': $('#h').val() },
data: $('#changepw_form').serialize(),
type:"POST",
dataType:'json',
beforeSend: function(msg){
ajax_show_loading_mask(true);
},
complete: function(msg){
setTimeout(function() {
ajax_show_loading_mask(false);
ajax_submitBtn_setInProgress_withLoadingBar($("#changepw_submitBtn"), changePasswordHandler, false);
}, 500);
},
success: function(json_data){
setTimeout(function() {
if(json_data.status == 1){
changepw_showMessage(3);
} else {
changepw_showMessage(json_data.status);
if(json_data.status == -4003){
$(location).attr('href', local_url+'logout/');
} else if(json_data.status == -1001){
ajax_form_show_topBarMessage(1);
}
}
}, 500);
},
error:function(xhr, ajaxOptions, thrownError){
setTimeout(function() {
changepw_showMessage(-1001);
ajax_form_show_topBarMessage(1);
}, 500);
}
});
} // if(changepw_checkNoErr()){
};
function changepw_showMessage(status_number){
$('#changepw_login_pw').css("border", "1px solid #ccc");
$('#changepw_login_pw_re').css("border", "1px solid #ccc");
$('#changepw_login_pw_current').css("border", "1px solid #ccc");
switch(status_number){
case -20:
$('#changepw_login_pw').css("border", "1px solid #FF8000");
$('#changepw_login_pw_re').css("border", "1px solid #FF8000");
$('#changepw_login_pw_current').css("border", "1px solid #FF8000");
var _target = null;
_target = $('#changepw_login_pw');
if(!$('#'+_target.attr('id')+'_err').length){
_target.css("border", "1px solid #FF8000");
_target.after(''+ajax_showStatusMessage(status_number)+'
');
}
_target = $('#changepw_login_pw_re');
if(!$('#'+_target.attr('id')+'_err').length){
_target.css("border", "1px solid #FF8000");
_target.after(''+ajax_showStatusMessage(status_number)+'
');
}
_target = $('#changepw_login_pw_current');
if(!$('#'+_target.attr('id')+'_err').length){
_target.css("border", "1px solid #FF8000");
_target.after(''+ajax_showStatusMessage(status_number)+'
');
}
break;
case -19:
$('#changepw_login_pw_current').css("border", "1px solid #FF8000");
var _target = null;
_target = $('#changepw_login_pw_current');
if(!$('#'+_target.attr('id')+'_err').length){
_target.css("border", "1px solid #FF8000");
_target.after(''+ajax_showStatusMessage(status_number)+'
');
}
break;
case -16:
case -17:
case -18:
$('#changepw_login_pw').css("border", "1px solid #FF8000");
$('#changepw_login_pw_re').css("border", "1px solid #FF8000");
var _target = null;
_target = $('#changepw_login_pw');
if(!$('#'+_target.attr('id')+'_err').length){
_target.css("border", "1px solid #FF8000");
_target.after(''+ajax_showStatusMessage(status_number)+'
');
}
_target = $('#changepw_login_pw_re');
if(!$('#'+_target.attr('id')+'_err').length){
_target.css("border", "1px solid #FF8000");
_target.after(''+ajax_showStatusMessage(status_number)+'
');
}
break;
case 3:
$('#changepw_login_pw').val('');
$('#changepw_login_pw_re').val('');
$('#changepw_login_pw_current').val('');
ajax_form_show_topBarMessage(4);
break;
}
}
function changepw_checkNoErr(){
var err_no = 0;
$("#changepw_form input[type!='hidden']").each(function(){
if(typeof($(this).attr('id')) != 'undefined'){
if($(this).is(":focus")){
$(this).blur();
} // if($(this).is(":focus")){
};
});
$("#changepw_form input[type!='hidden']").each(function(){
changepw_onFocus($(this));
changepw_onBlur($(this));
});
err_no = $('#changepw_form').find('div[id*="err"]').length;
if(err_no == 0){
return true;
}
return false;
}
function changepw_onFocus(_target){
_target.css("border", "1px solid #05D08F");
if(typeof($(_target).attr('id')) != 'undefined'){
if($('#'+_target.attr('id')+'_err').length){
$('#'+_target.attr('id')+'_err').remove();
}
} // if(typeof(_target.attr('id')) != 'undefined'){
}
function changepw_onBlur(_target){
_target.css("border", "1px solid #ccc");
if($.trim(_target.val()) == '' || $.trim(Number(_target.val())) == '0'){
if(typeof(_target.attr('id')) != 'undefined'){
// * require field ------------
if( _target.attr('id') == 'changepw_login_pw' ||
_target.attr('id') == 'changepw_login_pw_re' ||
_target.attr('id') == 'changepw_login_pw_current' ){
if(!$('#'+_target.attr('id')+'_err').length){
_target.css("border", "1px solid #FF8000");
_target.after(''+ajax_showStatusMessage(-46)+'
');
}
}
} //if(typeof(_target.attr('id')) != 'undefined'){
} else { //if($.trim(_target.val()) == ''){
if(_target.is(':disabled')){
_target.css("color", "#999999");
}
} //if($.trim(_target.val()) == ''){
}
function init_user_changepw_form_event(){
if($('#changepw_form').length){
$("#changepw_form input[type!='hidden']").each(function(){
$(this).focus(function() {
changepw_onFocus($(this));
}); //$(this).focus(function() {
$(this).blur(function() {
changepw_onBlur($(this));
}); //$(this).blur(function() {
$(this).bind("keypress", changePasswordHandler);
});
$("#changepw_submitBtn").bind("click", changePasswordHandler);
} // if($('#changepw_form').length){
}
function changelang_checkNoErr(){
var err_no = 0;
$("#changelang_form input[type!='hidden']").each(function(){
if(typeof($(this).attr('id')) != 'undefined'){
if($(this).is(":focus")){
$(this).blur();
} // if($(this).is(":focus")){
};
});
$("#changelang_form input[type!='hidden']").each(function(){
changelang_onFocus($(this));
changelang_onBlur($(this));
});
err_no = $('#changelang_form').find('div[id*="err"]').length;
if(err_no == 0){
return true;
}
return false;
}
function changelang_onFocus(_target){
_target.css("border", "1px solid #05D08F");
if(typeof($(_target).attr('id')) != 'undefined'){
if($('#'+_target.attr('id')+'_err').length){
$('#'+_target.attr('id')+'_err').remove();
}
} // if(typeof(_target.attr('id')) != 'undefined'){
}
function changelang_onBlur(_target){
_target.css("border", "1px solid #ccc");
if($.trim(_target.val()) == '' || $.trim(Number(_target.val())) == '0'){
if(typeof(_target.attr('id')) != 'undefined'){
// * require field ------------
if( _target.attr('id') == 'login_lang' ){
if(!$('#'+_target.attr('id')+'_err').length){
_target.css("border", "1px solid #FF8000");
_target.after(''+ajax_showStatusMessage(-46)+'
');
}
}
} //if(typeof(_target.attr('id')) != 'undefined'){
} else { //if($.trim(_target.val()) == ''){
if(_target.is(':disabled')){
_target.css("color", "#999999");
}
} //if($.trim(_target.val()) == ''){
}
function init_user_changelang_form_event(){
if($('#changelang_form').length){
$("#changelang_form input[type!='hidden']").each(function(){
$(this).focus(function() {
changelang_onFocus($(this));
}); //$(this).focus(function() {
$(this).blur(function() {
changelang_onBlur($(this));
}); //$(this).blur(function() {
$(this).bind("keypress", changeLangHandler);
});
$("#changelang_submitBtn").bind("click", changeLangHandler);
} // if($('#changepw_form').length){
}
//--- END change password language -------------------------------------------------------------------
//--- User Account Profile -------------------------------------------------------------------
var userProfileChangeEmailHandler = function(e){
if(e != null){
if(($(e.currentTarget).is('input') || $(e.currentTarget).is('textarea')) && e.which != 13){
return;
} // if(($(e.currentTarget).is('input') || $(e.currentTarget).is('textarea')) && e.which != 13){
}
ajax_form_show_topBarMessage(0);
ajax_submitBtn_setInProgress_withLoadingBar($("#account_change_email_submitBtn"), function(){}, true);
if(!update_userProfileChangeEmail_checkNoErr()){
// ---------------- scroll top --------------------
var pos_top = 0;
if($('#user_profile_change_email_form').find('div[id*="err"]').length > 0){
if(typeof($(this).attr('id')) != 'undefined'){
var id = $('#user_profile_change_email_form').find('div[id*="err"]').first().attr('id').replace('_err', '');
//id = (id == 'project_description_eng' || id == 'project_description_chi')? 'project_description_tabs' : id;
//id = (id == 'project_profile')? 'project_name_tabs' : id;
pos_top = $('#'+id+'').offset().top;
}
}
// filter err
pos_top -= 160;
$("html, body").animate({ scrollTop:pos_top }, "fast");
// --- END ----- scroll top ----------------------
// button
ajax_submitBtn_setInProgress_withLoadingBar($("#account_change_email_submitBtn"), userProfileChangeEmailHandler, false);
} else { // if(update_userProfileChangeEmail_checkNoErr()){
$.ajax({
url: local_url+'lib/ajax/change_email/',
data: $('#user_profile_change_email_form').serialize(),
type:"POST",
dataType:'json',
beforeSend: function(msg){
ajax_show_loading_mask(true);
//ajax_submitBtn_setInProgress_withLoadingBar($("#account_change_email_submitBtn"), function(){}, true);
},
complete: function(msg){
setTimeout(function() {
ajax_show_loading_mask(false);
ajax_submitBtn_setInProgress_withLoadingBar($("#account_change_email_submitBtn"), userProfileChangeEmailHandler, false);
}, 500);
},
success: function(json_data){
//alert(json_data.status);
setTimeout(function() {
if(json_data.status == 1){
//$(location).attr('href', local_url+'account/');
userProfileChangeEmail_showMessage(2);
} else {
userProfileChangeEmail_showMessage(json_data.status);
if(json_data.status == -4003){
$(location).attr('href', local_url+'logout/');
} else if(json_data.status == -1001){
ajax_form_show_topBarMessage(1);
}
}
}, 500);
},
error:function(xhr, ajaxOptions, thrownError){
//alert(xhr.responseText);
setTimeout(function() {
userProfileChangeEmail_showMessage(-1001);
ajax_form_show_topBarMessage(1);
}, 500);
}
});
} // if(update_userProfileChangeEmail_checkNoErr()){
}
function userProfileChangeEmail_showMessage(status_number){
$("#userAccountChangeEmail_tag_wordings").hide();
$('#new_login_email').css("border", "1px solid #ccc");
$('#new_login_email_re').css("border", "1px solid #ccc");
$('#change_email_login_pw').css("border", "1px solid #ccc");
switch(status_number){
case -29:
case -4:
case -7:
$('#new_login_email').css("border", "1px solid #FF8000");
$('#new_login_email_re').css("border", "1px solid #FF8000");
var _target = null;
_target = $('#new_login_email');
if(!$('#'+_target.attr('id')+'_err').length){
_target.css("border", "1px solid #FF8000");
_target.after(''+ajax_showStatusMessage(status_number)+'
');
}
_target = $('#new_login_email_re');
if(!$('#'+_target.attr('id')+'_err').length){
_target.css("border", "1px solid #FF8000");
_target.after(''+ajax_showStatusMessage(status_number)+'
');
}
break;
case -30:
$('#change_email_login_pw').css("border", "1px solid #FF8000");
var _target = null;
_target = $('#change_email_login_pw');
if(!$('#'+_target.attr('id')+'_err').length){
_target.css("border", "1px solid #FF8000");
_target.after(''+ajax_showStatusMessage(status_number)+'
');
}
break;
case 2:
$("#user_profile_change_email_form input[type!='hidden']").each(function(){
$(this).prop('disabled', true);
});
$(".user_profile_new_email_col00").hide();
$(".user_profile_new_email_col01").hide();
$(".user_profile_new_email_col02").hide();
$(".user_profile_new_email_col03").hide();
//$("#userAccountChangeEmail_table").hide();
$("#account_change_email_submitBtn").hide();
$("#userAccountChangeEmail_tag_wordings").html('
'+ajax_showStatusMessage(status_number*((!$('#user_profile_change_email_social_form_div').length) ? 1 : 10))+'
').show();
pos_top = $('#userAccountChangeEmail_tag_wordings').offset().top;
pos_top -= 160;
$("html, body").animate({ scrollTop:pos_top }, "fast");
break;
}
}
function update_userProfileChangeEmail_checkNoErr(){
var err_no = 0;
$('#user_profile_change_email_form input').each(function(){
if(typeof($(this).attr('id')) != 'undefined'){
if($(this).is(":focus")){
$(this).blur();
} //if($(this).is(":focus")){
}
});
$('#user_profile_change_email_form input').each(function(){
update_user_change_email_onFocus($(this));
update_user_change_email_onBlur($(this));
});
err_no = $('#user_profile_change_email_form').find('div[id*="err"]').length;
var h = isMobileWesite ? 160 : 60;
h += $('#user_profile_change_email_form_div .userAccountChangeEmail_tag_wordings').height();
h += $('#user_profile_change_email_form_div .user_profile_new_email_col00').height();
h += isMobileWesite ? $('#user_profile_change_email_form_div .user_profile_new_email_col01').height() : 0;
h += isMobileWesite ? $('#user_profile_change_email_form_div .user_profile_new_email_col02').height() : 0;
h += isMobileWesite ? $('#user_profile_change_email_form_div .user_profile_new_email_col03').height() : 0;
$('#user_profile_change_email_form_div').stop().animate({"height": h+"px"}, "fast");
if(err_no == 0){
return true;
}
return false;
}
function update_userProfile_checkNoErr(){
var err_no = 0;
$("#user_profile_form input[type!='hidden'], #user_profile_form select").each(function(){
if(typeof($(this).attr('id')) != 'undefined'){
if($(this).is(":focus")){
$(this).blur();
} // if($(this).is(":focus")){
};
});
//profile_img_uploader_onFocus($('#account_profile'));
//profile_img_uploader_onBlur($('#account_profile'));
//profile_img_uploader_onHover($('#account_profile'));
$("#user_profile_form input[type!='hidden'], #user_profile_form select").each(function(){
update_user_profile_onFocus($(this));
update_user_profile_onBlur($(this));
});
update_user_profile_switchy_onChange($('#person_gender'));
err_no = $('#user_profile_form').find('div[id*="err"]').length;
err_no += $('#account_profile').parent().find('div[id*="err"]').length;
//return;
if(err_no == 0){
return true;
}
return false;
}
var userProfileHandler = function(e) {
if(e != null){
if(($(e.currentTarget).is('input') || $(e.currentTarget).is('textarea')) && e.which != 13){
return;
} // if(($(e.currentTarget).is('input') || $(e.currentTarget).is('textarea')) && e.which != 13){
}
if($('#user_profile_change_email_form_div').length){
$('#user_profile_change_email_form_div').stop().animate({"height": "0px"}, "fast");
}
ajax_form_show_topBarMessage(0);
ajax_submitBtn_setInProgress_withLoadingBar($("#account_submitBtn"), function(){}, true);
if(!update_userProfile_checkNoErr()){
// ---------------- scroll top --------------------
var pos_top = 0;
if($('#user_profile_form').find('div[id*="err"]').length > 0){
if(typeof($(this).attr('id')) != 'undefined'){
var id = $('#user_profile_form').find('div[id*="err"]').first().attr('id').replace('_err', '');
//id = (id == 'project_description_eng' || id == 'project_description_chi')? 'project_description_tabs' : id;
//id = (id == 'project_profile')? 'project_name_tabs' : id;
pos_top = $('#'+id+'').offset().top;
}
}
// filter err
pos_top -= 60; //160;
$("html, body").animate({ scrollTop:pos_top }, "fast");
// --- END ----- scroll top ----------------------
// button
ajax_submitBtn_setInProgress_withLoadingBar($("#account_submitBtn"), userProfileHandler, false);
} else { //if(!update_userProfile_checkNoErr()){
$.ajax({
url: local_url+'lib/ajax/account/',
headers: { 'X-Etickets-Key': $('#h').val() },
data: $('form').serialize(),
type:"POST",
dataType:'json',
beforeSend: function(msg){
ajax_show_loading_mask(true);
},
complete: function(msg){
setTimeout(function() {
ajax_show_loading_mask(false);
ajax_submitBtn_setInProgress_withLoadingBar($("#account_submitBtn"), userProfileHandler, false);
$("html, body").animate({ scrollTop:0 }, "fast");
}, 500);
},
success: function(json_data){
setTimeout(function() {
if(json_data.status == 1){
if(json_data.l == 1){
$(location).attr('href', local_url+'account/');
} else {
ajax_form_show_topBarMessage(3);
}
} else {
if(json_data.status == -4003){
$(location).attr('href', local_url+'logout/');
} else if(json_data.status == -1001){
ajax_form_show_topBarMessage(1);
}
}
}, 500);
},
error:function(xhr, ajaxOptions, thrownError){
setTimeout(function() {
ajax_form_show_topBarMessage(1);
}, 500);
}
});
} // if(!update_userProfile_checkNoErr()){
};
function update_user_change_email_onFocus(_target){
_target.css("border", "1px solid #05D08F");
if(typeof($(_target).attr('id')) != 'undefined'){
if($('#'+_target.attr('id')+'_err').length){
$('#'+_target.attr('id')+'_err').remove();
}
} // if(typeof(_target.attr('id')) != 'undefined'){
}
function update_user_change_email_onBlur(_target){
_target.css("border", "1px solid #ccc");
if($.trim(_target.val()) == '' || $.trim(Number(_target.val())) == '0'){
if(typeof(_target.attr('id')) != 'undefined'){
// * Required Field Error
if( _target.attr('id') == 'new_login_email' ||
_target.attr('id') == 'new_login_email_re' ||
_target.attr('id') == 'change_email_login_pw' ){
if(!$('#'+_target.attr('id')+'_err').length){
_target.css("border", "1px solid #FF8000");
_target.after(''+ajax_showStatusMessage(-46)+'
');
}
}
} //if(typeof(_target.attr('id')) != 'undefined'){
} else { //if($.trim(_target.val()) == ''){
if(_target.is(':disabled')){
_target.css("color", "#999999");
}
if(typeof(_target.attr('id')) != 'undefined'){
// * Required Field Error
if( _target.attr('id') == 'new_login_email' ||
_target.attr('id') == 'new_login_email_re' ){
if(!validateEmail($.trim(_target.val()))){
if(!$('#'+_target.attr('id')+'_err').length){
_target.css("border", "1px solid #FF8000");
_target.after(''+ajax_showStatusMessage(-44)+'
');
}
} //if(!validateURL(_target.val())){
if(($('#new_login_email').val() != $('#new_login_email_re').val()) && ($('#new_login_email').val() != '' && $('#new_login_email_re').val() != '')){
if(!$('#'+_target.attr('id')+'_err').length){
_target.css("border", "1px solid #FF8000");
_target.after(''+ajax_showStatusMessage(-29)+'
');
}
} //if(!validateURL(_target.val())){
}
} // if(typeof(_target.attr('id')) != 'undefined'){
} //if($.trim(_target.val()) == ''){
}
function update_user_profile_onFocus(_target){
_target.css("border", "1px solid #05D08F");
if(typeof($(_target).attr('id')) != 'undefined'){
if($('#'+_target.attr('id')+'_err').length){
$('#'+_target.attr('id')+'_err').remove();
}
} // if(typeof(_target.attr('id')) != 'undefined'){
if( $(_target).is('select') ) {
$(_target).css("color", "#333333");
}
}
function update_user_profile_onBlur(_target){
if( $("option:selected", _target).length){
if($("option:selected", _target).val() != 0){
$(_target).css("color", "#333333");
} else {
$(_target).css("color", "#999999");
}
}
if($.trim(_target.val()) == '' || $.trim(Number(_target.val())) == '0'){
_target.css("border", "1px solid #ccc");
if(typeof(_target.attr('id')) != 'undefined'){
//if( $(_target).is('select') ) {
//$(_target).css("color", "#999999");
//}
// * Required Field Error
if( _target.attr('id') == 'login_lang' ||
_target.attr('id') == 'new_login_email' ||
_target.attr('id') == 'new_login_email_re' ||
_target.attr('id') == 'change_email_login_pw' ||
_target.attr('id') == 'person_firstname' ||
_target.attr('id') == 'person_lastname' ||
_target.attr('id') == 'person_displayname' ||
_target.attr('id') == 'person_nationality' ||
_target.attr('id') == 'person_salutation' ||
_target.attr('id') == 'person_education' ||
_target.attr('id') == 'login_lang' ){
if(!$('#'+_target.attr('id')+'_err').length){
_target.css("border", "1px solid #FF8000");
_target.after(''+ajax_showStatusMessage(-46)+'
');
}
} else if( _target.attr('id') == 'person_birthdate_day' ||
_target.attr('id') == 'person_birthdate_month' ||
_target.attr('id') == 'person_birthdate_year'){
$('#person_birthdate_day_err').remove();
$('#person_birthdate_month_err').remove();
$('#person_birthdate_year_err').remove();
_target.css("border", "1px solid #FF8000");
_target.parent().parent().parent().parent().after(''+ajax_showStatusMessage(-46)+'
');
} else if( _target.attr('id') == 'contact_mobile_areacode' ||
_target.attr('id') == 'contact_mobile_number' ){
$('#contact_mobile_areacode_err').remove();
$('#contact_mobile_number_err').remove();
_target.css("border", "1px solid #FF8000");
_target.parent().parent().parent().parent().after(''+ajax_showStatusMessage(-46)+'
');
} else if(_target.attr('id') == 'person_gender'){
if(!$('#'+_target.attr('id')+'_err').length){
_target.parent().parent().parent().parent().after('
'+ajax_showStatusMessage(-46)+'
');
}
}
} //if(typeof(_target.attr('id')) != 'undefined'){
} else { // if($.trim(_target.val()) == ''){
_target.css("border", "1px solid #ccc");
if(_target.is(':disabled')){
_target.css("color", "#999999");
}
if( $(_target).is('select') ) {
$(_target).css("color", "#333333");
}
if(typeof(_target.attr('id')) != 'undefined'){
if(_target.attr('id') == 'occupation_office_website'){
var val = _target.val();
if (val && !val.match(/^http([s]?):\/\/.*/)) {
_target.val('http://' + val);
}
} else if( ( _target.attr('id') == 'contact_mobile_areacode' ||
_target.attr('id') == 'contact_mobile_number' ) ){
$('#contact_mobile_areacode_err').remove();
$('#contact_mobile_number_err').remove();
if( $.trim(_target.val()) != 'Areacode' && $.trim(_target.val()) != '區碼' && $.trim(_target.val()) != '区码' &&
$.trim(_target.val()) != 'Number' && $.trim(_target.val()) != '號碼' && $.trim(_target.val()) != '号码'){
var boo = false;
if(!$.isNumeric($('#contact_mobile_areacode').val()) &&
$('#contact_mobile_areacode').val() != 'Areacode' &&
$('#contact_mobile_areacode').val() != '區碼' &&
$('#contact_mobile_areacode').val() != '区码' ){
boo = true;
$('#contact_mobile_areacode').css("border", "1px solid #FF8000");
$('#contact_mobile_number').parent().parent().parent().parent().after(''+ajax_showStatusMessage(-56)+'
');
}
if(!$.isNumeric($('#contact_mobile_number').val()) &&
$('#contact_mobile_number').val() != 'Number' &&
$('#contact_mobile_number').val() != '號碼' &&
$('#contact_mobile_number').val() != '号码' ){
if(!boo){
$('#contact_mobile_number').css("border", "1px solid #FF8000");
$('#contact_mobile_number').parent().parent().parent().parent().after(''+ajax_showStatusMessage(-56)+'
');
}
}
}
} else if( ( _target.attr('id') == 'occupation_office_areacode' ||
_target.attr('id') == 'occupation_office_number' ) ){
$('#occupation_office_areacode_err').remove();
$('#occupation_office_number_err').remove();
if( $.trim(_target.val()) != 'Areacode' && $.trim(_target.val()) != '區碼' && $.trim(_target.val()) != '区码' &&
$.trim(_target.val()) != 'Number' && $.trim(_target.val()) != '號碼' && $.trim(_target.val()) != '号码'){
var boo = false;
if(!$.isNumeric($('#occupation_office_areacode').val()) &&
$('#occupation_office_areacode').val() != 'Areacode' &&
$('#occupation_office_areacode').val() != '區碼' &&
$('#occupation_office_areacode').val() != '区码' ){
boo = true;
$('#occupation_office_areacode').css("border", "1px solid #FF8000");
$('#occupation_office_number').parent().parent().parent().parent().after(''+ajax_showStatusMessage(-56)+'
');
}
if(!$.isNumeric($('#occupation_office_number').val()) &&
$('#occupation_office_number').val() != 'Number' &&
$('#occupation_office_number').val() != '號碼' &&
$('#occupation_office_number').val() != '号码' ){
if(!boo){
$('#occupation_office_number').css("border", "1px solid #FF8000");
$('#occupation_office_number').parent().parent().parent().parent().after(''+ajax_showStatusMessage(-56)+'
');
}
}
}
}
} // if(typeof(_target.attr('id')) != 'undefined'){
} //if($.trim(_target.val()) == ''){
}
function update_user_profile_switchy_onChange(_target){
if($('#'+_target.attr('id')+'_err').length){
$('#'+_target.attr('id')+'_err').remove();
}
_target.parent().next().css("color", "#999");
_target.parent().prev().css("color", "#999");
switch(Number(_target.val())){
case 1:
_target.parent().prev().css("color", "#333");
break;
default:
case 0:
if(!$('#'+_target.attr('id')+'_err').length){
_target.parent().parent().parent().parent().after('
'+ajax_showStatusMessage(-46)+'
');
}
break;
case 2:
_target.parent().next().css("color", "#333");
break;
}
}
function init_user_account_profile_event(){
if($('#user_level_img').length){
var arr;
switch(Number(global_js_params.lang)){
default:
case 1:
arr = ['Verified User', 'Green User', 'Gold User', 'Platinum User', 'Premium User', 'Black User'];
break;
case 2:
arr = ['已驗證用戶', '新進用戶', '黃金用戶', '白金用戶', '榮譽用戶', '黑冠用戶'];
break;
case 3:
arr = ['已验证用户', '新进用户', '黄金用户', '白金用户', '荣誉用户', '黑冠用户'];
break;
}
$('#user_level_img').tooltipster({
content: $(''),
minWidth: ((Number(global_js_params.lang) != 1) ? 160 : 210),
maxWidth: ((Number(global_js_params.lang) != 1) ? 160 : 210),
speed: 200,
animation: 'grow',
position: 'right',
theme: 'tooltipster-shadow'
});
}
if($('#user_profile_form').length){
// ------ Uploader -----
init_img_uploader($('#account_profile'), 1, true);
if($('#person_gender').length){
$('#person_gender').switchy({ css:'switchy-container-gender',
triggerByOption: true,
color:'#0FA9D5',
secondaryColor:'#EEEEEE'});
switch(Number($('#person_gender').val())){
default:
case 0:
$('#person_gender').parent().prev().css("color", "#999");
$('#person_gender').parent().next().css("color", "#999");
break;
case 1:
$('#person_gender').parent().next().css("color", "#999");
break;
case 2:
$('#person_gender').parent().prev().css("color", "#999");
break;
}
$('#person_gender').on('change', function(){
update_user_profile_switchy_onChange($(this));
});
}
if($('#user_profile_form').length && $('#user_profile_change_email_form').length){
$("#user_profile_change_email_form input[type!='hidden']").each(function(){
$(this).focus(function() {
update_user_change_email_onFocus($(this));
}); //$(this).focus(function() {
$(this).blur(function() {
update_user_change_email_onBlur($(this));
}); //$(this).focus(function() {
});
$("#user_profile_form input[type!='hidden'], #user_profile_form select").each(function(){
// ---- init
if( $("option:selected", this).length){
if($("option:selected", this).val() != 0){
$(this).css("color", "#333333");
} else {
$(this).css("color", "#999999");
}
}
// ---- init ----
$(this).focus(function() {
update_user_profile_onFocus($(this));
}); //$(this).focus(function() {
$(this).blur(function() {
update_user_profile_onBlur($(this));
}); //$(this).blur(function() {
}) // $('#user_profile_form input, #user_profile_form select').each(function(){
} //if($('#user_profile_form').length){
$(".process > span").each(function() {
$(this)
.data("origWidth", $(this).width())
.width(0)
.animate({
width: $(this).data("origWidth")
}, 500);
});
// ---- email ----
$("#user_profile_change_email_form input[type!='hidden']").each(function(){
$(this).bind("keypress", userProfileChangeEmailHandler);
});
$("#account_change_email_submitBtn").bind("click", userProfileChangeEmailHandler);
$('#change_email_submitBtn').click(function(e){
if($('#user_profile_change_email_form_div').height() == 0){
var h = isMobileWesite ? 160 : 60;
h += $('#user_profile_change_email_form_div .userAccountChangeEmail_tag_wordings').height();
h += $('#user_profile_change_email_form_div .user_profile_new_email_col00').height();
h += isMobileWesite ? $('#user_profile_change_email_form_div .user_profile_new_email_col01').height() : 0;
h += isMobileWesite ? $('#user_profile_change_email_form_div .user_profile_new_email_col02').height() : 0;
h += isMobileWesite ? $('#user_profile_change_email_form_div .user_profile_new_email_col03').height() : 0;
$('#user_profile_change_email_form_div').stop().animate({"height": h+"px"}, "fast");
} else {
$('#user_profile_change_email_form_div').stop().animate({"height": "0px"}, "fast");
}
});
// -- END -- email ----
$("#user_profile_form input[type!='hidden']").each(function(){
$(this).bind("keypress", userProfileHandler);
});
$("#account_submitBtn").bind("click", userProfileHandler);
} // if($('#user_profile_form').length){
if($('#user_my_eticket').length){
if($('.download_mobile_eticket').length){
$('.download_mobile_eticket').each(function(){
$(this).click(function(e){
ajax_show_mobile_etickets($(this).attr('id'));
});
}); //$('.download_mobile_eticket').each(function(){
} // if($('.download_mobile_eticket').length){
/*
// REFUND Button
if($('.cancelRefundBtn').length){
$('.cancelRefundBtn').click(function(e) {
$(this).closest('form').attr('action', '../refund/');
$(this).unbind();
$(this).removeAttr('href');
$(this).closest('form').submit();
});
}
*/
// CANCEL Button
if($('.cancelBtn').length){
$('.cancelBtn').click(function(e) {
//alert($(this).parent().parent().find('form').attr('action'));
//$(this).parent().parent().find('input').each(function(){
// if($(this).attr('id') == 'ouid'){
// alert($(this).val());
// }
//});
//alert($(this).parent().parent().find('form').attr('id'))
//$(this).unbind();
//$(this).removeAttr('href');
//$(this).parent().parent().find('form').submit();
var myForm = $(this).closest('form');
if($( "#dialog" ).length){
var t = '';
var confirmBtn_t = '';
var cancelBtn_t = '';
switch(Number(global_js_params.lang)){
default:
case 1:
t = 'Order Cancellation';
confirmBtn_t = 'Confirm';
cancelBtn_t = 'Cancel';
$( "#dialog" ).html('Are you sure to confirm and cancel this order ?
All cancellation processes are irreversible !');
break;
case 2:
t = '訂單取消';
confirmBtn_t = '確定';
cancelBtn_t = '取消';
$( "#dialog" ).html('您是否確定取消此訂單?
所有訂單一經取消,一律不回。');
break;
case 3:
t = '订单取消';
confirmBtn_t = '确定';
cancelBtn_t = '取消';
$( "#dialog" ).html('您是否确定取消此订单?
所有订单一经取消,一律不回。');
break;
}
$( "#dialog" ).dialog({
dialogClass:"ui-datepicker-dialog",
open: function(){
$('.ui-widget-overlay').hide().fadeIn();
$('.ui-widget-overlay').bind('click', function() {
$('#dialog').dialog('close');
})
},
show: {
effect: "clip",
duration: 200
},
hide: {
effect: "clip",
duration: 200
},
resizable: false,
autoOpen: true,
draggable: false,
width: 'auto',
modal: true,
closeOnEscape: false,
title: t,
buttons: [
{
text: confirmBtn_t,
click: function() {
$.ajax({
url: local_url+'lib/ajax/ordercancellation/',
headers: { 'X-Etickets-Key': $('#hrecancel').val() },
data: myForm.serialize(),
type:"POST",
dataType:'json',
beforeSend: function(msg){
ajax_show_loading_mask(true);
},
complete: function(msg){
setTimeout(function() {
ajax_show_loading_mask(false);
}, 500);
},
success: function(json_data){
//alert(json_data.status);
//return;
setTimeout(function() {
if(json_data.status == 1){
window.location.reload();
} else {
if(json_data.status == -4003){
$(location).attr('href', local_url+'logout/');
} else if(json_data.status == -1001){
ajax_form_show_topBarMessage(1);
}
}
}, 500);
},
error:function(xhr, ajaxOptions, thrownError){
setTimeout(function() {
ajax_form_show_topBarMessage(1);
}, 500);
}
});
$( this ).dialog( "close" );
}
},
{
text: cancelBtn_t,
click: function() {
$( this ).dialog( "close" );
}
}
]
});
} // if($( "#dialog" ).length){
}); // $('.cancelBtn').click(function(e) {
} // if($('.cancelBtn').length){
} // if($('#user_my_eticket').length){
if($('#auto_show_tickets').length){
if($.trim($('#auto_show_tickets').val()) != ''){
setTimeout(function() {
var pos_top = ($('#'+$('#auto_show_tickets').val()).length) ? $('#'+$('#auto_show_tickets').val()).offset().top : $('#auto_show_tickets').offset().top;
pos_top -= ($('#'+$('#auto_show_tickets').val()).length) ? ((isMobileWesite) ? 380 : 160) : 0;
$("html, body").animate({ scrollTop:pos_top }, "fast");
//alert($('#auto_show_tickets').val());
ajax_show_mobile_etickets($('#auto_show_tickets').val());
}, 100);
}
}
}
//--- END User Account Profile -------------------------------------------------------------------