1 2// ÐеÑевод Ñлова на заданнÑй ÑÑÐ¾Ð²ÐµÐ½Ñ 3function hitWord(idata, async){ 4 5 let ret = true; 6 7 let response = $.ajax({type: 'POST', dataType: 'json', url: '/edu/HitWord', data: idata, async: async}); //async: true 8 9 response.done(function( data ) { 10 if(data.success == 'no'){ 11 alert(data.error); 12 //openAlert(data.error); 13 ret = false; 14 } 15 }); 16 17 return ret; 18} 19 20 21// 22// addItemToEdu - не ÑолÑко добавлÑÐµÑ Ð¿ÑÐ¸Ð¼ÐµÑ Ð² ÑпÑажнениÑ, но и ÑдалÑÐµÑ ÐµÐ³Ð¾ Ð¾Ñ ÑÑда. ÐоÑÑÐ¾Ð¼Ñ Ð½Ð°Ð·Ð²Ð°Ð½Ð¸Ðµ ÑÑнкÑии не ÑовÑем коÑÑекÑно 23// 24function addItemToEdu(idata){ 25 26 if (isGuest) { 27 alert('ÐобавлÑÑÑ Ñлова в ÑпÑÐ°Ð¶Ð½ÐµÐ½Ð¸Ñ Ð¼Ð¾Ð³ÑÑ ÑолÑко заÑегиÑÑÑиÑованнÑе полÑзоваÑели. ÐодÑобнее пÑо ÑпÑÐ°Ð¶Ð½ÐµÐ½Ð¸Ñ ÑиÑайÑе в Ñазделе "УпÑажнениÑ".'); 28 return; 29 } 30 31 // sentence_id == 0 Ð¼Ð¾Ð¶ÐµÑ Ð±ÑÑÑ ÑолÑко в ÑлÑÑае клика по болÑÑой иконке в веÑжней ÑаÑÑи ÑкÑана. 32 let sit = idata.sentence_id == 0 ? '0' : ''; 33 // еÑли Ñ Ð¿ÑимеÑа ÑÑаÑÑÑ "добавлен", Ñо ÑдалÑем его 34 if($("#pi_"+idata.sentence_id).attr('src') == '/images/svg/ai'+sit+'_v3.svg'){ 35 delSentenceFromEdu(idata); 36 return false; 37 } 38 39 let sentence_lesson = treatItem(idata, 'edu/AddItemToEdu',false); 40 41 if(sentence_lesson.success == 'no'){ 42 if (sentence_lesson.reedu === undefined || sentence_lesson.reedu === false) { 43 alert(sentence_lesson.error); 44 return false; 45 }; 46 47 if(!confirm(sentence_lesson.error)){ 48 return false; 49 } 50 51 let reedu_word = treatItem(idata, 'edu/ReEduWord', false); 52 if (reedu_word.success == 'no') { 53 return false; 54 }; 55 56 } 57 58 $("#pi_"+idata.sentence_id).attr('src','/images/svg/ai'+sit+'_v3.svg'); 59} 60 61function setWordEduStatus(word, word_id){ 62 63 let is_word_in_edu; 64 65 if(word_id == 0){ 66 is_word_in_edu = $.ajax({type: 'POST', dataType: 'json', url: '/edu/IsWordInEdu', data: {word:word}, async: true}); 67 } else{ 68 is_word_in_edu = $.ajax({type: 'POST', dataType: 'json', url: '/edu/IsWordInEduById', data: {word_id:word_id}, async: true}); 69 } 70 71 is_word_in_edu.done(function( data ) { 72 if(data.word_in == 'yes'){ 73 $("#pi_0").attr('src','/images/svg/ai0_v3.svg'); 74 for (key in data.word_ids) { 75 $("#pi_"+data.word_ids[key]).attr('src','/images/svg/ai_v3.svg'); 76 } 77 } 78 }); 79 80} 81 82function delSentenceFromEdu(idata){ 83 if (idata.sentence_id == 0) { 84 return; 85 } 86 87 let del_result = treatItem(idata, 'edu/DelSentenceFromEdu',false); 88 89 if(del_result.success == 'yes'){ 90 $("#pi_"+idata.sentence_id).attr('src','/images/svg/pi_v3.svg'); 91 } 92 93 if(del_result.success == 'no'){ 94 if(confirm(del_result.error)){ 95 96 del_result = treatItem(idata, 'edu/DelWordFromEdu',false); 97 if(del_result.success == 'yes'){ 98 $("#pi_"+idata.sentence_id).attr('src','/images/svg/pi_v3.svg'); 99 $("#pi_0").attr('src','/images/svg/pi0_v3.svg'); 100 } 101 102 return false; 103 } 104 } 105 106} 107 108function delWordFromEdu(word_id){ 109 let result = false; 110 let response = $.ajax({type: 'POST', dataType:'json', url:'/edu/DelWordFromEdu', data: {word_id:word_id}, async: false}); 111 112 response.done(function( data ) { 113 if(data.success == 'yes'){ 114 result = true; 115 } 116 117 }); 118 119 return result; 120} 121 122 123/* 124function openAlert(text){ 125 $("#alert p").html(text); 126 $("#alert").dialog( "open" ); 127 //event.preventDefault(); 128} 129*/ 130 131 132
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.