PageSourceSearch

https://www.springerpub.com/static/version1789146322/base/Magento/…/js/lib/knockout/bindings/range.js

js springerpub.com collected 2026-09-24 08:47:42 UTC 1,842 bytes, 72 lines download raw bytes

1/**
2 * Copyright © Magento, Inc. All rights reserved.
3 * See COPYING.txt for license details.
4 */
5
6define([
7    'ko',
8    'jquery',
9    'underscore',
10    '../template/renderer'
11], function (ko, $, _, renderer) {
12    'use strict';
13
14    var isTouchDevice = !_.isUndefined(document.ontouchstart),
15        sliderFn = 'slider',
16        sliderModule = 'jquery-ui-modules/slider';
17
18    if (isTouchDevice) {
19        sliderFn = 'touchSlider';
20        sliderModule = 'mage/touch-slider';
21    }
22
23    ko.bindingHandlers.range = {
24
25        /**
26         * Initializes binding and a slider update.
27         *
28         * @param {HTMLElement} element
29         * @param {Function} valueAccessor
30         */
31        init: function (element, valueAccessor) {
32            var config  = valueAccessor(),
33                value   = config.value;
34
35            _.extend(config, {
36                value: value(),
37
38                /**
39                 * Callback which is being called when sliders' value changes.
40                 *
41                 * @param {Event} event
42                 * @param {Object} ui
43                 */
44                slide: function (event, ui) {
45                    value(ui.value);
46                }
47            });
48
49            require([sliderModule], function () {
50                $(element)[sliderFn](config);
51            });
52        },
53
54        /**
55         * Updates sliders' plugin configuration.
56         *
57         * @param {HTMLElement} element
58         * @param {Function} valueAccessor
59         */
60        update: function (element, valueAccessor) {
61            var config = valueAccessor();
62
63            config.value = ko.unwrap(config.value);
64
65            require([sliderModule], function () {
66                $(element)[sliderFn]('option', config);
67            });
68        }
69    };
70
71    renderer.addAttribute('range');
72});

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.