1/******************************************************************************/ 2/******************************************************************************/ 3 4function NLThemeContactForm(id) 5{ 6 this.id=id; 7}; 8 9/******************************************************************************/ 10 11NLThemeContactForm.prototype.init=function() 12{ 13 var self=this; 14 jQuery('#contact_form_'+this.id).submit(function() 15 { 16 self.submit(); 17 return(false); 18 }); 19}; 20 21/******************************************************************************/ 22 23NLThemeContactForm.prototype.submit=function() 24{ 25 this.blockForm('block'); 26 var data=jQuery('#contact_form_'+this.id).serialize()+'&id='+this.id; 27 jQuery.ajax(themeOption.config.ajax_url,{data:data,type:'POST',success:this.submitResponse,dataType:'json',contextObject:this}); 28}; 29 30/******************************************************************************/ 31 32NLThemeContactForm.prototype.submitResponse=function(response) 33{ 34 this.contextObject.blockForm('unblock'); 35 36 jQuery('#contact_form_'+this.contextObject.id).find(':input').qtip('destroy'); 37 38 var tPosition= 39 { 40 'contact_form_name' : {'my':'bottom center','at':'top center'}, 41 'contact_form_mail' : {'my':'bottom center','at':'top center'}, 42 'contact_form_submit' : {'my':'right center','at':'left center'}, 43 'contact_form_message' : {'my':'top center','at':'bottom center'} 44 }; 45 46 if(typeof(response.info)!=='undefined') 47 { 48 if(response.info.length) 49 { 50 for(var key in response.info) 51 { 52 var id=response.info[key].fieldId; 53 var nId=id.replace('_'+this.contextObject.id,''); 54 55 jQuery('#'+response.info[key].fieldId).parents('li:first').qtip( 56 { 57 style: { classes:(parseInt(response.error)===1 ? 'qtip-error' : 'qtip-success')}, 58 content: { text:response.info[key].message }, 59 position: { my:tPosition[nId]['my'],at:tPosition[nId]['at'] } 60 }).qtip('show'); 61 } 62 } 63 } 64 65 if(parseInt(response.error)===0) 66 { 67 if(parseInt(response.reset)===1) 68 { 69 var cId=this.contextObject.id; 70 71 jQuery('#contact_form_'+this.contextObject.id).find('input[type="text"],textarea').val('').blur(); 72 window.setTimeout(function() { jQuery('#contact_form_submit_'+cId).parents('.block:first').qtip('destroy'); },2000); 73 } 74 } 75}; 76 77/******************************************************************************/ 78 79NLThemeContactForm.prototype.blockForm=function(action) 80{ 81 if(action==='block') jQuery('#contact_form_'+this.id).find('.block').block({message:false,overlayCSS:{opacity:'0.3'}}); 82 else jQuery('#contact_form_'+this.id).find('.block').unblock(); 83}; 84 85/******************************************************************************/ 86/******************************************************************************/
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.