PageSourceSearch

https://www.usine-online.com/modules/configurator/views/js/front/e…ggodsddFSFgggdstestSSDttSDvaTESTftttffyfrni

js usine-online.com collected 2026-10-08 10:57:54 UTC 4,341 bytes, 124 lines download raw bytes

1/**
2 * 2007-2019 PrestaShop
3 *
4 * NOTICE OF LICENSE
5 *
6 * This source file is subject to the Academic Free License (AFL 3.0)
7 * that is bundled with this package in the file LICENSE.txt.
8 * It is also available through the world-wide-web at this URL:
9 * http://opensource.org/licenses/afl-3.0.php
10 * If you did not receive a copy of the license and are unable to
11 * obtain it through the world-wide-web, please send an email
12 * to [email protected] so we can send you a copy immediately.
13 *
14 * DISCLAIMER
15 *
16 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
17 * versions in the future. If you wish to customize PrestaShop for your
18 * needs please refer to http://www.prestashop.com for more information.
19 *
20 *  @author DMConcept <[email protected]>
21 *  @copyright 2015 DMConcept
22 *  @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
23 *  International Registered Trademark & Property of PrestaShop SA
24 *
25 * Don't forget to prefix your containers with your own identifier
26 * to avoid any conflicts with others containers.
27 */
28
29var CONFIGURATOR = CONFIGURATOR || {};
30CONFIGURATOR.ELEMENTS = CONFIGURATOR.ELEMENTS || {};
31CONFIGURATOR.ELEMENTS.INPUT = CONFIGURATOR.ELEMENTS.INPUT || {};
32
33/**
34 * Handles input with type='number' and data-type=slider
35 * @param {type} step
36 * @param {type} parent
37 */
38CONFIGURATOR.ELEMENTS.INPUT.NumberInputSlider = function(step, parent) {
39    
40    var Super = Object.getPrototypeOf(this);
41    
42    // Avoid problem for updateInternal
43    this.initDone = false;
44    
45    this.init = function(step, parent) {
46        Super.init.call(this, step, parent);
47        this.initDone = true;
48        
49        var initValue = parseInt(this.step.params.value, this.numberBase);
50        
51        this.targetEvent.slider({
52            value: initValue,
53            min: this.targetEvent.data('min'),
54            max: this.targetEvent.data('max'),
55            step: this.targetEvent.data('slider-step'),
56            slide: $.proxy(this.onSlide, this)
57        });
58        
59        this.changeInformationWithValue(initValue);
60    };
61    
62    this.changeInformationWithValue = function (value) {
63        $("#slider_information_"+this.targetEvent.prop('id')+" span").text(value);
64    };
65    
66    this.onSlide = function (event, ui) {
67        this.changeInformationWithValue(ui.value);
68    };
69    
70    this.onChange = function(event, ui) {
71        this.changeInformationWithValue(ui.value);
72        
73        // Eviter que si le client clique uniquement sur le slide cela fasse partir la requête
74        if(parseInt(this.step.params.value, 10) !== parseInt(ui.value, 10)) {
75            this.step.params.value = ui.value;
76            this.onInteract();
77        }
78    };
79    
80    this.onInteract = function() {
81        var currentState = this.state;
82        
83        // Change value in operation
84        this.operations[0].value = this.step.params.value; 
85
86        /**
87         * Lance l'envoie AJAX ver le controller
88         */
89        this.parent.notify(this.getID(), this.STATE.ACTIVE);
90    };
91    
92    this.bind = function() {
93        Super.bind.call(this);
94        this.targetEvent.slider('option','change', $.proxy(this.onChange, this));
95    };
96
97    this.unbind = function() {
98        Super.unbind.call(this);
99        this.targetEvent.slider('option','change', $.proxy(this.onChange, this));
100    };
101    
102    this.initDOMLinks = function(step, parent) {
103        Super.initDOMLinks.call(this, step, parent);
104        this.targetEvent = this.getHTMLElement().find('div[data-type=slider]');
105    };       
106    
107    this.updateInternal = function(data) {
108        Super.updateInternal.call(this, data);
109        
110        // Assure que si en backoffice une valeur est saisie elle remonte sur le front
111        if (data.params.value && this.initDone) {
112            this.targetEvent.slider('option', 'value', parseInt(data.params.value, 10));
113        }
114    };
115    
116    
117    if (step) {
118        this.init(step, parent);
119    }
120    
121};
122
123CONFIGURATOR.ELEMENTS.dispatch.registerObject('slider_input', CONFIGURATOR.ELEMENTS.INPUT.NumberInputSlider);
124CONFIGURATOR.ELEMENTS.INPUT.NumberInputSlider.prototype = new CONFIGURATOR.ELEMENTS.INPUT.BaseInput;

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.