PageSourceSearch

https://musclemeat.nl/wp-content/plugins/print-service/js/print-service-ajax.js

js musclemeat.nl collected 2026-10-02 21:38:43 UTC 2,940 bytes, 82 lines download raw bytes

1jQuery(document).ready(function($) {
2    function getCurrentFormattedTime() {
3        var currentDate = new Date();
4        var hours = currentDate.getHours();
5        var minutes = currentDate.getMinutes();
6        var seconds = currentDate.getSeconds();
7
8        var formattedTime = (hours < 10 ? '0' : '') + hours + ':' 
9        + (minutes < 10 ? '0' : '') + minutes + ':' 
10        + (seconds < 10 ? '0' : '') + seconds;
11
12        return formattedTime;
13    }
14
15    $('#print-service-form').on('submit', function(e) {
16        e.preventDefault();
17        $('.spinner').addClass('is-active');
18
19        var orderNumber = $('#order-number').val();
20        var deliveryTime = $('input[name="deliveryTime"]:checked').val();
21
22
23        $.ajax({
24            type: 'POST',
25            url: frontendajax.ajaxurl,
26            data: {
27                action: 'handle_print_service_form',
28                orderNumber: orderNumber,
29                deliveryTime: deliveryTime
30            },
31            success: function(response) {
32                var data = JSON.parse(response);
33
34                if('error' in data){
35                    alert(data['error']);
36                }
37                else{
38
39
40                    var print_slip = true;
41                    if(data['already_printed'] == true){
42                        print_slip = confirm("Deze pakbon is reeds afgedrukt, nog een keer afdrukken?");
43                    }
44
45                    if(print_slip){
46                      $('#prepend').prepend('<li> '+getCurrentFormattedTime()+' - Printed '+data['type']+' order '+data['order_id']+', <a href="'+data['pdf']+'" target="_blank">bekijk label</a></li>')
47                      if(iframe){
48                        URL.revokeObjectURL(url);
49                        document.body.removeChild(iframe)
50                    }
51                    var iframe = document.createElement('iframe');
52
53                //$('#externPrinten').attr("src",data['pdf'].trim());
54                iframe.src = data['pdf'].trim();
55                $(iframe).attr("type","application/pdf");
56                iframe.className='pdfIframe';
57                document.body.appendChild(iframe);
58                iframe.style.display = 'none';
59
60                iframe.onload = function () {
61                    setTimeout(function () {
62                        iframe.focus();
63                        iframe.contentWindow.print(); 
64                        
65                    }, 1);
66                };
67
68            }
69            else{
70                $('#prepend').prepend('<li> '+getCurrentFormattedTime()+' - Skipped '+data['type']+' order '+data['order_id']+', <a href="'+data['pdf']+'" target="_blank">bekijk label</a></li>');
71            }
72
73            $('#order-number').val('');
74            $('.spinner').removeClass('is-active');
75
76            return false;
77        }
78
79    }
80});
81    });
82});

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.