1function submit_comment() 2{ 3 var comment = $('#comment').text(); 4 var rating = $('input[name=rating]:checked').val(); 5 var url = $('#submit_comment').data('url'); 6 var is_guest = $('#submit_comment').data('guest') == 1; 7 // èç½æ¬ä½ï¼ç人çä¸å°ã弿°¸é æ¯ç©ºå串ï¼å¾ç«¯çå°éç©ºå°±ç¶ bot 8 var website = $('.comment-area input[name="website"]').val() || ''; 9 10 if(rating==undefined) 11 rating = 0; 12 13 if (comment.trim().length === 0) 14 { 15 alert(t('Please enter your comment')); 16 return; 17 } 18 19 if(is_guest) 20 { 21 var guest_name = $('#guest_name').val().trim(); 22 var guest_email = $('#guest_email').val().trim(); 23 if(!guest_name) 24 { 25 alert(t('Your name is required')); 26 return; 27 } 28 if(!guest_email) 29 { 30 alert(t('Please enter your email')); 31 return; 32 } 33 var site_key = $('#submit_comment').data('sitekey'); 34 $('#submit_comment').prop('disabled', true); 35 aten_recaptcha_execute(site_key, 'comment', function(captcha) 36 { 37 $.post(url, 38 { 39 comment: comment, 40 rating: rating, 41 guest_name: guest_name, 42 guest_email: guest_email, 43 captcha: captcha, 44 website: website, 45 }, function(res) 46 { 47 $('#submit_comment').prop('disabled', false); 48 _comment_handle_response(res); 49 }); 50 }); 51 return; 52 } 53 54 // æå¡è·¯å¾ä¸æ¨£èµ° reCAPTCHAï¼éå»éè£¡ç´æ¥ POST ä¸å¸¶ captchaï¼bot 註åä¸å帳èå°±è½ç¡éçè¨ 55 var site_key = $('#submit_comment').data('sitekey'); 56 $('#submit_comment').prop('disabled', true); 57 aten_recaptcha_execute(site_key, 'comment', function(captcha) 58 { 59 $.post(url, 60 { 61 comment: comment, 62 rating: rating, 63 captcha: captcha, 64 website: website, 65 }, function(res) 66 { 67 $('#submit_comment').prop('disabled', false); 68 _comment_handle_response(res); 69 }); 70 }); 71} 72 73function _comment_handle_response(res) 74{ 75 if(res=='ok') 76 { 77 swal({ 78 title: t('Comment section'), 79 text: t('Comment submitted! It will appear publicly once it has been approved.'), 80 type: "success", 81 }).then(function(result) { 82 location.reload(); 83 }); 84 } 85 else if(res=='no_login') 86 { 87 swal(t('Please log in first')); 88 } 89 else if(res=='err:captcha') 90 { 91 swal(t('CAPTCHA verification failed. Please try again later.')); 92 } 93 else if(res=='err:rate_limit') 94 { 95 swal(t('You are posting comments too often. Please try again later.')); 96 } 97 else if(res=='err:empty_name') 98 { 99 swal(t('Your name is required')); 100 } 101 else if(res=='err:invalid_email') 102 { 103 swal(t('Please enter an email address in the correct format')); 104 } 105 else 106 { 107 swal(t('Server error')); 108 } 109} 110 111var comment_page_idx = 2; 112function get_comment_list() 113{ 114 var url = $('#comment-list').data('url'); 115 if(url===undefined || url.trim().length===0) 116 return; 117 url += comment_page_idx; 118 119 $.get(url, function(res) 120 { 121 if(res.left===0) 122 { 123 $('#comment_load_more').hide(); 124 } 125 else 126 { 127 $('#comment-list').append(res.html); 128 var a_id = $('#comment_page_' + comment_page_idx); 129 // ææ³è¦æç¦é»ç§»å°éå a_id ä¸é¢ 130 if (a_id.length) { 131 $('html, body').animate({ 132 scrollTop: a_id.offset().top 133 }, 500); 134 } 135 comment_page_idx++; 136 137 } 138 }, 'json'); 139}
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.