PageSourceSearch

https://thebiyik.com/wp-content/themes/newspaperup/js/custom.js?ver=7.1.2

js thebiyik.com collected 2026-09-30 13:01:16 UTC 10,465 bytes, 333 lines download raw bytes

1(function($) {
2  "use strict";
3  /* =================================
4  ===     Widget Slider        ====
5  =================================== */
6  function initializeSwiper(selector, desktopView = 1, tabletView = 1, mobileView = 1) {
7    var swiper = new Swiper(selector, {
8      direction: 'horizontal',
9      loop: true,
10      autoplay: {
11        delay: 3000,
12      },
13      speed: 500,
14      slidesPerView: desktopView, // Default for desktop
15      // Navigation arrows
16      navigation: {
17        nextEl: '.swiper-button-next',
18        prevEl: '.swiper-button-prev',
19      },
20      breakpoints: {
21        240: {
22          slidesPerView: mobileView,
23          spaceBetween: 0,
24        },
25        640: {
26          slidesPerView: mobileView,
27          spaceBetween: 0,
28        },
29        768: {
30          slidesPerView: tabletView,
31          spaceBetween: 10,
32        },
33        991: {
34          slidesPerView: desktopView,
35          spaceBetween: 24,
36        },
37      }
38    });
39  }
40  initializeSwiper('.wigethomemain');
41  initializeSwiper('.homemain');
42  initializeSwiper('.featured_cat_slider');
43  initializeSwiper('.colmnthree',3,2,1);
44  
45  /* =================================
46  ===         Tiker SLIDER         ====
47  =================================== */
48  function newspaperupTicker() {
49    var swiper = new Swiper(".bs-latest-news-slider.swipe", {
50      direction: "vertical",
51      slidesPerView: 1,
52      loop: true,
53      autoplay: {
54        delay: 3000,
55      }, 
56      speed:1000,
57    });
58  }
59  newspaperupTicker();
60
61  /* =================================
62  ===         SCROLL TOP       ====
63  =================================== */
64  var scrollToTopBtn = document.querySelector(".bs_upscr");
65  var rootElement = document.documentElement;
66  
67  function handleScroll() {
68    
69    // Do something on scroll
70    var scrollTotal = rootElement.scrollHeight - rootElement.clientHeight;
71    if (rootElement.scrollTop / scrollTotal > 0.05) {
72      // Show button
73      scrollToTopBtn.classList.add("showBtn");
74    } else {
75      // Hide button
76      scrollToTopBtn.classList.remove("showBtn");
77    }
78  }
79  
80  function scrollToTop(event) {
81    // Scroll to top logic
82    event.preventDefault();
83    rootElement.scrollTo({
84      top: 0,
85      behavior: "smooth"
86    });
87  }
88  if (scrollToTopBtn) {
89    scrollToTopBtn.addEventListener("click", scrollToTop);
90    document.addEventListener("scroll", handleScroll);
91  }
92
93  /* =================================
94  ===         STICKY HEADER       ====
95  =================================== */
96  document.addEventListener('DOMContentLoaded', function () {
97    let stickyHeader = document.querySelector(".bs-menu-full.sticky-header");
98    if(stickyHeader) {
99      let scrollDownElement = stickyHeader.offsetTop;
100
101      window.addEventListener("scroll", function () {
102        if (window.scrollY > scrollDownElement) {
103          stickyHeader.classList.add("header-sticky");
104        } else {
105          stickyHeader.classList.remove("header-sticky");
106        }
107      }
108      );
109    }
110  });
111  
112  var elements = document.getElementsByClassName('bs-sticky');
113
114  for (var i = 0; i < elements.length; i++) {
115    new hcSticky(elements[i], {
116      stickTo: elements[i].parentNode,
117      top: 0,
118      bottomEnd: 0,
119    });
120  }
121 
122  jQuery(document).ready(function() {
123    jQuery('.sm').smartmenus({
124      subMenusSubOffsetX: 1,
125      subMenusSubOffsetY: -8
126    });
127  });
128  
129  /*---------------------------------------
130    Off Canvas           
131  -----------------------------------------*/
132  let clickableAddElementRight = document.querySelector('[bs-data-clickable-end]');
133  let clickableRemoveElement = document.querySelector('[bs-data-removable]');
134  let clickableRemoveElementTwo = document.querySelector('[bs-remove-overlay]');
135  let targetElement = document.querySelector('[bs-data-targeted]'); 
136  let targetBody = document.querySelector('body'); 
137
138  // Function to handle the click event
139  function handleClickRight() { 
140    targetElement.classList.add('from-right'); 
141    clickableRemoveElementTwo.classList.add('show'); 
142    targetBody.style.overflow = 'hidden';
143    targetBody.style.paddingRight = '17px';
144    clickableRemoveElement.focus();
145  }
146  function handleClickRemove(event) {
147    event.preventDefault();
148    targetElement.classList.remove('from-right');
149    clickableRemoveElementTwo.classList.remove('show'); 
150    targetBody.style.overflow = null;
151    targetBody.style.paddingRight = null;
152    clickableAddElementRight.focus();
153  }
154
155  // Attach the handleClick function to the click event of the clickable element
156  if( (clickableAddElementRight !== null) && (clickableAddElementRight !== undefined)) {
157    clickableAddElementRight.addEventListener('click', handleClickRight);
158  }
159  clickableRemoveElement.addEventListener('click', handleClickRemove);
160  clickableRemoveElementTwo.addEventListener('click', handleClickRemove);
161
162
163  /* =================================
164  ===        Featured Tabs  ====
165  =================================== */
166  function featuredTabsWidget() {
167    document.querySelectorAll('.tab-wrapper').forEach(container => {
168      const tabButtons = container.querySelectorAll('.tab-button');
169      const tabContents = container.querySelectorAll('.tab-content');
170
171      tabButtons.forEach((button, index) => {
172        button.addEventListener('click', function () {
173          tabButtons.forEach(btn => btn.classList.remove('active'));
174          tabContents.forEach(tab => tab.style.display = 'none');
175          tabContents[index].style.display = 'block';
176          button.classList.add('active');
177        });
178      });
179
180      // Initialize first tab as active
181      tabButtons[0].classList.add('active');
182      tabContents[0].style.display = 'block';
183    });
184  }
185  featuredTabsWidget();
186
187  /*---------------------------------------
188    Search           
189  -----------------------------------------*/
190  let clickAddElementSearch = document.querySelector('[bs-search-clickable]');
191  let targetSerachElement = document.querySelector('[bs-search-targeted]'); 
192  let targetHideSerach = document.querySelector('[bs-dismiss-search]'); 
193
194  // Function to handle the click event
195  function openSearch(event) {
196    // Scroll to top logic
197    event.preventDefault();
198    clickableRemoveElementTwo.classList.add('show');
199    targetSerachElement.classList.add('show-search');
200    targetBody.style.overflow = 'hidden'; 
201    targetBody.style.paddingRight = '17px';
202    document.querySelector('.search-popup-content form .search-field').focus();
203  }
204  function hideSearch() {
205    clickableRemoveElementTwo.classList.remove('show'); 
206    targetSerachElement.classList.remove('show-search');
207    targetBody.style.overflow = null;
208    targetBody.style.paddingRight = null;
209    clickAddElementSearch.focus();
210  }
211  if(clickAddElementSearch){
212    clickAddElementSearch.addEventListener('click', openSearch);
213  }
214  // clickableRemoveElementTwo.addEventListener('click', hideSearch);
215  targetHideSerach.addEventListener('click', hideSearch);
216
217
218  $(document).ready(function(){
219    $(".menu-btn").click(function() {
220      console.log('yes');
221      $(this).toggleClass("on");
222      $("#main-nav").slideToggle();
223      $("#menu-header-menu").css("transition", "all 0.8s");
224    });
225  });
226
227  function addKeydownListener() {
228    document.addEventListener('keydown', keydownHandler);
229  }
230
231  function removeKeydownListener() {
232    document.removeEventListener('keydown', keydownHandler);
233  }
234
235  function keydownHandler(event) {
236    if (event.key === 'Tab') {
237      var focusedElement = document.activeElement;
238      var parentElement = document.getElementById('main-nav');
239      var ulParent = parentElement.querySelector("ul.sm.sm-clean");
240      var lastChild = ulParent.lastElementChild.firstElementChild;
241
242      // Check if the focused element is the last child
243      if (focusedElement === lastChild) {
244        // Prevent the default tab behavior
245        event.preventDefault();
246
247        // Perform your actions here
248        const returnFocus = document.querySelector('button.menu-btn');
249        returnFocus.click();
250        returnFocus.focus();
251      }
252    }
253  }
254
255  function checkWindowSize() {
256    if (window.innerWidth < 992) {
257      addKeydownListener();
258    } else {
259      removeKeydownListener();
260      document.getElementById('main-nav').style.display = '';
261    }
262  }
263
264  // Check window size on initial load
265  checkWindowSize();
266
267  // Check window size on resize
268  window.addEventListener('resize', checkWindowSize);
269
270  function applyTabNavigation(selector) {
271		$(document).ready(function() {
272			$(selector).each(function() {
273				var $capture = $(this);
274
275				$capture
276				.attr('tabindex', '-1')
277				.focus()
278				.keydown(function handleKeydown(event) {
279					if (event.key.toLowerCase() !== 'tab') {
280						return;
281					}
282					var tabbable = $()
283					.add($capture.find('button, input, select, textarea'))
284					.add($capture.find('[href]'))
285					.add($capture.find('[tabindex]:not([tabindex="-1"])'));
286
287					var $target = $(event.target);
288
289					if (tabbable.length === 0) {
290						return;
291					}
292					var firstTabbable = tabbable.first();
293					var lastTabbable = tabbable.last();
294					if (event.shiftKey) { 
295						if ($target.is(firstTabbable)) {
296							event.preventDefault();
297							lastTabbable.focus();
298						}
299					} else { 
300						if ($target.is(lastTabbable)) {
301							event.preventDefault();
302							firstTabbable.focus();
303						}
304					}
305				});
306
307				// Ensure focus starts within the container when it's focused
308				$capture.on('focus', function() {
309					var tabbable = $()
310					.add($capture.find('button, input, select, textarea'))
311					.add($capture.find('[href]'))
312					.add($capture.find('[tabindex]:not([tabindex="-1"])'));
313
314					if (tabbable.length > 0) {
315						tabbable.first().focus();
316					}
317				});
318			});
319		});
320  }
321
322  // Apply to multiple selectors
323  applyTabNavigation('.search-popup');
324  applyTabNavigation('.bs-offcanvas.end');
325    
326  document.addEventListener('DOMContentLoaded', function() {
327    var pageTitle = document.querySelector('.bs-card-box.page-entry-title + .row .page-title');
328    if (pageTitle) {
329      pageTitle.remove();
330    }
331  });
332
333})(jQuery);

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.