PageSourceSearch

https://www.bestselfwny.org/wp-content/plugins/bsbh-community-enga…/assets/js/requests.js?ver=1686570703

js bestselfwny.org collected 2026-09-24 12:26:05 UTC 5,206 bytes, 125 lines download raw bytes

1(function($) {
2    PDDataTable({
3        searching : false,
4        url: bsbh.ajaxurl+"?action=bsbh_requests&status="+bsbh.status,
5        columns:[
6            { data: 'ID', name: 'ID', className:"text-left"},
7            { data: 'submission_date', name: 'submission_date', orderable: true, searchable : false, className:"text-center"},
8            { data: 'post_title', name: 'post_title', className:"text-left"},
9            { data: '_event_date', name: '_event_date', orderable: true, searchable : false, className:"text-center"},
10            { data: 'status', name: 'status', className:"text-left"},
11            { data: 'action', name: 'action', className:"text-end", orderable: false, searchable : false}
12        ],
13        order : [0, 'desc'],
14        callbackFunc  : function(d){
15            d.range = [];
16            d.range = $('input[name="range"]').val();
17        },
18
19        drawCallback : function( settings ) {
20            if (this.api().page.info().pages > 1) {
21                $('.dataTables_paginate').show();
22            }
23
24            if ( $(".btn-filter span.spinner-border").length > 0) {
25                spinner($(".btn-filter"), false);
26            }
27        }
28
29    });
30
31    function cb(start, end) {
32        $('.reportrange span.date-text').html(start.format('D MMM, YYYY') + ' - ' + end.format('D MMM, YYYY'));
33        $(document).trigger('onRangeChanged');
34    }
35
36    // cb((moment()), moment());
37
38    $('.reportrange').daterangepicker({
39        opens           : 'left',
40        autoApply       : true,
41        autoUpdateInput : false,
42        locale          : {
43            format          : "Y-M-D",
44            customRangeLabel: "Pick a date range",
45        },
46        ranges  : {
47            'Last 30 Days'  : [moment().subtract(29, 'days'), moment()],
48            'Last Week'     : [moment().subtract(6, 'days'), moment()],
49            'Today'         : [moment(), moment()],
50            'Next Week'     : [moment(), moment().add(6, 'days')],
51            'This month'    : [moment().startOf('month'), moment().endOf('month')],
52            'This Year'     : [moment().startOf('year'), moment().endOf('year')],
53            'Last Year'     : [moment().subtract(1, 'year').startOf('year'), moment().subtract(1, 'year').endOf('year')],
54        },
55        alwaysShowCalendars : true,
56        showDropdowns       : true
57    }, cb);
58
59
60    $('.reportrange').on('apply.daterangepicker', function(ev, picker) {
61        $("input[name='range']").val(picker.startDate.format("Y-M-D") + ' - ' + picker.endDate.format("Y-M-D"));
62        PDTable.draw();
63    });
64
65    $('.reportrange').on('cancel.daterangepicker', function(ev, picker) {
66        $("input[name='range']").val('');
67        PDTable.draw();
68    });
69
70
71    $("body").on("click", ".button-get-requests-csv", function(event) {
72        let data = $("form#filter-form").serialize()+"&action=bsbh_generate_requests_csv";
73        jQuery.post(bsbh.ajaxurl, data, function (response, status, xhr) {
74            if ('html/csv' === xhr.getResponseHeader('Content-type')) {
75                var filename = "";
76                var disposition = xhr.getResponseHeader('Content-Disposition');
77
78                if (disposition && disposition.indexOf('attachment') !== -1) {
79                    var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
80                    var matches = filenameRegex.exec(disposition);
81
82                    if (matches != null && matches[1]) {
83                        filename = matches[1].replace(/['"]/g, '');
84                    }
85                }
86
87                var type = xhr.getResponseHeader('Content-Type');
88                var blob = typeof File === 'function' ? new File([response], filename, {
89                    type: type
90                }) : new Blob([response], {
91                    type: type
92                });
93
94                if (typeof window.navigator.msSaveBlob !== 'undefined') {
95                    // IE workaround for "HTML7007: One or more blob URLs were revoked by closing the blob for which they were created. These URLs will no longer resolve as the data backing the URL has been freed."
96                    window.navigator.msSaveBlob(blob, filename);
97                } else {
98                    var URL = window.URL || window.webkitURL;
99                    var downloadUrl = URL.createObjectURL(blob);
100
101                    if (filename) {
102                        // use HTML5 a[download] attribute to specify filename
103                        var a = document.createElement("a"); // safari doesn't support this yet
104
105                        if (typeof a.download === 'undefined') {
106                            window.location = downloadUrl;
107                        } else {
108                            a.href = downloadUrl;
109                            a.download = filename;
110                            document.body.appendChild(a);
111                            a.click();
112                        }
113                    } else {
114                        window.location = downloadUrl;
115                    }
116
117                    setTimeout(function () { URL.revokeObjectURL(downloadUrl); }, 100); // cleanup
118                }
119            }
120        });
121
122    });
123
124
125})(jQuery);

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.