PageSourceSearch

https://www.4dox.nl/user/templates/static-assets/js/modules/compare.js?build=601

js 4dox.nl collected 2026-09-26 16:41:21 UTC 3,897 bytes, 108 lines download raw bytes

1class Compare {
2
3    constructor() {
4        this.selector = '#modules-compare';
5        this.initCompareShare();
6        this.initHideDuplicates();
7        this.initDragableTable();
8    }
9
10    initCompareShare() {
11        var selector = $(this.selector);
12
13        if (selector.length) {
14
15            selector.find('.share-btn').on('click', function () {
16                if (selector.find('#modules-compare-control-panel .right').is(':visible')) {
17                    selector.find('#modules-compare-control-panel .right').slideUp();
18                } else {
19                    selector.find('#modules-compare-control-panel .right').slideDown();
20                    selector.find('#modules-compare-control-panel .right .copy-input').select();
21                }
22            });
23
24
25            selector.find('.copy-btn').on('click', function () {
26                selector.find('#modules-compare-control-panel .right .copy-input').select();
27                document.execCommand("copy");
28                $(this).attr('data-original-title', $trans['copied']).tooltip('show').one('mouseleave', function () {
29                    $(this).attr('data-original-title', $trans['copy']);
30                });
31            });
32
33        }
34    }
35
36    initHideDuplicates() {
37        var selector = $(this.selector);
38
39        if (selector.length) {
40
41            selector.find('#hide_duplicate').on('change', function () {
42                Spinner('show');
43                var get = Object.fromEntries(new URLSearchParams(location.search));
44
45                if ($(this).prop('checked') === true) {
46                    if (typeof (get.hide_duplicate) === "undefined") {
47                        get.hide_duplicate = 1;
48                    }
49                } else {
50                    if (typeof (get.hide_duplicate) !== "undefined") {
51                        delete get.hide_duplicate;
52                    }
53                }
54                var get_url = jQuery.param(get);
55                if (get_url === "") {
56                    window.location = window.location.pathname;
57                } else {
58                    window.location = window.location.pathname + "?" + get_url;
59                }
60            });
61
62            // Funkce nco skryje stejné parametry
63            if (selector.find('#hide_duplicate').length && selector.find('#hide_duplicate').prop('checked') === true) {
64                selector.find(".hide_row").each(function () {
65                    var hide = true;
66                    var hide_val = false;
67                    $(this).find("td:not(.param)").each(function () {
68                        if (hide_val === false) {
69                            hide_val = $(this).html().trim();
70                        } else {
71                            if ($(this).html().trim() !== hide_val) {
72                                hide = false;
73                            }
74                        }
75                    });
76                    if (hide === true) {
77                        $(this).hide();
78                    }
79                });
80
81            }
82
83        }
84    }
85
86    initDragableTable() {
87        var selector = $(this.selector);
88
89        if (selector.length) {
90            selector.find('#compare-table.dragable').dragableColumns({
91                onDragEnd: function () {
92
93                    var data = new Array();
94                    selector.find('#compare-table [data-productid]').each(function () {
95                        data.push($(this).data("productid"));
96                    });
97
98                    $.post(nody.functions.append_url('/action/compare/save_order/'), {data: data.join(',')}, function (response) {
99                        //console.log(response);
100                    });
101
102                }});
103        }
104    }
105
106}
107
108nody.modules.Compare = new Compare();

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.