PageSourceSearch

https://www.borderstates.com/_ui/responsive/common/js/acc.mtr.js

js borderstates.com collected 2026-10-03 21:43:27 UTC 4,862 bytes, 122 lines download raw bytes

1ACC.mtr={
2
3    _autoload:[
4        ["bindInputChange", $(".js-mtr-search-container").length != 0],
5        ["bindSearchSubmit", $("#MTRSearchFormId").length != 0]
6
7    ],
8
9    bindSearchSubmit: function() {
10        $(document).on('click', '#mtrSortColumn', function (e) {
11
12            e.preventDefault();
13            // window.history.replaceState(null, document.title, $(this).attr('href'));
14            ACC.mtr.submitSearch($(this).attr('href'))
15        });
16        $( document ).ready(function() {
17            var url = location.search;
18            if (url != ""){
19                ACC.mtr.getDataSubmitSearchSearch($("#MTRSearchFormId"))
20            }
21        });
22
23        $("#MTRSearchFormId").submit(function(e) {
24            e.preventDefault(); // avoid to execute the actual submit of the form.
25            ACC.mtr.getDataSubmitSearchSearch()
26        });
27
28        $('.js-mtr-go-to-page').click(function () {
29            ACC.mtr.showMtrPage($(this).data('page'));
30        });
31
32        $('.js-mtr-pagination-go-submit').click(function () {
33            ACC.mtr.showMtrPage($('#mtr-page-number-input').val());
34        });
35
36        $('.js-mtr-clear').click(function () {
37            window.location='/mtr';
38        });
39    },
40
41    bindInputChange: function(){
42        $(".results-table-heading h2").css("text-transform", "capitalize");
43        $("#submitMtrFormBtn").attr("disabled", ACC.mtr.shouldMtrSubmitBeDisabled());
44
45        $(".js-mtr-search-container input[type='text']").on("change keyup paste", function(event) {
46            if (event.keyCode === 13) { // Check if the Enter key was pressed
47                return; // Ignore the Enter key press and exit the event handler
48            }
49
50            $("#pageNumber").val("");
51            $("#submitMtrFormBtn").attr("disabled", ACC.mtr.shouldMtrSubmitBeDisabled());
52        });
53
54        $("#js-mtr-sort-select").on("change", function() {
55            if ($(this).find(":selected").val() != "") {
56                window.location = $(this).find(":selected").val();
57            }
58        });
59    },
60
61    showMtrPage:function(pageNumber){
62        $("#pageNumber").val(pageNumber);
63        $("#MTRSearchFormId").submit();
64    },
65
66    shouldMtrSubmitBeDisabled: function() {
67        if ($("#mtr-heat-code").val().length > 0 || $("#mtr-customer-purchase-order").val().length > 0 || $("#mtr-bse-part-number").val().length > 0 || $("#mtr-customer-part-number").val().length > 0 || $("#mtr-delivery-number").val().length > 0) {
68            if ($("#mtr-heat-code").val().length > 0 && $("#mtr-heat-code").val().length < 3
69                && ($("#mtr-customer-purchase-order").val().length == 0 || $("#mtr-customer-purchase-order").val().length > 2)
70                && ($("#mtr-bse-part-number").val().length == 0 || $("#mtr-bse-part-number").val().length > 2)
71                && ($("#mtr-customer-part-number").val().length == 0 || $("#mtr-customer-part-number").val().length > 2)
72                && ($("#mtr-delivery-number").val().length == 0 || $("#mtr-delivery-number").val().length > 2)) {
73                    return false;
74            }
75
76            if (($("#mtr-heat-code").val().length == 0 || $("#mtr-heat-code").val().length > 2)
77                && ($("#mtr-customer-purchase-order").val().length == 0 || $("#mtr-customer-purchase-order").val().length > 2)
78                && ($("#mtr-bse-part-number").val().length == 0 || $("#mtr-bse-part-number").val().length > 2)
79                && ($("#mtr-customer-part-number").val().length == 0 || $("#mtr-customer-part-number").val().length > 2)
80                && ($("#mtr-delivery-number").val().length == 0 || $("#mtr-delivery-number").val().length > 2)) {
81                    return false;
82            }
83        }
84        return true;
85    },
86
87
88
89    getDataSubmitSearchSearch() {
90        var form = $("#MTRSearchFormId");
91        var actionUrl = form.attr('action');
92        actionUrl = actionUrl + "?" + form.serialize();
93
94        var newHref = window.location.origin + window.location.pathname;
95        newHref = newHref + "?" + form.serialize();
96        window.history.replaceState(null, document.title, newHref);
97        ACC.mtr.submitSearch(actionUrl)
98    },
99
100    submitSearch(actionUrl){
101        $('.mtr-loader').show();
102        $('#submitMtrFormBtn').text('');
103        $('#submitMtrFormBtn').prop('disabled', true);
104
105        $(".js-searchResult-placeholder").html("")
106        $.ajax({
107            type: "GET",
108            url: actionUrl,
109            success: function(data)
110            {
111                $(' .mtr-loader').hide();
112                $('#submitMtrFormBtn').text('Search');
113                $('#submitMtrFormBtn').prop('disabled', false);
114                $(".js-searchResult-placeholder").html(data)
115            },
116            error: function(){
117                $(".js-searchResult-placeholder").html("")
118
119            }
120        });
121    }
122}

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.