PageSourceSearch

https://www.samaterials.es/js/inquiry.js?v=1788571303

js samaterials.es collected 2026-10-02 20:47:05 UTC 6,545 bytes, 163 lines download raw bytes

1
2$(function () {
3    // 确保inquiry.js内的js 只加载一次
4    if (window.inquiryOnce){
5        return
6    }
7    window.inquiryOnce = true;
8    var pageIndex = 1;
9    var pageSize = 999;
10    var isLoading = false;
11    var isFirstLoad = true; // 新增变量,标识是否是首次加载
12    var isFirstLoads = false;
13    $(".select-dropdown").click(function () {
14        var dropdown = $(this)
15        var ul = dropdown.children('ul');
16        var p = dropdown.find('p')
17        // 如果为二级下拉
18        if (ul.find('ul li').length) {
19            var li = ul.find('ul li')
20        } else {
21            // 一级
22            var li = ul.find('li')
23        }
24
25        var arrows = dropdown.find('.select-arrows')
26        if (ul.css("display") == "none") {
27            ul.slideDown("fast");
28            arrows.css('transform', 'rotate(180deg)')
29        } else {
30            ul.slideUp("fast");
31            arrows.css('transform', 'rotate(0)')
32        }
33
34        li.click(function () {
35            var txt = $(this).text();
36            var firstSelect = $(this).parent().prev().text();
37            p.html(`${firstSelect} ${txt}`);
38            ul.slideUp("fast");
39            arrows.css('transform', 'rotate(0)')
40
41            // 如果选中的是 'Other',则将 select-dropdown 的宽度设置为 50%
42            if ($(this).parent().parent().hasClass('selfSelect')) {
43                if (txt == 'Other') {
44                    dropdown.css('width', '50%');
45                    // 展示 input
46                    dropdown.parent().find('.attribute_input').css('display', 'block');
47                    dropdown.parent().find('.attribute-other-wrap').css('display', 'block');
48                } else {
49                    dropdown.css('width', '100%');
50                    dropdown.parent().find('.attribute_input').css('display', 'none');
51                    dropdown.parent().find('.attribute_input').val('');
52                    dropdown.parent().find('.error-message').text(''); // 移除错误信息
53                    dropdown.parent().find('.attribute-other-wrap').css('display', 'none');
54                }
55            }
56        });
57        dropdown.mouseleave(function () {
58            ul.slideUp("fast");
59            arrows.css('transform', 'rotate(0)')
60        })
61    });
62    $(".select-country>P").data("value","Spain");
63    $(".select-country").click(function () {
64        //防止重复点击
65        if (isLoading)return;
66        var dropdown = $(this);
67        var ul = dropdown.children('ul');
68        var p = dropdown.find('p');
69        var arrows = dropdown.find('.select-arrows');
70
71        // 修改:仅在首次加载时清空现有<li>
72        if (isFirstLoad) {
73            ul.empty();
74            isFirstLoad = false;
75        }
76        if(ul.find('li').length==0){
77            ul.append(`<li class="disable-li"><svg class="icon-loading" aria-hidden="true"> <use xlink:href="#icon-loading"></use> </svg></li>`)
78            isLoading = true;
79            $.ajax({
80                url: Apis.getInquiryCountry,
81                // url: 'https://sam.datasortingcenter.com/getInquiryCountry',
82                type: 'get',
83                data:{
84                    // pageIndex,
85                    // pageSize,
86                    lang: headerVm.languageFlag
87                },
88                success: function (res) {
89                    if (res.code == '200') {
90                        var data = res.msg.length == 2 ? res.msg : [res.msg, res.msg]
91                        ul.empty();
92                        // 遍历数据数组,为每个元素创建一个<li>并添加到<ul>
93                        $.each(data[0], function(index, value) {
94                            var li = $('<li>', { text: data[1][index], 'data-value': value });
95                            ul.append(li);
96                        });
97                        // 数据加载完成,重置isLoading状态
98                        isLoading = false;
99                        isFirstLoads = true
100                    } else {
101                        console.log('错误');
102                    }
103                },
104                error: function () {
105                    // 错误处理
106                    isLoading = false;
107                }
108            });
109        }
110
111        if (ul.css("display") == "none") {
112            ul.slideDown("fast");
113            arrows.css('transform', 'rotate(180deg)')
114        } else {
115            ul.slideUp("fast");
116            arrows.css('transform', 'rotate(0)')
117        }
118
119        ul.on('click', 'li', function () {
120            var txt = $(this).text();
121            console.log(txt, "@@@", $(this).data('value'));
122            p.html(`${txt}`);
123            p.data('value', $(this).data('value'))
124            ul.slideUp("fast");
125            arrows.css('transform', 'rotate(0)')
126            dropdown.closest('.form-item').removeClass('is-error').find('.field-error').text('');
127
128        });
129        dropdown.mouseleave(function () {
130            ul.slideUp("fast");
131            arrows.css('transform', 'rotate(0)');
132        });
133    });
134    // 添加滚动到底部加载更多数据的事件监听
135    // $(".scrollable-list").on('scroll', function() {
136    //     if ($(this).scrollTop() + $(this).innerHeight() >= this.scrollHeight && !isLoading) {
137    //         isLoading = true;
138    //         pageIndex++; // 页面索引递增
139
140    //         // 发送新的Ajax请求获取下一页数据
141    //         $.ajax({
142    //             url: 'https://sam.datasortingcenter.com/getInquiryCountry?pageIndex=' + pageIndex + '&pageSize=' + pageSize,
143    //             type: 'get',
144    //             success: function (res) {
145    //                 if (res.code == '200') {
146    //                     var newData = res.msg;
147    //                     // 直接追加新数据到现有的<ul>
148    //                     $.each(newData, function(index, value) {
149    //                         var li = $('<li>', { text: value });
150    //                         $('ul.scrollable-list').append(li);
151    //                     });
152    //                     isLoading = false;
153    //                 } else {
154    //                     console.log('错误');
155    //                 }
156    //             },
157    //             error: function() {
158    //                 isLoading = false;
159    //             }
160    //         });
161    //     }
162    // });
163})

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.