PageSourceSearch

https://teslaweld.com/catalog/view/theme/fastor/js/compare.js

js teslaweld.com collected 2026-10-09 00:20:49 UTC 15,070 bytes, 230 lines download raw bytes

1let compare = {
2    'add': function (product_id) {
3        if (+($('#compare_quantity').text()) < 4){
4            $.ajax({
5                url: 'index.php?route=product/compare/add',
6                type: 'post',
7                data: 'product_id=' + product_id,
8                dataType: 'json',
9                success: function (json) {
10                    console.log(json['total'])
11                    console.log(json['count'])
12                    if (json['success']) {
13                        $.notify({
14                            message: json['success'],
15                            target: '_blank'
16                        }, {
17                            // settings
18                            element: 'body',
19                            type: 'info',
20                            allow_dismiss: true,
21                            newest_on_top: true,
22                            placement: {
23                                from: 'top',
24                                align: 'right'
25                            },
26                            offset: 20,
27                            spacing: 10,
28                            z_index: 2031,
29                            delay: 5000,
30                            timer: 500,
31                            url_target: '_blank',
32                            mouse_over: null,
33                            animate: {
34                                enter: 'fadeInDown',
35                                exit: 'fadeOutUp'
36                            },
37                            onShow: null,
38                            onShown: null,
39                            onClose: null,
40                            onClosed: null,
41                            icon_type: 'class',
42                            // template: '<div data-notify="container" class="compare-notify alert alert-success" role="alert">' +
43                            //     '<button type="button" aria-hidden="true" class="icon-times-solid close" data-notify="dismiss"></button>' +
44                            //     '<span class="d-flex align-items-center mb-3" data-notify="message"><i class="icon-check mr-2"></i><span>{2}</span></span>' +
45                            //     '<div class="progress" data-notify="progressbar">' +
46                            //     '<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' +
47                            //     '</div>' +
48                            //     '</div>'
49                            template: '<div data-notify="container" class="compare-notify d-flex align-items-center justify-content-center  alert alert-success text-black" role="alert">' +
50                                '<span class="d-flex align-items-center" data-notify="message"><i class="icon-check mr-2 rounded-circle"></i><span>{2}</span></span>' +
51                                '</div>'
52                        })
53//                        $('.compare-count').html(json['count'])
54                   					$('#compare_quantity').html(json['count']);
55
56                    }
57                }
58            })
59        }
60        else{
61            $.notify({
62                message: 'Максимальное количество товаров <br>не более 4',
63            }, {
64                // settings
65                element: 'body',
66                placement: {
67                    from: 'top',
68                    align: 'center'
69                },
70                offset: 20,
71                spacing: 10,
72                z_index: 2031,
73                delay: 5000,
74                timer: 500,
75                animate: {
76                    enter: 'fadeInDown',
77                    exit: 'fadeOutUp'
78                },
79                // template: '<div data-notify="container" class="col-12 col-sm-8 col-lg-6 col-xl-5 alert alert-danger" role="alert">' +
80                //     '<button type="button" aria-hidden="true" class="icon-times-solid close" data-notify="dismiss"></button>' +
81                //     '<span class="d-flex align-items-center mb-3" data-notify="message"><i class="icon-check mr-2"></i><span>{2}</span></span>' +
82                //     '<div class="progress" data-notify="progressbar">' +
83                //     '<div class="progress-bar progress-bar-striped progress-bar-animated bg-danger" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' +
84                //     '</div>' +
85                //     '</div>'
86
87                template: '<div data-notify="container" class="compare-notify d-flex align-items-center max-value justify-content-center alert alert-danger" role="alert">
87' +
88                    '<span class="d-flex align-items-center justify-content-center text-center px-2" style="line-height: 1" data-notify="message">{2}</span>' +
89                    '</div>'
90            })
91        }
92    },
93    'remove': function () {
94    }
95}
96/*
97!function (t) {'function' == typeof define && define.amd ? define(['jquery'], t) : t('object' == typeof exports ? require('jquery') : jQuery)}(function (t) {
98    function e (e, i, n) {
99        var i = {
100            content: {
101                message: 'object' == typeof i ? i.message : i,
102                title: i.title ? i.title : '',
103                icon: i.icon ? i.icon : '',
104                url: i.url ? i.url : '#',
105                target: i.target ? i.target : '-'
106            }
107        }
108        n = t.extend(!0, {}, i, n), this.settings = t.extend(!0, {}, s, n), this._defaults = s, '-' == this.settings.content.target && (this.settings.content.target = this.settings.url_target), this.animations = {
109            start: 'webkitAnimationStart oanimationstart MSAnimationStart animationstart',
110            end: 'webkitAnimationEnd oanimationend MSAnimationEnd animationend'
111        }, 'number' == typeof this.settings.offset && (this.settings.offset = { x: this.settings.offset, y: this.settings.offset }), this.init()
112    }
113
114    var s = {
115        element: 'body',
116        position: null,
117        type: 'info',
118        allow_dismiss: !0,
119        newest_on_top: !1,
120        placement: { from: 'top', align: 'right' },
121        offset: 20,
122        spacing: 10,
123        z_index: 2031,
124        delay: 5e3,
125        timer: 1e3,
126        url_target: '_blank',
127        mouse_over: null,
128        animate: { enter: 'animated fadeInDown', exit: 'animated fadeOutUp' },
129        onShow: null,
130        onShown: null,
131        onClose: null,
132        onClosed: null,
133        icon_type: 'class',
134        template: '<div data-notify="container" class="col-xs-11 col-sm-4 alert alert-{0}" role="alert"><button type="button" aria-hidden="true" class="close" data-notify="dismiss">&times;</button><span data-notify="icon"></span> <span data-notify="title">{1}</span> <span data-notify="message">{2}</span><div class="progress" data-notify="progressbar"><div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div></div><a href="{3}" target="{4}" data-notify="url"></a></div>'
135    }
136    String.format = function () {
137        for (var t = arguments[0], e = 1; e < arguments.length; e++) t = t.replace(RegExp('\\{' + (e - 1) + '\\}', 'gm'), arguments[e])
138        return t
139    }, t.extend(e.prototype, {
140        init: function () {
141            var t = this
142            this.buildNotify(), this.settings.content.icon && this.setIcon(), '#' != this.settings.content.url && this.styleURL(), this.placement(), this.bind(), this.notify = {
143                $ele: this.$ele,
144                update: function (e, s) {
145                    switch (e) {
146                        case'type':
147                            this.$ele.removeClass('alert-' + t.settings.type), this.$ele.find('[data-notify="progressbar"] > .progress-bar').removeClass('progress-bar-' + t.settings.type), t.settings.type = s, this.$ele.addClass('alert-' + s).find('[data-notify="progressbar"] > .progress-bar').addClass('progress-bar-' + s)
148                            break
149                        case'icon':
150                            var i = this.$ele.find('[data-notify="icon"]')
151                            'class' == t.settings.icon_type.toLowerCase() ? i.removeClass(t.settings.content.icon).addClass(s) : (i.is('img') || i.find('img'), i.attr('src', s))
152                            break
153                        case'url':
154                            this.$ele.find('[data-notify="url"]').attr('href', s)
155                            break
156                        case'target':
157                            this.$ele.find('[data-notify="url"]').attr('target', s)
158                            break
159                        default:
160                            this.$ele.find('[data-notify="' + e + '"]').html(s)
161                    }
162                    var n = this.$ele.outerHeight() + parseInt(t.settings.spacing) + parseInt(t.settings.offset.y)
163                    t.reposition(n)
164                },
165                close: function () {t.close()}
166            }
167        },
168        buildNotify: function () {
169            var e = this.settings.content
170            this.$ele = t(String.format(this.settings.template, this.settings.type, e.title, e.message, e.url, e.target)), this.$ele.attr('data-notify-position', this.settings.placement.from + '-' + this.settings.placement.align), this.settings.allow_dismiss || this.$ele.find('[data-notify="dismiss"]').css('display', 'none'), this.settings.delay <= 0 && this.$ele.find('[data-notify="progressbar"]').remove()
171        },
172        setIcon: function () {'class' == this.settings.icon_type.toLowerCase() ? this.$ele.find('[data-notify="icon"]').addClass(this.settings.content.icon) : this.$ele.find('[data-notify="icon"]').is('img') ? this.$ele.find('[data-notify="icon"]').attr('src', this.settings.content.icon) : this.$ele.find('[data-notify="icon"]').append('<img src="' + this.settings.content.icon + '" alt="Notify Icon" />')},
173        styleURL: function () {
174            this.$ele.find('[data-notify="url"]').css({
175                backgroundImage: 'url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)',
176                height: '100%',
177                left: '0px',
178                position: 'absolute',
179                top: '0px',
180                width: '100%',
181                zIndex: this.settings.z_index + 1
182            }), this.$ele.find('[data-notify="dismiss"]').css({ position: 'absolute', right: '10px', top: '5px', zIndex: this.settings.z_index + 2 })
183        },
184        placement: function () {
185            var e = this, s = this.settings.offset.y, i = {
186                display: 'inline-block',
187                margin: '0px auto',
188                position: this.settings.position ? this.settings.position : 'body' === this.settings.element ? 'fixed' : 'absolute',
189                transition: 'all .5s ease-in-out',
190                zIndex: this.settings.z_index
191            }, n = !1, a = this.settings
192            switch (t('[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])').each(function () {return s = Math.max(s, parseInt(t(this).css(a.placement.from)) + parseInt(t(this).outerHeight()) + parseInt(a.spacing))}), 1 == this.settings.newest_on_top && (s = this.settings.offset.y), i[this.settings.placement.from] = s + 'px', this.settings.placement.align) {
193                case'left':
194                case'right':
195                    i[this.settings.placement.align] = this.settings.offset.x + 'px'
196                    break
197                case'center':
198                    i.left = 0, i.right = 0
199            }
200            this.$ele.css(i).addClass(this.settings.animate.enter), t(this.settings.element).append(this.$ele), 1 == this.settings.newest_on_top && (s = parseInt(s) + parseInt(this.settings.spacing) + this.$ele.outerHeight(), this.reposition(s)), t.isFunction(e.settings.onShow) && e.settings.onShow.call(this.$ele), this.$ele.one(this.animations.start, function () {n = !0}).one(this.animations.end, function () {t.isFunction(e.settings.onShown) && e.settings.onShown.call(this)}), setTimeout(function () {n || t.isFunction(e.settings.onShown) && e.settings.onShown.call(this)}, 600)
201        },
202        bind: function () {
203            var e = this
204            if (this.$ele.find('[data-notify="dismiss"]').on('click', function () {e.close()}), this.$ele.mouseover(function () {t(this).data('data-hover', 'true')}).mouseout(function () {t(this).data('data-hover', 'false')}), this.$ele.data('data-hover', 'false'), this.settings.delay > 0) {
205                e.$ele.data('notify-delay', e.settings.delay)
206                var s = setInterval(function () {
207                    var t = parseInt(e.$ele.data('notify-delay')) - e.settings.timer
208                    if ('false' === e.$ele.data('data-hover') && 'pause' == e.settings.mouse_over || 'pause' != e.settings.mouse_over) {
209                        var i = (e.settings.delay - t) / e.settings.delay * 100
210                        e.$ele.data('notify-delay', t), e.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow', 100).css('width', '100%')
211                    }
212                    t <= -e.settings.timer && (clearInterval(s), e.close())
213                }, e.settings.timer)
214            }
215        },
216        close: function () {
217            var e = this, s = parseInt(this.$ele.css(this.settings.placement.from)), i = !1
218            this.$ele.data('closing', 'true').addClass(this.settings.animate.exit), e.reposition(s), t.isFunction(e.settings.onClose) && e.settings.onClose.call(this.$ele), this.$ele.one(this.animations.start, function () {i = !0}).one(this.animations.end, function () {t(this).remove(), t.isFunction(e.settings.onClosed) && e.settings.onClosed.call(this)}), setTimeout(function () {i || (e.$ele.remove(), e.settings.onClosed && e.settings.onClosed(e.$ele))}, 600)
219        },
220        reposition: function (e) {
221            var s = this, i = '[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])',
222                n = this.$ele.nextAll(i)
223            1 == this.settings.newest_on_top && (n = this.$ele.prevAll(i)), n.each(function () {t(this).css(s.settings.placement.from, e), e = parseInt(e) + parseInt(s.settings.spacing) + t(this).outerHeight()})
224        }
225    }), t.notify = function (t, s) {
226        var i = new e(this, t, s)
227        return i.notify
228    }, t.notifyDefaults = function (e) {return s = t.extend(!0, {}, s, e)}, t.notifyClose = function (e) {'undefined' == typeof e || 'all' == e ? t('[data-notify]').find('[data-notify="dismiss"]').trigger('click') : t('[data-notify-position="' + e + '"]').find('[data-notify="dismiss"]').trigger('click')}
229})
230*/

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.