1/** 2 * 2009 - 2017 WAD Solutions 3 * 4 * MODULE Google Translate 5 * 6 * @author WAD Solutions <[email protected]> 7 * @copyright Copyright (c) permanent, WAD Solutions 8 * @license PrestaShop Addons license limitation 9 * 10 * NOTICE OF LICENSE 11 * 12 * Don't use this module on several shops. The license provided by PrestaShop Addons 13 * for all its modules is valid only once for a single shop. 14 * If you want to use it on another shop, please buy another copy. 15 */ 16 function AllActions(obj,all){ 17 $('#list2translate').html('<div style="margin:0 auto;position:relative;width:240px;margin-top:50px;margin-bottom:50px;"><div style="text-align:center;margin-bottom:30px;color:#91a719;font-size:24px;font-weight:bold;">ÐаÑеждане...</div><div id="fountainG"><div id="fountainG_1" class="fountainG"></div><div id="fountainG_2" class="fountainG"></div><div id="fountainG_3" class="fountainG"></div><div id="fountainG_4" class="fountainG"></div><div id="fountainG_5" class="fountainG"></div><div id="fountainG_6" class="fountainG"></div><div id="fountainG_7" class="fountainG"></div><div id="fountainG_8" class="fountainG"></div></div></div>'); 18 $('#mass_action').remove(); 19 $.ajax({ 20 type: "POST", 21 url: window.location.href, 22 data: {object:$(obj).val(),object_tp:$(obj).find("[value='" + $(obj).val() + "']").attr('data-object-tp'),show_all:all}, 23 success: function(data){ 24 $('#list2translate').html('<label>ТÑÑÑене в ÑаблиÑаÑа:</label><input type="text" placeholder="ТÑÑÑене..." id="type_search" style="width:400px;display: inline-block;margin-left:20px;margin-bottom:20px;" /> <span style="margin-left:20px;">Ðокажи абÑолÑÑно вÑиÑки: <input type="checkbox" id="show_all"></span><span style="margin-left:20px;">СкÑий ÑÑÑно пÑеведениÑе: <input type="checkbox" id="by_hand"></span><div style="display:inline;margin-left:40px;" id="mass_action"><a style="padding:7px 15px;margin:0;" class="sync_data" data-length="'+full_length+'" href="#">ÐÑевод на вÑиÑки в ÑаблиÑаÑа</a></div><br />'+data); 25 $('#by_hand').click(function(){ 26 if($(this).is(':checked')){ 27 $('table.list_of_objects tr').show(); 28 $('table.list_of_objects tbody').find('tr').each(function(){ 29 var tr=$(this); 30 var need2show=0; 31 $(tr).find('td').each(function(){ 32 if($(this).hasClass('translation') && $(this).html() == ''){ 33 need2show=1; 34 } 35 }); 36 if(!need2show){ 37 $(tr).hide(); 38 }else{ 39 $(tr).show(); 40 } 41 42 }); 43 }else{ 44 $('table.list_of_objects tr').show(); 45 } 46 }); 47 $('#show_all').click(function(){ 48 if($(this).is(':checked')){ 49 AllActions($('#to_translate'),1); 50 }else{ 51 AllActions($('#to_translate'),0); 52 } 53 }); 54 $('#type_search').keyup(function(e){ 55 e.stopPropagation(); 56 e.stopImmediatePropagation(); 57 var search=$(this).val(); 58 59 if(!search){ 60 $('table.list_of_objects tr').show(); 61 return false; 62 } 63 64 $('table.list_of_objects tbody').find('tr').each(function(){ 65 var tr=$(this); 66 var need2show=0; 67 $(tr).find('td').each(function(){ 68 var toCheck=$(this).html(); 69 re = new RegExp(search, 'gi'); 70 if(toCheck.match(re)){ 71 need2show=1; 72 } 73 }); 74 if(!need2show){ 75 $(tr).hide(); 76 }else{ 77 $(tr).show(); 78 } 79 80 }); 81 }); 82 var full_length=0; 83 $('a.sync_single_data').each(function(){ 84 full_length += $(this).attr('data-length')*1; 85 }); 86 $('a.sync_data').attr('data-length',full_length); 87 $('a.sync_single_data').click(function(e){ 88 e.preventDefault(); 89 if(confirm('Ðа пÑÑ Ñи да изпÑаÑиÑе '+$(this).attr('data-length')+' Ñимвола кÑм Google за пÑевод. СигÑÑен ли Ñи, Ñе иÑÐºÐ°Ñ Ð´Ð° го напÑавиÑ?')){ 90 var el=$(this); 91 $.ajax({ 92 type: "POST", 93 url: window.location.href, 94 data: {translate_id:$(el).attr('data-id'),to_translate:$('#to_translate').val(),object_tp:$('#to_translate').find("[value='" + $('#to_translate').val() + "']").attr('data-object-tp')}, 95 success: function(data){ 96 $($(el).parent().prev()).html('<i class="icon-check"></i>'); 97 } 98 }); 99 } 100 }); 101 $('a.sync_data').click(function(e){ 102 e.preventDefault(); 103 if(confirm('Ðа пÑÑ Ñи да изпÑаÑиÑе '+$(this).attr('data-length')+' Ñимвола кÑм Google за пÑевод. СигÑÑен ли Ñи, Ñе иÑÐºÐ°Ñ Ð´Ð° го напÑавиÑ?')){ 104 $('div.popup_sync,div.overflow').show(); 105 var all_todo=$('a.sync_single_data').length; 106 $('#show_all_finished').html(all_todo); 107 var done=0; 108 $('a.sync_single_data').each(function(){ 109 var el=$(this); 110 setTimeout(function(){ 111 $.ajax({ 112 type: "POST", 113 url: window.location.href, 114 data: {translate_id:$(el).attr('data-id'),to_translate:$('#to_translate').val(),object_tp:$('#to_translate').find("[value='" + $('#to_translate').val() + "']").attr('data-object-tp')}, 115 success: function(data){ 116 $($(el).parent().prev()).html('<i class="icon-check"></i>'); 117 done++; 118 $('#show_done').html(done);
119 $('#number_percent').html(Math.round((done*100)/all_todo)+'%'); 120 $('div.loader_bar').css('width',Math.round((done*100)/all_todo)+'%'); 121 } 122 }); 123 }, 1000); 124 }); 125 126 } 127 }); 128 } 129 }); 130 } 131$(document).ready(function(){ 132 133 $('#to_translate').change(function(){ 134 AllActions($(this),0); 135 }); 136});
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.