PageSourceSearch

https://www.lojaintt.com.br/common/js/popup.js?v=1790252405

js lojaintt.com.br collected 2026-09-26 10:10:29 UTC 3,396 bytes, 161 lines download raw bytes

1var popup = {};
2popup.eventNull = 0;
3popup.eventoLeave = 1;
4popup.eventoOpen = 2;
5popup.showed = false;
6popup.countLeave = 0;
7popup.queueStarted = false;
8popup.queue = [];
9popup.viewedItems = false;
10
11popup.getViewedPopups = function() {
12	const items = helper.getCookie('viewedPopups');
13
14	if (!items) {
15		popup.viewedItems = [];
16		return;
17	}
18
19	popup.viewedItems = JSON.parse(items);
20}
21
22popup.sendPopupToQueue = function(id, showEvent, timeout) {
23	var item = {
24		'id': id,
25		'showEvent': showEvent,
26		'timeout': timeout
27	};
28
29	if (!popup.viewedItems) {
30		popup.getViewedPopups();
31	}
32
33	if (popup.viewedItems.length) {
34		let found = popup.viewedItems.find(item => item == id);
35
36		if (found) {
37			return;
38		}
39	}
40
41	if (item.showEvent == popup.eventoLeave) {
42		popup.addMouseLeaveEventToPopup(item);
43	} else {
44		popup.addToQueue(item);
45	}
46}
47
48popup.addToQueue = function(item) {
49	popup.queue.push(item);
50
51	if (!popup.queueStarted) {
52		if (typeof lazyLoadService == 'undefined') {
53			popup.startShowPopups();
54		} else {
55			lazyLoadService.addFunctionToQueue(popup.startShowPopups);
56		}
57	}
58}
59
60popup.startShowPopups = function() {
61	if (popup.queueStarted) {
62		return;
63	}
64
65	var interval = setInterval(() => {
66		popup.queueStarted = true;
67		if (popup.queue.length < 1) {
68			clearInterval(interval);
69			popup.queueStarted = false;
70			return;
71		}
72
73		if (!popup.showed) {
74			popup.showed = true;
75			popup.showPopupItem(popup.queue.shift());
76		}
77	}, 1000);
78}
79
80popup.addMouseLeaveEventToPopup = function(item) {
81	document.addEventListener("visibilitychange", function() {
82		if(document.hidden){
83			popup.addToQueue(item);
84		}
85	});
86}
87
88popup.showPopupItem = function(item) {
89	if (item.timeout > 0) {
90		setTimeout(popup.loadPopup(item), item.timeout);
91	} else {
92		popup.loadPopup(item);
93	}
94}
95
96popup.showPopup = function(id, showEvent, timeout) {
97	var loadPopup = function(){
98		if (popup.showed === false) {
99			var popupElement = $('.popup .modal[data-id='+id+']');
100			popupElement = popupElement[0];
101			$(popupElement).modal('show');
102			popup.showed = true;
103			var url = $("#urlajax").val()+"/cliente.php?act=popupVisualizado&id="+id;
104			ajax.enqueue(ajax.GET, url);	
105		}
106	};
107
108	if (showEvent == popup.eventNull || showEvent == popup.eventoOpen) {
109		if (timeout > 0) {
110			setTimeout(loadPopup, timeout);
111		} else {
112			loadPopup();
113		}
114	} else if (showEvent == eventoLeave) {
115		$('html').on('mouseleave', function () {
116			if (popup.countLeave == 0) {
117				popup.showed = false;
118				popup.countLeave = 1;
119				if (timeout > 0) {
120					setTimeout(loadPopup, timeout);
121				} else {
122					loadPopup();
123				}
124
125			}
126		});
127	}
128}
129
130popup.loadPopup = function(item) {
131	if(!item || !item.id) {
132		return;
133	}
134
135	var popupElement = $('.popup .modal[data-id=' + item.id + ']');
136	popupElement = popupElement[0];
137	$(popupElement).modal('show');
138
139	if (!window.isCacheable) {
140		var url = $("#urlajax").val()+"/cliente.php?act=popupVisualizado&id=" + item.id;
141		X.get(url);
142	}
143
144	popup.viewedItems.push(item.id);
145	const popupCookie = JSON.stringify(popup.viewedItems);
146
147	var date = new Date();
148	var year  = date.getFullYear();
149	var month = date.getMonth();
150	var day = date.getDate();
151
152	var date = new Date(year, month + 1, day);
153	date = date.toGMTString();
154
155	document.cookie = `viewedPopups=${popupCookie}; expires=${date}; path=/;`;
156
157	$('.modal-open').on('mouseup', function() {
158		popup.showed = false;
159		$('.modal-open').off('mouseup');
160	});
161};

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.