1$(document).ready(function () { 2 // $('.main-nav').append('<div class="show-menu">ÐоказаÑÑ-ÑкÑÑÑÑ Ð¼ÐµÐ½Ñ ÑайÑа</div>'); 3 $(".show-menu").click(function () { 4 $(".main-menu").fadeToggle("300"); 5 }); 6 $('.main-menu li:has(ul)').hover( 7 function () { 8 $(this).children('.hidden-menu').fadeIn(150); 9 $(this).addClass('menuactive'); 10 }, function () { 11 $(this).children('.hidden-menu').fadeOut(150); 12 $(this).removeClass('menuactive'); 13 }); 14 $('.main-menu li:has(ul)').addClass('submenu icon-down-open'); 15 $(".ev-login-show").click(function () { 16 $(".overlay").fadeIn("300"); 17 }); 18 $('#loginbox').append('<a href="#" class="overlay-close" title="ÐакÑÑÑÑ"></a>'); 19 $(".overlay-close").click(function () { 20 $(".overlay").fadeOut("300"); 21 return false; 22 }); 23 $(".add-com-but").click(function () { 24 $("#addcform").fadeToggle("300"); 25 }); 26 $(".reply").click(function () { 27 $("#addcform").fadeToggle("300"); 28 }); 29}); 30 31$(document).ready(function () { 32 var showgotop = 300; 33 $('body').append('<a href="#" class="gotop" title="ÐавеÑÑ "><img src="/templates/rating-lcol/images/back-to-top.png" alt="навеÑÑ "> </a>'); 34 var s = $('.gotop'); 35 $(document).scroll(function () { 36 var st = $(document).scrollTop(); 37 if (st < showgotop) 38 s.fadeOut(400); 39 else 40 s.fadeIn(300); 41 }); 42 $('.gotop').click(function () { 43 $('html, body').animate({scrollTop: 0}, 'slow'); 44 return false; 45 }); 46 47 if ($('.fulltabs').length) { 48 $('.fulltabs').ttabs(); 49 } 50 51 var isSearchOpen = false; 52 var searchBtn = $("#td-header-search-button"); 53 searchBtn.click(function (e) { 54 e.preventDefault(); 55 e.stopPropagation(); 56 57 if (isSearchOpen) { 58 $(".td-drop-down-search").removeClass("td-drop-down-search-open"); 59 isSearchOpen = false; 60 } else { 61 $(".td-drop-down-search").addClass("td-drop-down-search-open"); 62 isSearchOpen = true; 63 setTimeout(function () { 64 $("#story").focus(); 65 }, 500); 66 } 67 }); 68}); 69 70/* 71 * Table of Contents jQuery Plugin - jquery.toc 72 * 73 * Copyright 2013-2016 Nikhil Dabas 74 * 75 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 76 * in compliance with the License. You may obtain a copy of the License at 77 * 78 * http://www.apache.org/licenses/LICENSE-2.0 79 * 80 * Unless required by applicable law or agreed to in writing, software distributed under the License 81 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 82 * or implied. See the License for the specific language governing permissions and limitations 83 * under the License. 84 */ 85 86(function ($) { 87 "use strict"; 88 89 // Builds a list with the table of contents in the current selector. 90 // options: 91 // content: where to look for headings 92 // headings: string with a comma-separated list of selectors to be used as headings, ordered 93 // by their relative hierarchy level 94 var toc = function (options) { 95 return this.each(function () { 96 var root = $(this), 97 data = root.data(), 98 thisOptions, 99 stack = [root], // The upside-down stack keeps track of list elements 100 listTag = this.tagName, 101 currentLevel = 0, 102 headingSelectors; 103 104 // Defaults: plugin parameters override data attributes, which override our defaults 105 thisOptions = $.extend( 106 {content: "body", headings: "h1,h2,h3"}, 107 {content: data.toc || undefined, headings: data.tocHeadings || undefined}, 108 options 109 ); 110 headingSelectors = thisOptions.headings.split(","); 111 112 // Set up some automatic IDs if we do not already have them 113 $(thisOptions.content).find(thisOptions.headings).attr("id", function (index, attr) { 114 // In HTML5, the id attribute must be at least one character long and must not 115 // contain any space characters. 116 // 117 // We just use the HTML5 spec now because all browsers work fine with it. 118 // https://mathiasbynens.be/notes/html5-id-class 119 var generateUniqueId = function (text) { 120 // Generate a valid ID. Spaces are replaced with underscores. We also check if 121 // the ID already exists in the document. If so, we append "_1", "_2", etc. 122 // until we find an unused ID. 123 124 function cyrill_to_latin(text) { 125 var arrru = new Array('Я', 'Ñ', 'Ю', 'Ñ', 'Ч', 'Ñ', 'Ш', 'Ñ', 'Щ', 'Ñ', 'Ð', 'ж', 'Ð', 'а', 'Ð', 'б', 'Ð', 'в', 'Ð', 'г', 'Ð', 'д', 'Ð', 'е', 'Ð', 'Ñ', 'Ð', 'з', 'Ð', 'и', 'Ð', 'й', 'Ð', 'к', 'Ð', 'л', 'Ð', 'м', 'Ð', 'н', 'Ð', 'о', 'Ð', 'п', 'Ð ', 'Ñ', 'С', 'Ñ', 'Т', 'Ñ', 'У', 'Ñ', 'Ф', 'Ñ', 'Ð¥', 'Ñ ', 'Ц', 'Ñ', 'Ы', 'Ñ', 'Ь', 'Ñ', 'Ъ', 'Ñ', 'Ð', 'Ñ'); 126 var arren = new Array('Ya', 'ya', 'Yu', 'yu', 'Ch', 'ch', 'Sh', 'sh', 'Sh', 'sh', 'Zh', 'zh', 'A', 'a', 'B', 'b', 'V', 'v', 'G', 'g', 'D', 'd', 'E', 'e', 'E', 'e', 'Z', 'z', 'I', 'i', 'J', 'j', 'K', 'k', 'L', 'l', 'M', 'm', 'N', 'n', 'O', 'o', 'P', 'p', 'R', 'r', 'S', 's', 'T', 't', 'U', 'u', 'F', 'f', 'H', 'h', 'C', 'c', 'Y', 'y', '', '', '\'', '\'', 'E', 'e'); 127 for (var i = 0; i < arrru.length; i++) { 128 var reg = new RegExp(arrru[i], "g"); 129 text = text.replace(reg, arren[i]); 130 } 131 return text; 132 } 133 134 text = cyrill_to_latin(text.toLowerCase()); 135 text.trim(); 136 137 if (text.length === 0) { 138 text = "?"; 139 } 140 141 var baseId = text.replace(/\s|[_]|\W|[#$%^&*)(()]/g, "_"); 142 var suffix = ""; 143 var count = 1; 144 145 while (document.getElementById(baseId + suffix) !== null) { 146 suffix = "_" + count++; 147 } 148 149 return baseId + suffix; 150 }; 151 152 return attr || generateUniqueId($(this).text()); 153 }).each(function () { 154 // What level is the current heading? 155 var elem = $(this), level = $.map(headingSelectors, function (selector, index) { 156 return elem.is(selector) ? index : undefined; 157 })[0]; 158 159 if (level > currentLevel) { 160 // If the heading is at a deeper level than where we are, start a new nested 161 // list, but only if we already have some list items in the parent. If we do 162 // not, that means that we're skipping levels, so we can just add new list items 163 // at the current level. 164 // In the upside-down stack, unshift = push, and stack[0] = the top. 165 var parentItem = stack[0].children("li:last")[0]; 166 if (parentItem) { 167 stack.unshift($("<" + listTag + "/>").appendTo(parentItem)); 168 } 169 } else { 170 // Truncate the stack to the current level by chopping off the 'top' of the 171 // stack. We also need to preserve at least one element in the stack - that is 172 // the containing element. 173 stack.splice(0, Math.min(currentLevel - level, Math.max(stack.length - 1, 0))); 174 } 175 176 var textSoderzanija = elem.text(); 177 if(elem && elem.length) { 178 elem.append('<a class="get-hash event-get-hash" href="#' + elem.attr('id') + '">#</a>' + 179 '<a class="go-top" href="#top">ÐавеÑÑ </a>') 180 } 181 // Add the list item 182 $("<li/>").appendTo(stack[0]).append( 183 $("<a/>").text(textSoderzanija).attr("href", "#" + elem.attr("id")) 184 ); 185 186 currentLevel = level; 187 }); 188 }); 189 }, old = $.fn.toc; 190 191 $.fn.toc = toc; 192 193 $.fn.toc.noConflict = function () { 194 $.fn.toc = old; 195 return this; 196 }; 197 198 // Data API 199 $(function () { 200 toc.call($("[data-toc]")); 201 }); 202}(window.jQuery)); 203 204function initToc() { 205 $(document).ready(function () { 206 if (!$('#toc').length) { 207 $("#toc-elem").toc({content: "div.full-text", headings: "h2,h3,h4"}); 208 } 209 }); 210} 211initToc(); 212 213// Fullstory 214var enableDataTables = true; 215 216$(document).ready(function () { 217 if ( 218 enableDataTables && 219 $('.full-text').length && 220 $('.full-text table th').length && 221 !$('.table-responsive').hasClass('event-nodatatable') 222 ) { 223 var opt = { 224 // "aaData": [ 225 // // ["htmlhook.ru", "https://htmlhook.ru/", "Ðлог", "2013-10-15 10:30:00"], 226 // // ["ÐовÑй пÑÑÑ", "http://www.phppath.ru/", "Ðлог", "2013-09-15 09:20:00"], 227 // // ["ÐоÑÑал UA", "http://pixelcom.at.ua/", "ÐнÑеÑÐ½ÐµÑ Ð¼Ð°Ð³Ð°Ð·Ð¸Ð½", "null"], 228 // ], 229 // "aoColumnDefs": [ 230 // // { 231 // // "sTitle": "Ðазвание ÑайÑа", 232 // // "aTargets": ["site_name"] 233 // // }, 234 // // { 235 // // "aTargets": [1], 236 // // "bSortable": false, 237 // // "mRender": function (url, type, full) { 238 // // return '<a href="' + url + '">' + url + '</a>'; 239 // // } 240 // // }, 241 // // { 242 // // "aTargets": [3], 243 // // "sType": "date", 244 // // "mRender": function (date, type, full) { 245 // // return (full[2] == "Ðлог") 246 // // ? new Date(date).toDateString() 247 // // : "N/A"; 248 // // } 249 // // } 250 // ], 251 "bAutoWidth": true, 252 fnDrawCallback: function () { 253 if ($(this).find('tr').length < 10) { 254 // $(this).closest('.dataTables_wrapper').find('.col-sm-6, .col-sm-5, .col-sm-7').hide(); 255 } 256 }, 257 // columnDefs: [ 258 // { targets: "_all", 259 // orderable: true, 260 // render: function(data, type) { 261 // if (type !== 'display') { 262 // console.log("1", data) 263 // if (parseInt(data)) { 264 // data = data.replace(' ', ''); 265 // console.log("2", data) 266 // return data; 267 // } 268 // } 269 // return data 270 // } 271 // } 272 // // { targets: '_all', orderable: false } 273 // ], 274 columnDefs: [ 275 { 276 render: function (data, type, row) { 277 // if (parseInt(data)) { 278 // return data.replace( /[^\d\-\.]/g, "" ); 279 // } 280 return data; 281 }, 282 targets: '_all' 283 } 284 ], 285 language: { 286 "processing": "ÐодождиÑе...", 287 "search": "ÐоиÑк:", 288 "lengthMenu": "ÐоказаÑÑ _MENU_ запиÑей", 289 "info": "ÐапиÑи Ñ _START_ до _END_ из _TOTAL_ запиÑей", 290 "infoEmpty": "ÐапиÑи Ñ 0 до 0 из 0 запиÑей", 291 "infoFiltered": "(оÑÑилÑÑÑовано из _MAX_ запиÑей)", 292 "infoPostFix": "", 293 "loadingRecords": "ÐагÑÑзка запиÑей...", 294 "zeroRecords": "ÐапиÑи оÑÑÑÑÑÑвÑÑÑ.", 295 "emptyTable": "Ð ÑаблиÑе оÑÑÑÑÑÑвÑÑÑ Ð´Ð°Ð½Ð½Ñе", 296 "paginate": { 297 "first": "ÐеÑваÑ", 298 "previous": "ÐÑедÑдÑÑаÑ", 299 "next": "СледÑÑÑаÑ", 300 "last": "ÐоÑледнÑÑ" 301 }, 302 "aria": { 303 "sortAscending": ": акÑивиÑоваÑÑ Ð´Ð»Ñ ÑоÑÑиÑовки ÑÑолбÑа по возÑаÑÑаниÑ", 304 "sortDescending": ": акÑивиÑоваÑÑ Ð´Ð»Ñ ÑоÑÑиÑовки ÑÑолбÑа по ÑбÑваниÑ" 305 }, 306 "decimal": ",", 307 "thousands": " ", 308 "formatNumber": function ( toFormat ) { 309 return toFormat.toString().replace( 310 /\B(?=(\d{3})+(?!\d))/g, "'" 311 ); 312 } 313 }, 314 iDisplayLength: 25 315 // lengthChange: false, 316 // buttons: ['copy', 'excel', 'pdf'] 317 }; 318 var table = $('.full-text table:not(.reverse-table)').DataTable(opt); 319 var reverseTable = $('.full-text .reverse-table').DataTable(opt); 320 321 if ($('.full-text .reverse-table').length) { 322 reverseTable.page('next').draw(false).page('next').draw(false).page('next').draw(false); 323 } 324 325 if ($('.full-text table:not(.reverse-table)').length) { 326 $('.full-text tbody') 327 .on('mouseenter', 'td', function () { 328 var colIdx = table.cell(this).index().column; 329 330 $(table.cells().nodes()).removeClass('highlight'); 331 $(table.column(colIdx).nodes()).addClass('highlight'); 332 }); 333 // table.buttons().container().appendTo('.full-lext .table-responsive') 334 // table.buttons().container().appendTo('.full-lext .responsive-table') 335 } 336 } 337 338 $('.list-group-item').on('click', function (e) { 339 e.preventDefault(); 340 }); 341// .not(":first-child") 342// $('.full-text').find('img:first-child').addClass('first-image'); 343 $('.full-text').find('img').each(function( index ) { 344 if ($(this).parent('a').length || $(this).parent('div').length) { 345 return; 346 } 347 $(this).addClass('first-image'); 348 if (index === 0) { 349 return false;
350 } 351 }); 352}); 353 354/*** 355 * New design code 356 * ***/ 357/** 358 * Perform search for given value 359 * @param {string} val Value to search for 360 */ 361var catSearchContainer = $('#cat-list-search-box'); 362var catInputElem = $('#cat-list-search-box').find('.input-elem'); 363var catUl = $('.cat-ul'); 364var searchResults = $("#search-results"); 365var searchingClasses = 'sac-searching sac-searching-hide-not-found finding-cats'; 366 367function searchNodes(val) { 368 val = val ? val.replace(/<\/?[a-z][a-z0-9]*[/\\]*[^<>]*>/ig, "") : ''; 369 if (catSearchContainer && catSearchContainer.length > 0) { 370 var searchType = catSearchContainer.find('.sac-seacrh-combo-type').val(); 371 372 // Reset classes 373 catSearchContainer.find('li').removeClass('sac-found-category sac-found-item'); 374 catSearchContainer.find('.node-name').removeClass('sac-found-item'); 375 376 if (searchType === 'fast-search-val') { 377 $('div.event-cat-google-search').show(); 378 $('div.cat-search-box, div.cat-box-list').hide(); 379 $('div.cat-yandex-search, div.cat-box-sm-slud').show(); 380 $('.event-opened-cat').removeClass('event-opened-cat'); 381 $('.event-cat-box-list').removeAttr('style'); 382 setCatBoxText($('.event-close-cat'), 'indikator'); 383 // searchResults.show(); 384 // $.post("/engine/ajax/search.php", {query: "" + val + ""}, function (data) { 385 // var text = data; 386 // if (data === 'error') { 387 // text = '<span class="notfound">ЧÑо-Ñо поÑло не Ñак. ÐопÑобÑйÑе измениÑÑ Ð·Ð°Ð¿ÑоÑ.</span>'; 388 // } 389 // searchResults.html(text); 390 // catUl.hide(); 391 // if (!data) { 392 // catUl.show(); 393 // } 394 // }); 395 } 396 // else if (searchType == '2') { 397 // 398 // // RegExp 399 // var valLen = val.length; 400 // if (valLen > 0) { 401 // catSearchContainer.addClass('sac-searching'); 402 // catSearchContainer.addClass('sac-searching-hide-not-found'); 403 // 404 // // Check for index 405 // catSearchContainer.find('.node-name').each(function () { 406 // var elem = $(this); 407 // var elemFound = new RegExp(val).test(elem.text()); 408 // if (elemFound) { 409 // elem.closest('li').addClass('sac-found-item'); 410 // foundParentNodes(elem); 411 // } 412 // }); 413 // } else { 414 // catSearchContainer.removeClass('sac-searching sac-searching-hide-not-found'); 415 // } 416 // 417 // } 418 else { 419 // Starts with / Exists in 420 421 if (!$('.event-opened-cat').length) { 422 setCatBoxText($('.event-close-cat'), 'close'); 423 $('body').addClass('event-opened-cat'); 424 // $('.event-opened-cat').removeClass('event-opened-cat'); 425 // $('div.event-cat-google-search').hide(); 426 } 427 $('div.cat-search-box, div.cat-box-list').show(); 428 $('div.cat-yandex-search, div.cat-box-sm-slud').hide(); 429 var valLen = val.length; 430 if (valLen >= 1) { 431 searchResults.hide(); 432 catUl.show(); 433 catSearchContainer.addClass(searchingClasses); 434 435 // Check for index 436 catSearchContainer.find('.node-name').each(function () { 437 var elem = $(this); 438 var elemIndex = elem.text().toLowerCase().indexOf(val.toLowerCase()); 439 console.log(elemIndex) 440 var elemFound = (searchType == '0') ? elemIndex === 0 : elemIndex != -1; 441 if (elemFound) { 442 elem.closest('li').addClass('sac-found-item'); 443 foundParentNodes(elem); 444 } 445 }); 446 } else { 447 catSearchContainer.removeClass(searchingClasses); 448 } 449 450 } 451 452 } 453} 454 455/**
456 * Find parent nodes and indicate as found items 457 * @param {object} elem jQuery node object 458 */ 459function foundParentNodes(elem) { 460 if (elem) { 461 var parUl = elem.closest('ul'); 462 if (parUl.hasClass('cat-ul')) { 463 elem.closest('li').addClass('sac-found-category'); 464 } 465 var parNode = parUl.closest('li'); 466 parNode.addClass('sac-found-category'); 467 var upperParent = parNode.closest('ul').closest('li'); 468 if (upperParent && upperParent.length > 0) { 469 foundParentNodes(parNode); 470 } 471 } 472} 473 474/** 475 * Add event listeners on search input 476 */ 477function addSearchBoxEventListeners() { 478 if (catSearchContainer && catSearchContainer.length > 0) { 479 var input = catSearchContainer.find('.input-elem'); 480 // Search type combo 481 catSearchContainer.find('.sac-seacrh-combo-type').on('change', function () { 482 searchNodes(input.val()); 483 }); 484 // Search box input 485 $(window).on('keyup', function (e) { 486 switch (e.keyCode) { 487 // escape 488 case 27: { 489 catUl.show(); 490 searchResults.hide(); 491 catInputElem.val(''); 492 } 493 // игноÑиÑÑем нажаÑÐ¸Ñ Ð½Ð° ÑÑи клавиÑÑ 494 case 13: // enter 495 case 38: // ÑÑÑелка ввеÑÑ 496 case 40: // ÑÑÑелка вниз 497 break; 498 } 499 }); 500 input.on('input', function (e) { 501 var inp = $(this); 502 var val = inp.val(); 503 searchNodes(val); 504 }); 505 } 506} 507 508function stickySidebarInit() { 509 if ($(window).width() > 962 && $('#sidebar').length) { 510 var sidebar = new StickySidebar('#sidebar', { 511 topSpacing: 20, 512 bottomSpacing: 0, 513 // containerSelector: false, 514 // innerWrapperSelector: '.sidebar-inner', 515 resizeSensor: true, 516 stickyClass: 'is-affixed', 517 minWidth: 0 518 }); 519 } 520} 521 522function setMatchHeight() { 523 if ($(window).width() > 767) { 524 $.fn.matchHeight._maintainScroll = true; 525 $('.inline-box > article').matchHeight().addClass('matchHeight'); 526 } 527} 528 529function loadMorePosts() { 530 // LOAD MORE POSTS 531 if ($('#nav-load').length) { 532 var loadLink = $('body').find('.nav-load'); 533 var loadStatus = 0; 534 var pageCount = 1; 535 var urlNext = loadLink.find('a').attr('href'); 536 537 $('body').on('click', '.nav-load a', function(e) { 538 e.preventDefault(); 539 if (loadStatus) return; 540 $(this).css({opacity: .4}); 541 if (urlNext !== undefined) { 542 loadStatus = 1; 543 $.ajax({ 544 url: urlNext, 545 success: function (data) { 546 // Udaljajem zagruzennie materiali na kazdoj 7 stranice 547 // if (pageCount === 7) { 548 // console.log('reload') 549 // window.location.reload(); 550 // } 551 // if (pageCount === 5) { 552 // $('.inline-box > .matchHeight').matchHeight({remove: true}); 553 // $('.inline-box').remove(); 554 // window.scrollTo(0, 0); 555 // pageCount = 1; 556 // } 557 $('#bottom-nav').remove(); 558 $('.event-content-wrapper').append($('.event-content-wrapper', data).html()); 559 560 window.history.pushState("", "", urlNext); 561 562 loadLink = $('#nav-load'); 563 if (yaCounter47105940 && yaCounter47105940.hit) { 564 yaCounter47105940.hit(urlNext); 565 } 566 if (typeof ga !== 'undefined') { 567 ga('send', 'pageview', urlNext); 568 } 569 setTimeout(function () { 570 $('.inline-box > article:not(.matchHeight)').matchHeight(); 571 loadStatus = 0; 572 pageCount += 1; 573 }, 300); 574 } 575 }); 576 } else { 577 loadLink.remove(); 578 } 579 }); 580 } 581} 582 583/** 584 * COOKIE 585 */ 586function setCookie(cname, cvalue, exdays) { 587 var d = new Date(); 588 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 589 var expires = "expires="+d.toUTCString(); 590 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 591} 592 593function getCookie(cname) { 594 var name = cname + "="; 595 var ca = document.cookie.split(';'); 596 for(var i = 0; i < ca.length; i++) { 597 var c = ca[i]; 598 while (c.charAt(0) == ' ') { 599 c = c.substring(1); 600 } 601 if (c.indexOf(name) == 0) { 602 return c.substring(name.length, c.length); 603 } 604 } 605 return ""; 606} 607 608function checkCookie() { 609 var user = getCookie("username"); 610 if (user != "") { 611 alert("Welcome again " + user); 612 } else { 613 user = prompt("Please enter your name:", ""); 614 if (user != "" && user != null) {
615 setCookie("username", user, 365); 616 } 617 } 618} 619 620function deleteCookie(name) { 621 setCookie(name, "", { 622 expires: -1 623 }) 624} 625 626function setCatBoxText(me, action) { 627 if (!action) return; 628 me.find('span').text(me.data(action)); 629} 630 631function openCatBox(me, callback) { 632 $('body').removeClass('event-opened-cat'); 633 setCatBoxText(me, 'indikator'); 634 if (typeof callback === 'function') { 635 callback(); 636 } 637} 638function closeCatBox(me, callback) { 639 $('body').addClass('event-opened-cat'); 640 setCatBoxText(me, 'close'); 641 if (typeof callback === 'function') { 642 callback(); 643 } 644} 645function nightViewEvents() { 646 647} 648 649// Night mode 650$(document).ready(function () { 651 var html = $('html'); 652 var body = $('body'); 653 var NMCookie = 'nightMode'; 654 var nightMode = getCookie(NMCookie); 655 var daySwitch = $('#day-switch'); 656 var nightModeBtn = $('.event-night-mode'); 657 if(nightMode) { 658 $('html').addClass('night-mode-html'); 659 daySwitch.text(daySwitch.data('night')); 660 nightModeBtn.attr('title', nightModeBtn.data('night')); 661 } 662 else { 663 daySwitch.text(daySwitch.data('day')); 664 nightModeBtn.attr('title', nightModeBtn.data('day')); 665 } 666 nightModeBtn.on('click', function (e) { 667 if (html.hasClass('night-mode-html')) { 668 deleteCookie(NMCookie); 669 html.removeClass('night-mode-html'); 670 daySwitch.text(daySwitch.data('day')); 671 nightModeBtn.attr('title', nightModeBtn.data('day')); 672 } else { 673 setCookie(NMCookie, '1', 60); 674 html.addClass('night-mode-html'); 675 daySwitch.text(daySwitch.data('night')); 676 nightModeBtn.attr('title', nightModeBtn.data('night')); 677 } 678 }); 679 var wideModeBtn = $('.event-wide-mode'); 680 // var wideCookie = 'wideMode'; 681 // wideModeBtn.on('click', function (e) { 682 // if (html.hasClass('wide-mode-html')) { 683 // deleteCookie(wideCookie); 684 // html.removeClass('wide-mode-html'); 685 // wideModeBtn.attr('title', wideModeBtn.data('larger')); 686 // } else { 687 // setCookie(wideCookie, '1', 60); 688 // html.addClass('wide-mode-html'); 689 // wideModeBtn.attr('title', wideModeBtn.data('less')); 690 // } 691 // }); 692 var view1024Cookie = 'view1024Mode'; 693 wideModeBtn.on('click', function (e) { 694 if (html.hasClass('view1024-mode-html')) { 695 html.removeClass('view1024-mode-html'); 696 deleteCookie(view1024Cookie); 697 wideModeBtn.attr('title', wideModeBtn.data('less')); 698 } else { 699 html.addClass('view1024-mode-html'); 700 setCookie(view1024Cookie, '1', 60); 701 wideModeBtn.attr('title', wideModeBtn.data('larger')); 702 } 703 }); 704 705 $('.btn').on('mousemove', function (e) { 706 var me = this; 707 var x = e.pageX - me.offsetLeft - me.offsetParent.offsetLeft; 708 var y = e.pageY - me.offsetTop - me.offsetParent.offsetTop; 709 me.style.setProperty('--x', x + 'px') 710 me.style.setProperty('--y', y + 'px') 711 }); 712 713 var catBoxClosedCookie = 'cat_box_closed'; 714 var catBoxMenu = $('.event-close-cat'); 715 catBoxMenu.on('click', function (e) { 716 e.preventDefault(); 717 var me = $(this); 718 719 if (body.hasClass('event-opened-cat')) { 720 if ($('.sac-seacrh-combo-type option:selected').val() === 'cat-search-val') { 721 $('.sac-seacrh-combo-type').val('fast-search-val').trigger('change'); 722 } 723 openCatBox(me, function () { 724 return deleteCookie(catBoxClosedCookie); 725 }); 726 } else { 727 $('.cat-box-sm-slud').removeAttr('style'); 728 closeCatBox(me, function () { 729 return setCookie(catBoxClosedCookie, '1', 60); 730 }); 731 } 732 }); 733 $('.event-close-cat-bottom').on('click', function (e) { 734 e.preventDefault(); 735 catBoxMenu.trigger('click'); 736 }); 737 if (body.hasClass('event-opened-cat')) { 738 setCatBoxText(catBoxMenu, 'close'); 739 } else { 740 setCatBoxText(catBoxMenu, 'indikator'); 741 } 742 743 if ($('.cat-list-search-box').length) { 744 $('.cat-list-search-box').find(); 745 } 746 747 addSearchBoxEventListeners(); 748 stickySidebarInit(); 749 setMatchHeight();
750 loadMorePosts(); 751 752 // // Ho 753 // $( '.img-container' ).on( "mouseenter mouseleave", function () { 754 // 755 // } ); 756}); 757 758$(window).on('load', function() { 759 /** код бÑÐ´ÐµÑ Ð·Ð°Ð¿ÑÑен когда ÑÑÑаниÑа бÑÐ´ÐµÑ Ð¿Ð¾Ð»Ð½Ð¾ÑÑÑÑ Ð·Ð°Ð³ÑÑжена, вклÑÑÐ°Ñ Ð²Ñе ÑÑеймÑ, обÑекÑÑ Ð¸ изобÑÐ°Ð¶ÐµÐ½Ð¸Ñ **/ 760 // 761 $('.slud:empty').removeAttr('style'); 762 $('.slud').addClass('active'); 763 $('ins:empty').next().addClass('active'); 764}); 765 766// var btn = document.querySelector('#btn_searchAreaControl_catSearchContainer_2_invertSelection') 767// btn.onmousemove = function(e) { 768// var x = e.pageX - btn.offsetLeft 769// var y = e.pageY - btn.offsetTop 770// btn.style.setProperty('--x', x + 'px') 771// btn.style.setProperty('--y', y + 'px') 772// } 773 774/** 775 * Remove ATTributes 776 * @type {jQuery.removeAttr|*} 777 */ 778var removeAttr = jQuery.fn.removeAttr; 779jQuery.fn.removeAttr = function() { 780 if (!arguments.length) { 781 this.each(function() { 782 // Looping attributes array in reverse direction 783 // to avoid skipping items due to the changing length 784 // when removing them on every iteration. 785 for (var i = this.attributes.length -1; i >= 0 ; i--) { 786 if (this.attributes[i].name !== 'colspan' || this.attributes[i].name !== 'rowspan') { 787 jQuery(this).removeAttr(this.attributes[i].name); 788 } 789 } 790 }); 791 return this; 792 } 793 return removeAttr.apply(this, arguments); 794}; 795 796function replaceElementTag(targetSelector, newTagString) { 797 $(targetSelector).each(function(){ 798 var newElem = $(newTagString, {html: $(this).html()}); 799 $.each(this.attributes, function() { 800 newElem.attr(this.name, this.value); 801 }); 802 $(this).replaceWith(newElem); 803 }); 804} 805 806function strip(html) { 807 var tmp = document.createElement("DIV"); 808 tmp.innerHTML = html; 809 return tmp.textContent || tmp.innerText || ""; 810} 811 812 813 814function rewrite_editor_tags() { 815 var fullText = $('.full-text'); 816 var postImage = fullText.find('img'); 817 var table = fullText.find('table'); 818 var div = fullText.find('div'); 819 820 if (fullText.find('#toc-elem').next('p').length || fullText.find('#toc-elem').next('h2').length) { 821 return false; 822 } 823 824 // fullText.find('p:empty').remove(); 825 // fullText.find('div:empty').remove(); 826 827 // fullText.html(function (i, html) { 828 // console.log(html) 829 // return html.replace(/\n/g, ''); 830 // }); 831 // fullText.html(function (i, html) { 832 // return html.replace(/ /g, ''); 833 // }); 834 // fullText.html(function (i, html) { 835 // return html.replace(/\>[\t ]+\</g, "><"); 836 // }); 837 // fullText.html(function (i, html) { 838 // return html.replace(/\>[\t ]+$/g, ">"); 839 // }); 840 // fullText.html(function (i, html) { 841 // // Multi spaces 842 // return html.replace(/\s\s+/g, ' '); 843 // }); 844 // fullText.html(function (i, html) { 845 // // Multi spaces 846 // return html.replace(/\t\t+/g, ' '); 847 // }); 848 849 // fullText.html(fullText.html()); 850 if (table && table.length) { 851 852 } 853 854 if (table && table.length > 1) { 855 table.each(function (i) { 856 tableModification($(this)); 857 }) 858 } else if (table.length === 1) { 859 tableModification(table); 860 } 861 862 function tableModification(table) { 863 table.removeAttr(); 864 table.find('tr').removeAttr(); 865 table.find('td').removeAttr(); 866 table.find('colgroup').remove(); 867 868 if(table.parent().hasClass('full-text')) { 869 table.wrap('<div class="table-responsive"></div>'); 870 } else { 871 table.parent().removeAttr().addClass('table-responsive'); 872 } 873 if (!table.find('thead').length) { 874 var firstTrJsObj = table.find('tbody').children('tr:first'); 875 firstTrJsObj.find('td').each(function() { 876 $(this).replaceWith($('<th/>').html($(this).html())); 877 }); 878 var addThead = '<thead><tr>' + firstTrJsObj[0].innerHTML + '</tr></thead>'; 879 880 table.prepend($(addThead)); 881 firstTrJsObj.remove(); 882 } 883 884 return table; 885 } 886 // var regex = RegExp('<div><strong>[a-zA-Z0-9а-ÑÑйÐ-ЯÐÐ() .,:;]*<\\/strong><\\/div>', 'ig'); 887 // var regex = /<div><strong>[a-zA-Z0-9а-ÑÑйÑÑÐ-ЯÐÐЬЪ() .,:;]*<\/strong><\/div>/g; 888 // if (postImage && postImage.length) { 889 // postImage.parent().replaceWith('<p><img src="' + postImage[0].src + '" alt="' + postImage[0].alt + '" title="ÐллÑÑÑÑаÑиÑ" /></p>'); 890 // } 891 892 var fullHtml = fullText.html(); 893 894 var divStrongPattern = /<div><strong>(.+?)<\/strong><\/div>/g; 895 var resDText = fullHtml.replace(divStrongPattern, '<h2>$1</h2>'); 896 divStrongPattern = /<div><b>(.+?)<\/b><\/div>/g; 897 resDText = fullHtml.replace(divStrongPattern, '<h2>$1</h2>'); 898 // 899 var divBPattern = /<div><b>(.+?)<\/b><\/div>/g; 900 var divBPattern2 = /(?:<div><b>((?:.*?\r?\n?)*)<\/b>((?:.*?\r?\n?)*)<\/div>)+/g; 901 resDText = fullHtml.replace(divBPattern, '<h2>$1</h2>'); 902 // console.log("resDText", resDText) 903 // var divSpanPattern = /<div><span>(.+?)<\/span><\/div>/g; 904 // resDText = resDText.replace(divSpanPattern, '<p>$1</p>'); 905 906 var divPattern = /<div>(.+?)<\/div>/g; 907 // resDText = resDText.replace(divPattern, '<p>$1</p>'); 908 909 // $(resDText).find('p:empty').remove(); 910 // resDText.find('div:empty').remove(); 911 912 fullText.find('div').each(function(i){ 913 var me = this; 914 var postImage = $(me).find('img'); 915 createH2Tag(me, 'b'); 916 createH2Tag(me, 'strong'); 917 createH2Tag(me, 'span'); 918 919 if (postImage && postImage.length) { 920 postImage.parent().replaceWith('<p><img src="' + postImage[0].src + '" alt="' + postImage[0].alt + '" title="ÐллÑÑÑÑаÑиÑ" /></p>'); 921 } 922 }); 923 924 fullText.find('div').each(function(i){ 925 var me = this; 926 927 if ($(me).parent().hasClass('full-text') && ( 928 $(me).find('table').length 929 // $(me).find('b').length || 930 // $(me).find('span').length || 931 // $(me).find('strong').length 932 )) { 933 // console.log(this, $(me).find('table').length) 934 // $(me).replaceWith($('<p />', {html: $(me).html().trim()})); 935 } 936 else { 937 $(me).replaceWith($('<p />', {html: $(me).html().trim()})); 938 } 939 }); 940 941 // fullText.find('p').each(function(i){ 942 // var me = this; 943 // var divLength = this.innerText.length; 944 // createH2Tag('b'); 945 // createH2Tag('strong'); 946 // createH2Tag('span'); 947 // }); 948 949 fullText.find('p:empty').remove(); 950 // Display compiled text 951 // fullText.html(resDText); 952 fullText.html(fullText.html()); 953 954 function createH2Tag(me, tagName) { 955 var tagBold = $(me).find(tagName); 956 if (tagBold.length) { 957 var divLength = tagBold[0].innerText.length; 958 tagBold.each(function(i){ 959 if(me.innerText.length === divLength) { 960 me.innerHTML = '<h2>' + me.innerText + '</h2>'; 961 $(me).replaceWith( $('<h2 />', {text: $(me).text().trim()}) ); 962 } 963 }); 964 } 965 } 966} 967 968// rewrite_editor_tags(); 969 970 971 972 973 974 975 976 977 978 979 980
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.