1var DictionaryHelper = new function () { 2 3 this.Add = function (id) { 4 if (!authorized) { 5 $("#modalLogin").modal(); 6 return false; 7 } 8 CommonHelper.ShowLoader(); 9 $.ajax({ 10 method: "get", 11 url: "/" + languageUI + '/Dictionary/AddToMyDictionary?id=' + id 12 }).done(function (output) { 13 if (output) { 14 $("#btn-" + id).html("<i class='fa fa-remove'></i> УдалиÑÑ Ð¸Ð· ÑловаÑÑ"); 15 $("#btn-" + id).attr("onclick", "DictionaryHelper.Remove('" + id + "')"); 16 CommonHelper.HideLoader(); 17 toastr["success"]("Слово (ÑеÑмин) добавлен в ÐÐ°Ñ Ð»Ð¸ÑнÑй ÑловаÑÑ. ÐожеÑе пÑоÑмоÑÑеÑÑ Ð² лиÑном кабинеÑе "); 18 } else { 19 CommonHelper.HideLoader(); 20 $("#btn-" + id).html("Ðе ÑдалоÑÑ ÑÐ¾Ñ ÑаниÑÑ."); 21 } 22 }); 23 } 24 25 this.Remove = function(id) 26 { 27 if (!authorized) { 28 $("#modalLogin").modal(); 29 return false; 30 } 31 CommonHelper.ShowLoader(); 32 $.ajax({
33 method: "get", 34 url: "/" + languageUI + '/Dictionary/RemoveFromMyDictionary?id=' + id 35 }).done(function (output) { 36 if (output) { 37 $("#btn-" + id).html("<i class='fa fa-plus'></i> ÐобавиÑÑ"); 38 $("#btn-" + id).attr("onclick", "DictionaryHelper.Add('" + id + "')"); 39 CommonHelper.HideLoader(); 40 toastr["success"]("Слово (ÑеÑмин) Ñдален из ÐаÑего лиÑного ÑловаÑÑ. "); 41 window.location.reload(true); 42 } else { 43 CommonHelper.HideLoader(); 44 toastr["error"]("Слово (ÑеÑмин) не ÑдалоÑÑ ÑдалиÑÑ Ð¸Ð· ÐаÑего лиÑного ÑловаÑÑ. ÐопÑобÑйÑе позднее. "); 45 } 46 }); 47 } 48 49 this.ShowDescription = function (id) { 50 51 var isSubsribed = new Boolean(false); 52 53 $.ajax({ // ÐÑовеÑка полÑзоваÑÐµÐ»Ñ Ð½Ð° ÑаÑÐ¸Ñ 54 url: "/" + languageUI + "/Dictionary/IsSubscribedUser", 55 method: "post" 56 }).done(function (result) { 57 58 isSubsribed = result; // РезÑлÑÑÐ°Ñ Ð¿ÑовеÑки 59 60 $(".dic-item").find('.dic-title').removeClass("dic-item-active"); 61 $("#" + id).find('.dic-title').addClass("dic-item-active"); 62 $(".description-container").html(""); 63 64 $.ajax({ // ÐолÑÑаем опиÑание Ñлова 65 url: "/" + languageUI + "/Dictionary/GetDescription?id=" + id, 66 method: "post" 67 }).done(function (output) { 68 if (isSubsribed === false) { // ÐакÑÑÑие доÑÑÑпа к ÑодеÑÐ¶Ð¸Ð¼Ð¾Ð¼Ñ 69 if (languageUI == "ru") { 70 $('.description-container').html("<div class='alert alert-warning'>У Ð²Ð°Ñ Ð½ÐµÑ Ð´Ð¾ÑÑÑпа. ÐÐ»Ñ Ð¿ÑоÑмоÑÑа данного маÑеÑиала вам нÑжно пÑиобÑеÑÑи полнÑй доÑÑÑп к ÑодеÑÐ¶Ð¸Ð¼Ð¾Ð¼Ñ ÐÐ°Ð·Ñ Ð´Ð°Ð½Ð½ÑÑ \"Zan\" в Ñазделе <a href='https://zan.kz/" + languageUI + "/static/tariff'>ТаÑиÑ</a></div>"); 71 } else if (languageUI == "kk") { 72 $('.description-container').html("<div class='alert alert-warning'>СÑзде ÑÒ±ÒÑÐ°Ñ Ð¶Ð¾Ò. Ðұл маÑеÑÐ¸Ð°Ð»Ð´Ñ ÒаÑÐ°Ñ Ò¯ÑÑн <a href='https://zan.kz/" + languageUI + "/static/tariff'>ТаÑиÑ</a> бөлÑмÑнде \"Zan\" деÑекÑÐµÑ Ð±Ð°Ð·Ð°ÑÑна деген ÑолÑÒ ÒолжеÑÑмдÑлÑкÑÑ ÑаÑÑп алÑÑÒ£Ñз кеÑек.</div>"); 73 } 74 } else { 75 $(".description-container").html(output); 76 } 77 }); 78 }); 79 } 80 81 this.AutoHeight = function () { 82 var windowH = $(window).height(); 83 $(".words-container").css('height', (windowH - 150) + 'px'); 84 $(".words-container-my").css('height', (windowH - 150) + 'px'); 85 $(".filter-container").css('height', (windowH - 130) + 'px'); 86 $("#page-wrapper").css('min-height', '200px'); 87 } 88 89 this.SearchSubmit = function (char, page) { 90 if ($(".form-search-dic").length < 1) 91 return false; 92 93 CommonHelper.ShowLoader(); 94 $('.search-dic-char').val(char); 95 96 if (page) { 97 $('.current-page').val(page); 98 var url = window.location.href; 99 url = url.split('#')[0]; 100 window.history.replaceState({}, document.title, url); 101 } 102 103 DictionaryHelper.GetResult(char); 104 DictionaryHelper.GetFilter(char); 105 return false; 106 } 107 108 this.GetResult = function (char) { 109 $('.search-dic-char').val(char); 110 var formData = $(".form-search-dic").serialize(); 111 $.ajax({
112 url: '/' + languageUI + '/Dictionary/Index', 113 method: 'post', 114 data: formData 115 }).done(function (output) { 116 $(".words-container").html(output); 117 CommonHelper.HideLoader(); 118 $('.pagination').pagination({ 119 prevText: '<', 120 nextText: '>', 121 currentPage: $(".current-page").val(), 122 items: $(".total").val(), 123 itemsOnPage: 15, 124 cssStyle: 'light-theme', 125 onPageClick: function (pageNumber, event) { 126 $(".current-page").val(pageNumber); 127 DictionaryHelper.SearchSubmit(char); 128 } 129 }); 130 131 $('.dic-item').first().find('.dic-title').addClass("dic-item-active"); 132 var id = $('.dic-item').first().attr('id'); 133 //console.log(id); 134 if (id != null) { 135 DictionaryHelper.ShowDescription(id); 136 } 137 }); 138 } 139 140 this.GetFilter = function (char) { 141 $('.search-dic-char').val(char); 142 var formData = $(".form-search-dic").serialize(); 143 $.ajax({
144 url: '/' + languageUI + '/Dictionary/SearchFilter', 145 method: 'post', 146 data: formData 147 }).done(function (filter) { 148 DocumentHelper.FilterInsert(filter.dicTypes, 'filter-dic-types', 'dic-types', ''); 149 CommonHelper.HideLoader(); 150 151 if (filter.isByTheme != 7 && filter.isByTheme != 8 && filter.isByTheme != 9) { 152 $('.i-checks').iCheck({ 153 checkboxClass: 'icheckbox_square-green', 154 radioClass: 'iradio_square-green', 155 }); 156 //Click filter checkboxes 157 CommonHelper.CheckOnSelect('check-dic-types', 'selectedDicTypes', 'unselectedDicTypes', true, true, DictionaryHelper.SearchSubmit, DictionaryHelper.GetFilter); 158 } 159 }); 160 } 161 162 this.FilterInsert = function (items, containerClassName, itemClassName, unSelectedItems, IsByTheme) { 163 164 var unArr = (unSelectedItems != null && unSelectedItems != "") ? unSelectedItems.split(',') : []; 165 var isRewrite = $(".isRewriteFilterPanel").val(); 166 if (isRewrite === "true") { 167 $("." + containerClassName).html(""); 168 } 169 $.each(items, function (index, item) { 170 var $countItem = $("." + containerClassName).find(".check-" + itemClassName + "-count-" + item.code); 171 if ($countItem.length > 0) { 172 $countItem.val(item.count); 173 } 174 else { //checked 175 var _checked = "checked"; 176 var ischecked = $.grep(unArr, function (row) { return row == item.code; }); 177 if (unArr.length > 0 && ischecked.length > 0) 178 _checked = ""; 179 180 if (IsByTheme == 3 || IsByTheme == 4 || IsByTheme == 5) 181 $("." + containerClassName).append('<label> ' + item.nameRu + ' (<span class="check-' + itemClassName + '-count-' + item.code + '">' + item.count + '</span>)</label><br />'); 182 } 183 }); 184 } 185 186 this.CheckOnSelect = function (checkObject, selectedObject, unselectedObject, isSubmitForm, markedWhenUnselected) { 187 $("." + checkObject).on('ifChecked', function (event) { 188 189 var unselectedVal = ""; 190 var dic_types = $('.filter-dic-types').find("input.check-dic-types:not(:checked)");//.is(":not(:checked)"); 191 $.map(dic_types, function (row, indx) { 192 unselectedVal += $(row).val(); 193 if (indx != dic_types.length - 1) 194 unselectedVal += ","; 195 }); 196 197 $('.' + selectedObject).val($('.' + selectedObject).val() + event.target.value + ','); 198 $("." + unselectedObject).val(unselectedVal); 199 200 if (isSubmitForm) 201 $(".form-search").submit(); 202 }); 203 204 $("." + checkObject).on('ifUnchecked', function (event) { 205 var unselectedVal = ""; 206 var dic_types = $('.filter-dic-types').find("input.check-dic-types:not(:checked)");//.is(":not(:checked)"); 207 $.map(dic_types, function (row, indx) { 208 unselectedVal += $(row).val(); 209 if (indx != dic_types.length - 1) 210 unselectedVal += ","; 211 }); 212 213 $("." + unselectedObject).val(unselectedVal); 214 var str = $("." + selectedObject).val(); 215 $("." + selectedObject).val(str.replace(event.target.value + ',', '')); 216 217 if (isSubmitForm) 218 $(".form-search").submit(); 219 }); 220 221 } 222 223 var lang = $('.dictionary-lang').val(); 224 var isbytheme = $('.dictionary-isbytheme').val(); 225 226 this.createTree = function (alfa) { 227 $('.dic-tree-helper').empty(); 228 $('.dic-tree-helper').append('<div class="dictionary-tree aciTree aciTree0" style="opacity:1;"></div>'); 229 var _height = $(window).height(); 230 _height = _height - 140; 231 $('.dictionary-tree').css({ height: _height }); 232 var searchText = alfa === "" ? $('.search-text-').val() : alfa; 233 var isAlfa = alfa === "" ? "False" : "True"; 234 $('.dictionary-tree').aciTree({ 235 ajax: { 236 async: true, 237 //cache: false, 238 url: '/' + lang + '/dictionary/GetTree?isbytheme=' + isbytheme + '&alpha=' + isAlfa + '&searchText=' + encodeURI(searchText) + '&id=' 239 }, 240 checkbox: false, 241 selectable: true, 242 itemHook: function (parent, item, itemData, level) { 243 } 244 }); 245 $('.dictionary-tree').css({ opacity: 1 }); 246 $('.dictionary-tree').on('acitree', function (event, api, item, eventName, options) { 247 if (eventName == 'selected') { 248 $('.search-text-').val(''); 249 var itemData = api.itemData(item); 250 //console.log(itemData); 251 DictionaryHelper.DictionaryText(itemData.id, itemData.isbytheme); 252 } 253 }); 254 return false; 255 } 256 257 this.createTree(''); 258 259 this.DictionaryText = function (code, isbytheme) { 260 var isSubsribed = false; 261 262 $.ajax({ // ÐÑовеÑка полÑзоваÑÐµÐ»Ñ Ð½Ð° ÑаÑÐ¸Ñ 263 url: "/" + languageUI + "/Dictionary/IsSubscribedUser", 264 method: "post" 265 }).done(function (result) { 266 isSubsribed = result; // полÑÑаем ÑезÑлÑÑÐ°Ñ Ð¿ÑовеÑки 267 //console.log("isSubsribed = " + isSubsribed); 268 }); 269 270 $.post('/' + lang + '/dictionary/DictionaryDescripton', { code: code, isbytheme: isbytheme }, function (data) { 271 if (isSubsribed === false && isbytheme == 7) { // ÐакÑÑÑие доÑÑÑпа к ÑодеÑÐ¶Ð¸Ð¼Ð¾Ð¼Ñ ÑемаÑиÑеÑкого поиÑка(isByTheme = 7 == ТемаÑиÑеÑкий поиÑк) 272 if (languageUI == "ru") { 273 $('.description-container').html("<div class='alert alert-warning'>У Ð²Ð°Ñ Ð½ÐµÑ Ð´Ð¾ÑÑÑпа. ÐÐ»Ñ Ð¿ÑоÑмоÑÑа данного маÑеÑиала вам нÑжно пÑиобÑеÑÑи полнÑй доÑÑÑп к ÑодеÑÐ¶Ð¸Ð¼Ð¾Ð¼Ñ ÐÐ°Ð·Ñ Ð´Ð°Ð½Ð½ÑÑ \"Zan\" в Ñазделе <a href='https://zan.kz/" + languageUI + "/static/tariff'>ТаÑиÑ</a></div>"); 274 } else if (languageUI == "kk") { 275 $('.description-container').html("<div class='alert alert-warning'>СÑзде ÑÒ±ÒÑÐ°Ñ Ð¶Ð¾Ò. Ðұл маÑеÑÐ¸Ð°Ð»Ð´Ñ ÒаÑÐ°Ñ Ò¯ÑÑн <a href='https://zan.kz/" + languageUI + "/static/tariff'>ТаÑиÑ</a> бөлÑмÑнде \"Zan\" деÑекÑÐµÑ Ð±Ð°Ð·Ð°ÑÑна деген ÑолÑÒ ÒолжеÑÑмдÑлÑкÑÑ ÑаÑÑп алÑÑÒ£Ñз кеÑек.</div>"); 276 } 277 $('.description-link').empty(); 278 } else { 279 $('.description-container').html(data); 280 $('.description-link').empty(); 281 } 282 }); 283 } 284 285 this.searchText = function (term) { 286 CommonHelper.ShowLoader(); 287 $.post("/" + languageUI + "/dictionary/DictionariesGetTreeSearch", { isbytheme: 7, id: null, search: term }, function (data) { 288 CommonHelper.HideLoader(); 289 $('.dic-tree-helper').empty(); 290 $('.dic-tree-helper').append('<div class="dictionary-tree aciTree aciTree0" ></div>'); //style="opacity:0;" 291 setTimeout(function () { 292 var _height = $(window).height(); 293 _height = _height - 140; 294 $('.dictionary-tree').css({ height: _height });
295 $('.dictionary-tree').aciTree({ 296 ajax: { 297 url: '/' + lang + '/dictionary/DictionariesGetTreeSearch?isbytheme=' + isbytheme + '&id=' 298 }, 299 rootData: data, 300 checkbox: false, 301 selectable: true, 302 itemHook: function (parent, item, itemData, level) { 303 } 304 }); 305 }, 1000); 306 }); 307 } 308 309 this.SearchTree2 = function (searchInputClass, treeObject) { 310 var searchText = $('.' + searchInputClass).val(); 311 var api = $('.' + treeObject).aciTree('api'); 312 var isOpened = $("." + treeObject + "-is-opened").val(); 313 if (isOpened == 'false') { 314 $("." + treeObject + "-is-opened").val('true'); 315 var leaves = $("." + treeObject + " .aciTreeLi"); 316 var checkboxes = api.inodes(leaves, false); 317 checkboxes.each(function (index, item) { 318 var $item = $(item); 319 if (api.isInode($item) == true) { 320 api.open($item, { expand: true }); 321 // branch 322 } 323 }); 324 } 325 api.filter(null, { 326 search: searchText 327 }); 328 } 329 330}
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.