PageSourceSearch

https://sichuanairtr.com/js/scripts.js

js sichuanairtr.com collected 2026-10-04 02:36:17 UTC 9,984 bytes, 296 lines download raw bytes

1// SVG for Everybody adds SVG External Content support to all browsers.
2// https://github.com/jonathantneal/svg4everybody
3!function(a,b){"function"==typeof define&&define.amd?define([],function(){return a.svg4everybody=b()}):"object"==typeof module&&module.exports?module.exports=b():a.svg4everybody=b()}(this,function(){function a(a,b,c){if(c){var d=document.createDocumentFragment(),e=!b.hasAttribute("viewBox")&&c.getAttribute("viewBox");e&&b.setAttribute("viewBox",e);for(var f=c.cloneNode(!0);f.childNodes.length;)d.appendChild(f.firstChild);a.appendChild(d)}}function b(b){b.onreadystatechange=function(){if(4===b.readyState){var c=b._cachedDocument;c||(c=b._cachedDocument=document.implementation.createHTMLDocument(""),c.body.innerHTML=b.responseText,b._cachedTarget={}),b._embeds.splice(0).map(function(d){var e=b._cachedTarget[d.id];e||(e=b._cachedTarget[d.id]=c.getElementById(d.id)),a(d.parent,d.svg,e)})}},b.onreadystatechange()}function c(c){function e(){for(var c=0;c<o.length;){var h=o[c],i=h.parentNode,j=d(i),k=h.getAttribute("xlink:href")||h.getAttribute("href");if(!k&&g.attributeName&&(k=h.getAttribute(g.attributeName)),j&&k){if(f)if(!g.validate||g.validate(k,j,h)){i.removeChild(h);var l=k.split("#"),q=l.shift(),r=l.join("#");if(q.length){var s=m[q];s||(s=m[q]=new XMLHttpRequest,s.open("GET",q),s.send(),s._embeds=[]),s._embeds.push({parent:i,svg:j,id:r}),b(s)}else a(i,j,document.getElementById(r))}else++c,++p}else++c}(!o.length||o.length-p>0)&&n(e,67)}var f,g=Object(c),h=/\bTrident\/[567]\b|\bMSIE (?:9|10)\.0\b/,i=/\bAppleWebKit\/(\d+)\b/,j=/\bEdge\/12\.(\d+)\b/,k=/\bEdge\/.(\d+)\b/,l=window.top!==window.self;f="polyfill"in g?g.polyfill:h.test(navigator.userAgent)||(navigator.userAgent.match(j)||[])[1]<10547||(navigator.userAgent.match(i)||[])[1]<537||k.test(navigator.userAgent)&&l;var m={},n=window.requestAnimationFrame||setTimeout,o=document.getElementsByTagName("use"),p=0;f&&e()}function d(a){for(var b=a;"svg"!==b.nodeName.toLowerCase()&&(b=b.parentNode););return b}return c});
4svg4everybody();
5
6
7// Scripts
8jQuery(document).ready(function($){
9
10  // Обработчик ссылок
11  $('[data-ext="ext-link"]').replaceWith (function (){
12
13    if( $(this).attr('class') !== undefined ) {
14      el_class = 'class="'+$(this).attr("class")+'"';
15    } else {
16      el_class = '';
17    }
18
19    if( $(this).data('title') !== undefined ) {
20      el_title = 'title="'+$(this).data('title')+'"';
21    } else {
22      el_title = '';
23    }
24
25    return'<a href="'+$(this).data('link')+'" '+el_class+''+ el_title+'>'+$(this).html()+'</a>';
26
27  });
28
29
30  // Переключаем навигацию
31  $("#navbar__btn").on("click", function () {
32
33    if( $('#navbar').hasClass('is-nav-active') ) {
34      $('#navbar').removeClass('is-nav-active');
35    } else {
36      $('#navbar').addClass('is-nav-active');
37    }
38
39  });
40
41
42  // BEGIN Перемещаем меню из сайдбара в адаптивное и обратно
43
44  function navsToMainMover($class){
45    $($class).each(function(){
46
47      if( $(this).html().length > 0 ) {
48
49        var location = $(this).attr('id');
50
51        $(this).html(function () {
52          $('<div class="js-sidebar-nav" data-location="' + location + '">' + $(this).html() + '</div>').appendTo( $('#nav-main').parent() );
53          return '';
54        });
55
56      }
57
58    });
59  }
60
61  function navsToLocationMover($class){
62    $($class).each(function(){
63
64      var location = $(this).data('location');
65
66      if( location.length > 0 ) {
67
68        $(this).children().appendTo( $('#' + location) );
69        $(this).remove();
70
71      }
72
73    });
74  }
75
76
77  if( window.innerWidth <= 1023 ) {
78    navsToMainMover('#navbar-top');
79    navsToMainMover('.widget_nav_menu');
80  }
81
82  $(window).resize(function() {
83    if ( window.innerWidth <= 1023 ) {
84      navsToMainMover('#navbar-top');
85      navsToMainMover('.widget_nav_menu');
86    } else {
87      navsToLocationMover('.js-sidebar-nav');
88    }
89  });
90
91  // END Перемещаем меню из сайдбара в адаптивное и обратно
92
93
94  $(".menu-item-has-children > a").on("click", function () {
95
96    if ((window.innerWidth < 1023)) {
97
98      if ( $(this).parent().hasClass('is-sub-active') ) {
99        $(this).parent().removeClass('is-sub-active');
100      } else {
101        $(this).parent().addClass('is-sub-active');
102      }
103
104    }
105
106    return false;
107
108  });
109
110
111  // Плавный скролл при переходе на якорь
112  $('.nav-main a').on("click", function () {
113    // Если мы на этой же странице
114    if( window.location.pathname == this.pathname && this.hash ) {
115      $('html,body').stop().animate({scrollTop: $(this.hash).offset().top - 100}, 1000);
116    }
117  });
118
119
120
121
122  //Атрибут start тега ol
123  $('ol[start]').each(function() {
124       var val = parseFloat($(this).attr("start")) - 1;
125       $(this).css('counter-increment','li '+ val);
126   });
127
128
129
130  //Стрелочка наверх
131  $('<div id="up" class="up" style="display: none">наверх</div>').appendTo('.footer').click(function() {
132    $('html, body').animate({scrollTop: 0}, 700);
133  });
134  var win = $(window);
135  var up = $('#up');
136  win.on('scroll', function() {
137    if ( win.scrollTop() > win.height() / 3 ) {
138      up.fadeIn();
139    } else {
140      up.fadeOut();
141    }
142  }).scroll();
143
144
145
146  //удалить кнопку загрузить еще, если нет постов
147  $.ajaxSetup({complete: function() {
148    $('.last_item').next('.more').remove();
149  }});
150
151
152
153  // Слайдер галерея
154  var slider = Array();
155  jQuery('.sl-gallery').each(function(){
156
157    id = jQuery(this).attr('id').replace('sl-gallery-', '');
158
159    slider[id] = jQuery('#sl-gallery-' + id).slick({
160      slidesToShow: 1,
161      slidesToScroll: 1,
162      arrows: true,
163      fade: true,
164      adaptiveHeight: true,
165      asNavFor: '#sl-pager-' + id,
166      prevArrow: '<div class="sl-gallery-prev"></div>',
167      nextArrow: '<div class="sl-gallery-next"></div>',
168    });
169
170    slider['pager' + id] = jQuery('#sl-pager-' + id).slick({
171      infinite: true,
172      slidesToShow: 5,
173      slidesToScroll: 1,
174      asNavFor: '#sl-gallery-' + id,
175      centerMode: true,
176      focusOnSelect: true,
177      prevArrow: '<div class="sl-gallery-prev"></div>',
178      nextArrow: '<div class="sl-gallery-next"></div>',
179      respondTo: 'min',
180      responsive: [
181
182        {
183          breakpoint: 768,
184          settings: {
185            slidesToShow: 3
186          }
187        },
188        {
189          breakpoint: 480,
190          settings: {
191            slidesToShow: 2
192          }
193        },
194        {
195          breakpoint: 360,
196          settings: {
197            slidesToShow: 1
198          }
199        },
200      ]
201    });
202
203  });
204
205
206
207  //пагинация
208  if ( $('.more').length ) {
209    $('body').on('click', '.more:not(.loading)', function() {
210      var more = $(this);
211      var container = $(this).parent().prev('.ajax_pagination');
212      var defaultText = more.html();
213      more.addClass('loading').html( more.data('loading') );
214      var offset = more.data('offset');
215      var items = more.data('items');
216      var theme = more.data('theme');
217      var home = '';
218      var tax = '';
219      var tag = '';
220      var search = '';
221      if( more.data('home') ) home = '&home=' + more.data('home');
222      if ( more.data('category') ) tax = '&cat=' + more.data('category');
223      if ( more.data('tag') ) tag = '&tag=' + more.data('tag');
224      if ( more.data('search') ) search = '&search=' + more.data('search');
225      console.log(search);
226      $.ajax({
227        url: '/wp-content/themes/' + theme + '/ajax-posts.php?offset=' + offset + '&items=' + items + home + tax + tag + search
228      }).done(function(html) {
229        container.append(html);
230        more.data('offset', offset + items).removeClass('loading').html(defaultText);
231        if ($.trim(html) === '') {
232          more.remove();
233        }
234      });
235    });
236  }
237
238
239  if( $('.navbar-sticky').length > 0 ) {
240    var navbar_position = $('.navbar-sticky').offset().top;
241  }
242
243  $(window).scroll(function() {
244
245    if ( navbar_position && $(window).scrollTop() > navbar_position ) {
246      $('.navbar-sticky').addClass('navbar-sticky--fixed');
247    } else {
248      $('.navbar-sticky').removeClass('navbar-sticky--fixed');
249    }
250
251  });
252
253  var structure = '<ul class="toc_list">';
254  $('#body_container').find('h2, h3, h4, h5, h6').each(function (idx, el) {
255      if ($(this).html() != `&nbsp;`) {
256          $(this).prepend('<a id="structure_' + idx + '"></a>');
257          structure += '<li><a href="#structure_' + idx + '" class="toc-item">' + $(this).text() + '</a></li>';
258      }
259  });
260  structure += '</ul><hr>'
261  $(this).find('#toc_container').html(structure);
262
263});
264document.addEventListener("DOMContentLoaded", function () {
265  initToTopBtn();
266});
267
268function initToTopBtn() {
269  const btn = document.getElementById('to-top-btn');
270  const activeClass = '_active';
271  const showOffset = window.innerHeight / 3;
272
273  const scrollHandler = (e) => {
274    const scrolled = window.pageYOffset;
275
276    if (scrolled >= showOffset) {
277      btn.classList.add(activeClass);
278    } else {
279      btn.classList.remove(activeClass);
280    }
281  }
282  const scrollToTop = (e) => {
283    e.preventDefault();
284
285    window.scrollTo({
286      left: 0,
287      top: 0,
288      behavior: 'smooth',
289    })
290  }
291
292  window.addEventListener('scroll', scrollHandler);
293  btn.addEventListener('click', scrollToTop);
294
295  scrollHandler();
296}

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.