PageSourceSearch

https://www.thuscoffee.com/order/catalog/view/javascript/enquiry.js

js thuscoffee.com collected 2026-09-30 18:34:12 UTC 3,898 bytes, 98 lines download raw bytes

1// Enquiry add remove functions
2var enquiry = {
3    'add': function (product_id, quantity) {
4        $.ajax({
5            url: 'index.php?route=enquiry/cart/add',
6            type: 'post',
7            data: 'product_id=' + product_id + '&quantity=' + (typeof (quantity) != 'undefined' ? quantity : 1),
8            dataType: 'json',
9            beforeSend: function () {
10                $('#enquiry > button').button('loading');
11            },
12            complete: function () {
13                $('#enquiry > button').button('reset');
14            },
15            success: function (json) {
16                $('.alert, .text-danger').remove();
17
18                if (json['redirect']) {
19                    // $('body').removeAttr('style');
20                    setTimeout(function () {
21                        location = json['redirect'];
22                    }, 1000);
23                }
24
25                if (json['success']) {
26                    // Need to set timeout otherwise it wont update the total
27                    setTimeout(function () {
28                        $('#enquiry-quantity-total').text(json['total_quantity']);
29                        $('#enquiry-total').text(json['total']);
30                    }, 100);
31
32                    swal({
33                        title: json['success_title'],
34                        html: json['success'],
35                        type: "success"
36                    });
37
38                    $('#enquiry > ul').load('index.php?route=common/enquiry/info ul > *');
39                }
40            },
41            error: function (xhr, ajaxOptions, thrownError) {
42                alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
43            }
44        });
45    },
46    'remove': function (key) {
47        $.ajax({
48            url: 'index.php?route=enquiry/cart/remove',
49            type: 'post',
50            data: 'key=' + key,
51            dataType: 'json',
52            beforeSend: function () {
53                $('#enquiry > button').button('loading');
54            },
55            complete: function () {
56                $('#enquiry > button').button('reset');
57            },
58            success: function (json) {
59                // Need to set timeout otherwise it wont update the total
60                setTimeout(function () {
61                    $('#enquiry-quantity-total').text(json['total_quantity']);
62                    $('#enquiry-total').text(json['total']);
63                }, 100);
64
65                if ($('body.short_hand').length) {
66                    if (location.toString().indexOf('cart') > 1 || location.toString().indexOf('checkout') > 1) {
67                        location.reload();
68                    }
69                    else {
70                        $('#enquiry > ul').load('index.php?route=common/enquiry/info ul > *');
71
72                        swal({
73                            title: json['success_remove_title'],
74                            html: json['success'],
75                            type: "success"
76                        });
77                    }
78                }
79                else {
80                    if (getURLVar('route') == 'enquiry/cart' || getURLVar('route') == 'enquiry/checkout' || getURLVar('route') == 'quickenquiry/checkout') {
81                        location = 'index.php?route=enquiry/cart';
82                    } else {
83                        $('#enquiry > ul').load('index.php?route=common/enquiry/info ul > *');
84
85                        swal({
86                            title: json['success_remove_title'],
87                            html: json['success'],
88                            type: "success"
89                        });
90                    }
91                }
92            },
93            error: function (xhr, ajaxOptions, thrownError) {
94                alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
95            }
96        });
97    }
98}

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.