PageSourceSearch

https://discount-tools.ru/local/templates/elektro_flat/script.js

js discount-tools.ru collected 2026-10-08 06:36:28 UTC 6,636 bytes, 227 lines download raw bytes

1function adjustItemHeight(item) {
2	var maxHeight = 0;
3	item.css("height", "auto");
4	item.each(function() {
5		if($(this).height() > maxHeight) {
6			maxHeight = $(this).height();
7		}
8	});
9	item.height(maxHeight);
10}
11
12$(function(){
13	$(".close").live("click", function() {
14		CloseModalWindow("#addItemInCart")
15	});
16	$(document).keyup(function(event){
17		if(event.keyCode == 27) {
18			CloseModalWindow("#addItemInCart")
19		}
20	});
21});
22
23function CentriredModalWindow(ModalName){
24	$(window).resize(function () {
25		modalHeight = ($(window).height() - $(ModalName).height()) / 2;
26		$(ModalName).css({
27			'top': modalHeight + 'px'
28		});
29	});
30	$(window).resize();
31}
32
33function OpenModalWindow(ModalName){
34	$(ModalName).fadeIn(300);	
35	$("#bgmod").fadeIn(300);
36}
37
38function CloseModalWindow(ModalName){
39	$("#bgmod").fadeOut(300);
40	$(ModalName).fadeOut(300);	
41}
42
43function refreshCartLine(result, disabled) {
44	disabled = disabled || false;	
45
46	var basketCont, sumOld, sumCurr;
47	
48	basketCont = $(".cart_line");
49	
50	basketCont.find(".qnt").text($(result).find(".qnt").text());
51	
52	basketCont.find(".sum").data("decimal", $(result).find(".sum").data("decimal"));
53	
54	sumOld = basketCont.find(".sum").data("sum");						
55	basketCont.find(".sum").data("sum", $(result).find(".sum").data("sum"));
56	sumCurr = basketCont.find(".sum").data("sum");
57	
58	if(sumCurr != sumOld) {
59		var options = {
60			useEasing: false,
61			useGrouping: true,
62			separator: basketCont.find(".sum").data("separator"),
63			decimal: basketCont.find(".sum").data("dec-point")
64		}
65		var counter = new countUp("cartCounter", sumOld, sumCurr, basketCont.find(".sum").data("decimal"), 0.5, options);
66		counter.start();
67	}
68	
69	if(disabled != true)
70		basketCont.find(".oformit_cont").html($(result).find(".oformit_cont").html());	
71}
72
73function addToCompare(href, btn, site_dir) {
74	$.ajax({
75		type: "POST",
76		url: href,
77		success: function(html){			
78			$.post(site_dir + "ajax/compare_line.php", function(data) {
79				$(".compare_line").replaceWith(data);
80			});
81			$("#" + btn).removeClass("catalog-item-compare").addClass("catalog-item-compared").removeAttr("onclick").css({"cursor": "default"});
82		}
83	});
84	return false;
85}
86
87function addToDelay(id, qnt_cont, props, select_props, btn, site_dir, dsbl) {
88	dsbl = dsbl || false;
89	$.ajax({
90		type: "POST",
91		url: site_dir + "ajax/add2delay.php",
92		data: "id=" + id + "&qnt=" + $("#" + qnt_cont).val() + "&props=" + props + "&select_props=" +select_props,
93		success: function(html){
94			$.post(site_dir + "ajax/delay_line.php", function(data) {
95				$(".delay_line").replaceWith(data);
96			});
97			$.post(site_dir + "ajax/basket_line.php", function(data) {
98				refreshCartLine(data, dsbl);				
99			});			
100			$("#" + btn).removeClass("catalog-item-delay").addClass("catalog-item-delayed").removeAttr("onclick").css({"cursor": "default"});
101		}
102	});
103	return false;
104}
105
106// Ðàñêðûâàåì ôèëüòðû. 
107// Îñòàâëÿåì ïàðàìåòðû "Ðîçíè÷íàÿ öåíà" è "Ïðîèçâîäèòåëü" îñòàëüíîå ñêðûâàåì è äîáàâëÿåì ññûëêó "Ïîêàçàòü âñå ïàðàìåòðû".
108// Êëèêàÿ ïî ññûëêå ðàñêðûâàåì âñå îñòàëüíûå ïàðàìåòðû.
109document.addEventListener('DOMContentLoaded', () => {
110    (() => {
111        'use strict';
112        const filterList = document.querySelectorAll('.bx_filter_box');
113
114        if (filterList.length != 0) {
115            init(document.querySelector('.filter table tbody'));
116
117            const btnShowFilter = document.querySelector('.btn__show_filter');
118
119            hideProps(filterList, btnShowFilter);
120
121            btnShowFilter.addEventListener('click', () => {
122                showProps(filterList, btnShowFilter);
123            });
124        }
125
126        function init(parent) {
127            let tr = document.createElement('tr');
128            tr.innerHTML = '<tr style="display: block;"><td colspan="2" style="text-align:center; color:#cd3367; cursor:pointer;"><div class="btn__show_filter">Ïîêàçàòü âñå ïàðàìåòðû</div></td></tr>';
129            parent.append(tr);
130
131            const toogleFilter = document.querySelector('.catalog_item_toogle_filter');
132            if (!toogleFilter.classList.contains('active')) {
133                toogleFilter.classList.add('active');
134                document.querySelector('.filter').style.display = 'block';
135            }
136        }
137
138        function show(elem) {
139            elem.style.display = 'block';
140        }
141        
142        function hide(elem) {
143            elem.style.display = 'none';
144        }
145        
146        function hideProps(boxs, btn) {
147            boxs.forEach(item => {
148                const name = item.children[0].innerText;
149                if (name.indexOf('Ðîçíè÷íàÿ öåíà') == 0 || name.indexOf('Ïðîèçâîäèòåëü') == 0) {
150                    show(item);
151                } else {
152                    hide(item)
153                }     
154            });
155            
156            if(btn) {
157                btn.classList = 'btn__show_filter';
158                btn.innerText = 'Ïîêàçàòü âñå ïàðàìåòðû';
159                btn.addEventListener('click', () => {
160                    showProps(boxs, btn);
161                });
162            }
163        }
164        
165        function showProps(boxs, btn) {
166            boxs.forEach(item => {
167                if (item.style.display == 'none') {
168                    show(item);
169                }
170            });
171
172            btn.classList = 'btn__hide_filter';
173            btn.innerText = 'Ñêðûòü ïàðàìåòðû';
174
175            btn.addEventListener('click', () => {
176                hideProps(boxs, btn);
177            });
178        }
179   
180    })(); 
181});
182
183
184document.addEventListener('DOMContentLoaded', () => {
185    (() => {
186        'use strict';
187		let meta = ''; 
188		let title = '';
189		let catalogDescription = document.querySelector('.catalog_description')
190
191
192	})(); 
193});
194
195
196document.addEventListener("DOMContentLoaded", () => {
197    (() => {
198	// use query selector that matches your class name
199	// you may assign it to a variable; we have used literal here
200	// to make this example more clear.
201	
202		const lazyBackgrounds = [].slice.call(document.querySelectorAll(".lazy-background"));
203
204		if ("IntersectionObserver" in window) {
205			let lazyBackgroundObserver = 
206			new IntersectionObserver(function(entries, observer) {
207				entries.forEach(function(entry) {
208					if (entry.isIntersecting) {
209									
210									// remove the lazy class name
211									// when image enters viewport
212						entry.target.classList.remove("lazy-background");
213						lazyBackgroundObserver.unobserve(entry.target);
214					}
215				});
216			});
217
218			lazyBackgrounds.forEach(function(lazyBackground) {
219				lazyBackgroundObserver.observe(lazyBackground);
220			});
221		} else {
222			lazyBackgrounds.forEach(function(entry) {
223				entry.classList.remove("lazy-background");
224			});
225		}
226	})(); 
227});

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.