PageSourceSearch

https://uk.sduko.com/static/js/theme-library.js

js sduko.com collected 2026-10-03 23:25:42 UTC 8,634 bytes, 252 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function() {
2    var adultCookieName = 'adultCookie'; // The cookie name
3	var cookieName = 'privacyCookie';
4	var cookieLifetime = 2;
5	var _setCookie = function (cname, cvalue, exdays) {
6		var d = new Date();
7		d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
8		var expires = "expires=" + d.toUTCString();
9		document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
10		document.cookie = 'adultCookie' + "=" + cvalue + ";" + expires + ";path=/";	
11
12	}	
13
14	var _getCookie = function (cname) {
15		var name = cname + "=";
16		var ca = document.cookie.split(';');
17		for (var i = 0; i < ca.length; i++) {
18			var c = ca[i];while (c.charAt(0) == ' ') {
19				c = c.substring(1); }if (c.indexOf(name) == 0) {
20					return c.substring(name.length, c.length);
21				}}
22				return "";	
23
24	}
25	var _shouldShowPopup = function () {
26		if(_getCookie(cookieName)) {
27			return false;
28		}else{ 
29			return true; 
30		}
31	}
32	if(_shouldShowPopup()) {
33		$('#privacyPolicyModal').modal('show');		
34        $('#cookieBannerV2').show();
35	}
36	$('.cookiesSecondry').on('click', function () {
37		_setCookie(cookieName, 1, cookieLifetime);
38		_setCookie(adultCookieName, 1, cookieLifetime);
39		$('#cookieBannerV2').hide();
40	});   
41
42    $('.hiddenCB input[type="checkbox"]').change(function () {
43        var $group = $(this).closest(".accordion");
44        var count = $group.find('input[type="checkbox"]:checked').length;
45        var $countSpan = $group.find(".count");
46        $countSpan.text(count);
47        if (count === 0) {
48            $countSpan.text("");
49        } else {
50            $countSpan.text(count);
51        }
52    });
53    $("#resetBtn").click(function () {
54        $('.hiddenCB input[type="checkbox"]').prop("checked", false);
55        $(".count").text("");
56    }); 
57    $("#show-more-content").hide();
58    $("#show-more").click(function () {
59        $("#show-more-content").show();
60        $("#show-less").show();
61        $("#show-more").hide();
62    });
63
64    $("#show-less").click(function () {
65        $("#show-more-content").hide();
66        $("#show-more").show();
67        $(this).hide();
68    }); 
69
70    // Get country list for search filter
71    fetch('/static/js/nationalities.json')
72    .then(response => {
73        if (!response.ok) {
74            throw new Error('Network response was not ok ' + response.statusText);
75        }
76        return response.json();
77    })
78    .then(data => {
79        const nationalityList = document.getElementById('show-more-content');
80        if (!nationalityList) {
81            // console.warn('Element with ID "show-more-content" not found.');
82            return;
83        }
84        if (!data.nationality_tags_gride || !Array.isArray(data.nationality_tags_gride)) {
85            console.warn('Invalid or missing nationality_tags_gride data.');
86            return;
87        }
88        data.nationality_tags_gride.forEach(nationality => {
89            if (!nationality.id || !nationality.value || !nationality.label) {
90                console.warn('Skipping entry due to missing data:', nationality);
91                return;
92            }
93            const li = document.createElement('li');
94            const checkbox = document.createElement('input');
95            checkbox.setAttribute('type', 'checkbox');
96            checkbox.setAttribute('name', 'search_tag__nationality');
97            checkbox.setAttribute('id', nationality.id);
98            checkbox.setAttribute('value', nationality.value);
99            const label = document.createElement('label');
100            if (nationality.class) {
101                label.setAttribute('class', nationality.class);
102            }
103            label.setAttribute('for', nationality.id);
104            if (nationality.img_src) {
105                const img = document.createElement('img');
106                img.setAttribute('src', nationality.img_src);
107                label.appendChild(img);
108            }
109            label.appendChild(document.createTextNode(nationality.label));
110            li.appendChild(checkbox);
111            li.appendChild(label);
112            nationalityList.appendChild(li);
113        });
114    })
115    .catch(error => console.error('Error fetching JSON:', error));
116
117    // Handle click event telephone listing page
118    $(".item-container .btn-phone").click(function(event) {
119        event.preventDefault();
120        if ($(window).width() > 700) {
121            $(this).addClass('btn-primary-phonedisabled w-auto px-3');
122            $(this).off('click'); 
123            $(this).find('.ads-number-front').text($(this).data('phone'));
124            $(this).attr('href', 'javascript:void(0)'); 
125        } else {
126            window.location.href = 'tel:' + $(this).data('phone');
127        }
128    });
129
130    // Function to check window width and initialize/dispose carousel
131    function checkWidth() {
132        var windowWidth = $(window).width();
133        if (windowWidth < 565) {
134            $('#galleryGrid').addClass('carousel slide').carousel();
135            $('#galleryGrid .gallery-section').addClass('carousel-inner');
136            $('#galleryGrid .gallery-grid').first().addClass('active');
137            $('#galleryGrid .gallery-grid').addClass('carousel-item');
138        } else {
139            $('#galleryGrid.carousel').removeClass('carousel slide').carousel('dispose');
140            $('#galleryGrid .gallery-section').addClass('carousel-inner');
141            $('#galleryGrid .gallery-grid').removeClass('active');
142            $('#galleryGrid .gallery-grid').removeClass('carousel-item');
143        }
144    }
145    checkWidth();
146    $(window).resize(function(){
147        checkWidth();
148    });      
149});
150
151//Detail page go back
152function customGoBack(event, link) {
153    event.preventDefault();
154    const url = link.getAttribute('data-url');
155    if (window.$history && typeof window.$history.goToLastListing === 'function') {
156        window.$history.goToLastListing(url);
157    } else {
158        if (window.history.length > 1) {
159            window.history.back();
160        } else {
161            window.location.href = url; 
162
163        }
164    }
165}
166
167// data-href open page
168document.addEventListener('DOMContentLoaded', function() {
169    $('[data-href]').on('click', function () {
170        var href = $(this).data('href'); 
171        if (href) {            
172            if ($(this).hasClass('open-in-new-tab')) {
173                window.open(href, '_blank'); 
174            } else {
175                window.location.href = href; 
176            }
177        }
178    });
179});
180
181// footer redirect website
182//select value redirect domains(New)
183$(document).ready(function () {
184    $(".country-select").on("change", function () {
185        var selectedUrl = $(this).find("option:selected").data("url");
186        if (selectedUrl) {
187            window.location.href = selectedUrl;
188        }
189    });
190});
191
192// show more and show less nationality list in search 
193const nationalityList = document.querySelector('.nationality-list');
194if (nationalityList) {
195  const showMoreBtn = document.getElementById('show-more');
196  const showLessBtn = document.getElementById('show-less');
197  const listItems = nationalityList.querySelectorAll('li');  
198  function initializeList() {
199    for (let i = 0; i < listItems.length; i++) {
200      if (i < 4) {
201        listItems[i].classList.add('visible-item'); 
202      } else {
203        listItems[i].classList.add('hidden-item');  
204      }
205      
206      if (i >= 11) {
207        listItems[i].classList.add('disable--none-imp');
208      }
209    }
210  }
211  function showMore() {
212    listItems.forEach(item => {
213        if (item.classList.contains('hidden-item')) {
214          item.classList.remove('hidden-item');
215          item.classList.add('visible-item');
216        }
217    });
218    showMoreBtn.style.display = 'none';
219    showLessBtn.style.display = 'inline-block';
220  }
221  function showLess() {
222    for (let i = 4; i < listItems.length; i++) {
223      listItems[i].classList.remove('visible-item');
224      listItems[i].classList.add('hidden-item');
225    }
226    showMoreBtn.style.display = 'inline-block';
227    showLessBtn.style.display = 'none';
228  }
229  showMoreBtn.addEventListener('click', showMore);
230  showLessBtn.addEventListener('click', showLess);  
231  initializeList();
232}
233window.addEventListener('load', () => {
234    $('#new-feature-tourModal').modal('show');
235}); 
236
237
238document.addEventListener('DOMContentLoaded', () => {
239  const modal = document.getElementById('staticBackdrop');
240
241  if (modal) {
242    modal.addEventListener('shown.bs.modal', () => {
243      const images = modal.querySelectorAll('img.countryflagimg');
244      images.forEach(img => {
245        const dataSrc = img.getAttribute('data-src');
246        if (dataSrc) {
247          img.src = dataSrc;
248        }
249      });
250    });
251  }
252});

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.