PageSourceSearch

https://www.thury89.fr/Ext/Resources?a=CLe5H_Yo_xKcOYsdCuvobpUD40B…glk6MZmrreMi8Zah9gODB0D0HuXRtIOM4-z9eAbOlww

js thury89.fr collected 2026-09-25 06:51:26 UTC 4,515 bytes, 152 lines download raw bytes

1
2WS.Namespace.Create('NovAxis.CheckBox', (function ()
3{
4    /**
5    @class CheckBox
6    @namespace NovAxis
7    @constructor
8    @param {JQuery dom} Element Dom element that will be replaced by the control. <br />
9    Must be in the specific form : &lt;input type="checkbox"&gt;&lt;label&gt;Mon texte&lt;/label&gt;<br />
10    Property checked intag is supported : &lt;input type="checkbox" <span style="background-color:yellow;">checked</span>&gt;&lt;label&gt;Mon texte&lt;/label&gt;
11    @param {Boolean} [Value] true, false
12    @param {Array<String>} [Classes] Array of class names to apply to the control.
13    **/
14    var Class = function (Element, Value, Classes)
15    {
16        // Validation
17        if (!Element || Element.length == 0) throw "Element control cannot be null.";
18        if (Value && (typeof Value !== "boolean")) throw "Value must be boolean.";
19
20        /**
21        Fired when the value is changed.
22
23        @event change
24        @param {Number} The new value.
25        **/
26        WS.EventObject.call(this, ['change']);
27
28        // InitData
29        this._Value = false;
30        this.originalElement = Element;
31
32        // Element
33        this._Element = $(CreateControl.call(this, Element));
34
35        Element.after(this._Element);
36        Element.remove();
37        if (Classes && Classes.length > 0) this._Element.addClass(Classes.join(" "));
38
39        // Events, Bindings
40        AddEvents.apply(this);
41        if (Value != null) this.SetValue(Value);
42    };
43
44    WS.Exts.Inherits(Class, WS.EventObject);
45
46    // Private Method(s)
47    var CreateControl = function (Element)
48    {
49        var Html = [];
50        var MyElement = Element.find("input[type=checkbox]");
51        var Checked = "";
52        if (MyElement.is("[checked]"))
53        {
54            Checked = " class=\"wsChecked\"";
55            this._Value = true;
56        }
57
58        Html.push("<div class=\"naCheckBox\">");
59        Html.push("<div" + Checked + "></div>");
60        Html.push("<label>" + MyElement.next("label").text() + "</label>");
61        Html.push("</div>");
62
63        return Html.join("");
64    };
65
66    var AddEvents = function ()
67    {
68        var Me = this;
69        var Element = this._Element.find("> div");
70        var Labels = this._Element.find("> label");
71
72        Element.off("click");
73        Element.on("click", function ()
74        {
75            var Value = !Me._Value;
76            Me.SetValue(Value);
77            Me.RaiseEvent("change", Value);
78        });
79
80        Labels.off("click");
81        Labels.on("click", function () { $(this).prev("div").click(); });
82    };
83
84    // Public Method(s)
85    (function (Methods)
86    {
87        /**
88        Get the selected value (checked).
89    
90        @method GetValue
91        @return {boolean} Value
92        **/
93        Methods.GetValue = function ()
94        {
95            return this._Value;
96        };
97
98        /**
99        Set the selected value (checked).
100    
101        @method SetValue
102        @param {boolean} Value
103        **/
104        Methods.SetValue = function (Value)
105        {
106            if (Value == null) throw "Value cannot be null.";
107            if (Value && (typeof Value !== "boolean")) throw "Value must be boolean.";
108
109            this._Value = Value;
110            var Element = this._Element.find("> div");
111            Element.removeClass("wsChecked");
112            if (this._Value) { Element.addClass("wsChecked"); }
113        };
114
115        /**
116        Disable the control.
117   
118        @method Disable
119        **/
120        Methods.Disable = function ()
121        {
122            this._Element.find("> div").css({ "pointer-events": "none", "background-color": "#5c5c5c" });
123            this._Element.find("> label").css({ "pointer-events": "none", "color": "#5c5c5c" });
124        };
125
126        /**
127        Enable the control.
128  
129        @method Enable
130        **/
131        Methods.Enable = function ()
132        {
133            this._Element.find("> div").css({ "pointer-events": "", "background-color": "" });
134            this._Element.find("> label").css({ "pointer-events": "", "color": "" });
135        };
136
137        /**
138        Destroy the control.
139 
140        @method Destroy
141        **/
142        Methods.Destroy = function ()
143        {
144            this._Element.after(this.originalElement);
145            this._Element.remove();
146            this._Element = null;
147        };
148
149    })(Class.prototype);
150
151    return Class;
152})());

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.