PageSourceSearch

https://www.navymwrmidlant.com/modules/media/?do=get_component_res…&type=js&v=10974230039639258414071639376

js navymwrmidlant.com collected 2026-09-24 10:14:25 UTC 5,624 bytes, 158 lines download raw bytes

1; (function (exports, $, _h) {
2
3    var itemTemplate = _h.compile('')
4    var EventListWidget = {
5        options: {
6            dataUrl: '/modules/component_data_store/?do=get_event_list',
7            eventItemTemplate: '',
8            noItemsTemplate: '<div>No Events</div>',
9            datePickerDateFormat:'MM dd, yy'
10        },
11        _create: function () {
12            var that = this;
13            that._state = {
14                records: []
15            };
16            that.eventListTarget = that.element.find('.events-list');
17            that._state.eventItemTemplate = _h.compile(that.options.eventItemTemplate);
18            that.datePickerEl = that.element.find('input.cms-datepicker');
19
20            that.btnListEl = that.element.find('.btn-list');
21            that.btnGridEl = that.element.find('.btn-grid');
22
23            that.btnListEl.bind('click', function (e) {
24                e.preventDefault();
25                that.btnGridEl.removeClass('active');
26                that.btnListEl.addClass('active');
27                that.element.addClass('list-view');
28            });
29            that.btnGridEl.bind('click', function (e) {
30                e.preventDefault();
31                that.btnListEl.removeClass('active');
32                that.btnGridEl.addClass('active');
33                that.element.removeClass('list-view');
34            });
35            that._render();
36            that._refresh();
37
38        },
39        _dateChanged: function (e) {
40            var that = this;
41            var filter = that.options.filter || {};
42            filter.startDate = e.target.value;
43            filter.endDate = null;
44            that._setOption('filter', filter);
45        },
46        _render: function () {
47            var that = this;
48            $(that.datePickerEl).uiDatepicker({
49                dateFormat: that.options.datePickerDateFormat || 'yy-mm-dd',
50                dayNamesMin: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
51                showOtherMonths: true
52            });
53            that.element.find('.datepicker-inline').uiDatepicker({
54                dateFormat: that.options.datePickerDateFormat || 'yy-mm-dd',
55                dayNamesMin: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
56                showOtherMonths: true
57            });
58            that.datePickerEl.bind('change', function (e) {
59                that._dateChanged(e);
60            });
61            that.element.find('.datepicker-inline').bind('change', function (e) {
62                that._dateChanged(e);
63            });
64        },
65        _refresh: function () {
66            var that = this;
67            if (!that.options.filter.programIds) {
68               delete that.options.filter.programIds;
69            }
70            var postData = {
71                jsondata: JSON.stringify($.extend({
72                    pageSize: 50,
73                    startDate: new Date().toString(),
74                    endDate: null,
75                    start: 0,
76                    end: 50,
77                    days: 90,
78                    groupIds: null,
79                    tagIds: null,
80                    activityIds: null,
81                    sectionId: 'ALL'
82                }, that.options.filter))
83            };
84            if (that.options.dataStoreFilter) {
85                postData.filter = JSON.stringify(that.options.dataStoreFilter);
86            }
87            if (that.options.dataStoreSort) {
88                postData.sort = JSON.stringify(that.options.dataStoreSort);
89            }
90            if (that.options.dataStoreSearch) {
91                postData.storeSearch = JSON.stringify(that.options.dataStoreSearch);
92            }
93           
94            $.ajax({
95                url: that.options.dataUrl,
96                type: 'POST',
97                data: postData
98            }).done(function (res) {
99                if (res.success) {
100                    that._state.records = res.items;
101                    that._renderItems();
102
103                }
104            });
105        },
106        _renderItems: function () {
107            var that = this, items = that._state.records;
108            that.eventListTarget.empty();
109      
110            if (items.length) {
111                for (var i = 0; i < items.length; i++) {
112
113                    var item = items[i];
114
115                    var itemEl = $($.parseHTML(that._state.eventItemTemplate(item)));
116                    itemEl.appendTo(that.eventListTarget);
117                }
118            }
119            else {
120                if (that.options.noItemsTemplate) {
121                    that.eventListTarget.html(that.options.noItemsTemplate);
122                }
123            }
124     
125            if (that.options.afterRenderItems) {
126                that.options.afterRenderItems(that);
127            }
128            if ('retinaCover' in jQuery.fn) {
129                setTimeout(function () {
130                    that.eventListTarget.find('.bg-stretch').retinaCover();
131                });
132            }
133           
134        },
135        _destroy: function () {
136            // remove generated elements
137
138
139
140        },
141
142        // _setOptions is called with a hash of all options that are changing
143        // always refresh when changing options
144        _setOptions: function () {
145            // _super and _superApply handle keeping the right this-context
146            this._superApply(arguments);
147            this._refresh();
148        },
149
150        // _setOption is called for each individual option that is changing
151        _setOption: function (key, value) {
152            this._super(key, value);
153            this._refresh();
154        }
155    }
156    $.widget('cms.eventList', EventListWidget);
157
158})(window, jQuery, Handlebars);

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.