PageSourceSearch

https://www.renfrewshiregolfunion.co.uk/shared/js/knockout.bootstrap-datepicker.js

js renfrewshiregolfunion.co.uk collected 2026-09-27 15:22:11 UTC 2,097 bytes, 58 lines download raw bytes

1ko.bindingHandlers.datepicker = {
2    init: function (element, valueAccessor, allBindingsAccessor) {
3        //initialize datepicker with some optional options
4        var options = allBindingsAccessor().datepickerOptions || { format: "dd/mm/yyyy", autoclose: true };
5        $(element).datepicker(options);
6
7        //when a user changes the date, update the view model
8        ko.utils.registerEventHandler(element, "changeDate", function (event) {
9            var value = valueAccessor();
10            if (ko.isObservable(value)) {
11                value(event.date);
12            }
13        });
14    },
15    update: function (element, valueAccessor) {
16        var widget = $(element).data("datepicker");
17        //when the view model is updated, update the widget
18        if (widget) {
19            widget.date = ko.utils.unwrapObservable(valueAccessor());
20            if (widget.date) {
21                widget.setValue();
22            }
23        }
24    }
25};
26
27ko.bindingHandlers.datetimepicker = {
28    init: function (element, valueAccessor, allBindings) {
29        //initialize datepicker with some optional options
30        var format;
31        var defaultFormat = 'dd/mm/yyyy hh:ii'
32        if (typeof allBindings == 'function') {
33            format = allBindings().format || defaultFormat;
34        }
35        else {
36            format = allBindings.get('format') || defaultFormat;
37        }
38        $(element).datetimepicker({
39            autoclose: true,
40            todayBtn: true,
41            'format': format
42        })
43
44        //when a user changes the date, update the view model
45        ko.utils.registerEventHandler(element, "changeDate", function (event) {
46            var value = valueAccessor();
47            if (ko.isObservable(value)) {
48                value($(element).datetimepicker("getFormattedDate"));
49            }
50        });
51    },
52    update: function (element, valueAccessor) {
53        var date = ko.unwrap(valueAccessor());
54        if (date) {
55            $(element).datetimepicker('setValue', date);
56        }
57    }
58};

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.