PageSourceSearch

https://arizirk.ru/g/templates/shop2/2.75.2/building-materials/additional_work/shop2_msg/shop2_msg.js

js arizirk.ru collected 2026-10-05 00:15:25 UTC 3,166 bytes, 111 lines download raw bytes

1shop2.options.msgTime = 2000;
2
3shop2.msg = function(text, obj) {
4    var selector = '#shop2-msg',
5        msg = $(selector),
6        offset = obj.offset(),
7        width = obj.outerWidth(true),
8        height = obj.outerHeight(true);
9
10    if (!msg.get(0)) {
11        msg = $('<div id="shop2-msg">');
12        $(document.body).append(msg);
13        msg = $(selector);
14    }
15
16    msg.html(text).fadeIn(150);
17
18    var msgWidth = msg.outerWidth();
19    var msgHeight = msg.outerHeight();
20    var left = offset.left + width;
21    var top = offset.top + height;
22
23    if (left + msgWidth > $(window).width()) {
24        left = offset.left - msgWidth;
25    }
26
27    msg.css({
28        left: 50 + '%',
29        top: 50 + '%',
30        'position': 'fixed',
31        'margin-left': msgWidth / 2 * -1,
32        'margin-top': msgHeight / 2 * -1
33    });
34
35    var msgTimeOut;
36
37    msgTimeOut = setTimeout(function() {
38        msg.fadeOut(150);
39    }, shop2.options.msgTime);
40
41    msg.mouseover(function() {
42        clearTimeout(msgTimeOut);
43    });
44
45    msg.mouseleave(function() {
46        msgTimeOut = setTimeout(function() {
47            msg.fadeOut(150);
48        }, shop2.options.msgTime);
49    });
50
51    $(document).on('click', '#shop2-msg', function() {
52        clearTimeout(msgTimeOut);
53        $(this).fadeOut(150);
54    });
55};
56
57
58shop2.queue.compare = function() {
59
60	var $document = $(document);
61	if ($('html').attr('lang') == 'ru') {
62		var compareBtn = '<a href="' + shop2.uri + '/compare" target="_blank">к сравнению</a>';
63		var compareBtn2 = '<a href="' + shop2.uri + '/compare" class="go-to-compare-btn" target="_blank">Перейти к сравнению</a>';
64	} else {
65		var compareBtn = '<a href="' + shop2.uri + '/compare" target="_blank">сompare</a>';
66		var compareBtn2 = '<a href="' + shop2.uri + '/compare" class="go-to-compare-btn" target="_blank">Compare</a>';
67	};
68
69	function update(el, res) {
70
71		$('input[type=checkbox][value=' + el.val() + ']').closest('.product-compare').replaceWith(res.data);
72		$('.product-compare-added a span').html(res.count);
73
74		if ($('html').attr('lang') == 'ru') {
75			shop2.msg('Товар добавлен ' + compareBtn + '&nbsp;&nbsp;' + res.count, $('body'));
76		} else {
77			shop2.msg('Added to ' + compareBtn + '&nbsp;&nbsp;' + res.count, $('body'));
78		};
79
80		if (res.panel) {
81			$('#shop2-panel').replaceWith(res.panel);
82		};
83
84	}
85
86	$document.on('click', '.product-compare input:checkbox', function() {
87		var $this = $(this),
88			action = $this.attr('checked') ? 'del' : 'add';
89			
90		shop2.compare.action(action, $this.val(), function(res, status) {
91			if (status == 'success') {
92				
93				if (res.errstr) {
94					shop2.msg(res.errstr + '&nbsp;<br>' + compareBtn2, $('body'));
95					$this.prop('checked', false);
96				} else {
97					update($this, res);
98					
99					if (action == 'del') {
100						if ($('html').attr('lang') == 'ru') {
101							shop2.msg('Товар удален из сравнения', $('body'));
102						} else {
103							shop2.msg('Product removed from comparison', $('body'));
104						};
105					}
106				}
107			}
108		});
109	});
110
111};

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.