: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Extension for jQuery Spinner.
* @license jQuery UI Spinner 1.20
* Copyright (c) 2009-2010 Brant Burnett
* Dual licensed under the MIT or GPL Version 2 licenses.
* The original author is no longer maintaining this code.
* Modified for the Redux Framework Spinner field by Kevin Provance (kprovance).
* Listen up y'all, I painstakingly recreated the original code from it's modified and minified version to the thing of
* beauty you see below. Mess with it and I'll kill ya! - kp
* Deprecated jQuery API $.browser was replaced with the accepted hack below.
* Deprecated boxSupport was removed, since Redux does not use boxSupport.
jQuery.uaMatch = function( ua ) {
match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
/(msie) ([\w.]+)/.exec( ua ) ||
ua.indexOf( 'compatible' ) < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || [];
browser: match[ 1 ] || '',
version: match[ 2 ] || '0'
var active = 'ui-state-active';
var hover = 'ui-state-hover';
var disabled = 'ui-state-disabled';
var keyCode = $.ui.keyCode;
var right = keyCode.RIGHT;
var pageUp = keyCode.PAGE_UP;
var pageDown = keyCode.PAGE_DOWN;
var msie = $.uaMatch.msie;
var mouseWheelEventName = $.uaMatch.mozilla ? 'DOMMouseScroll' : 'mousewheel';
var eventNamespace = '.uispinner';
var validKeys = [up, down, right, left, pageUp, pageDown, home, end, keyCode.BACKSPACE, keyCode.DELETE, keyCode.TAB];
upIconClass: 'ui-icon-triangle-1-n',
downIconClass: 'ui-icon-triangle-1-s',
format: function( num, places ) {
var regex = /(\d+)(\d{3})/;
var realNum = Number( num );
/* jscs:disable disallowImplicitTypeConversion */
result = ( isNaN( num ) ? 0 : Math.abs( realNum ) ).toFixed( places ) + '';
for ( result = result.replace( '.', _this.point ); regex.test( result ) && _this.group; result = result.replace( regex, '$1' + _this.group + '$2' ) ) {
return ( num < 0 ? '-' : '' ) + _this.prefix + result + _this.suffix;
if ( '.' === _this.group ) {
val = val.replace( '.', '' );
if ( '.' !== _this.point ) {
val = val.replace( _this.point, '.' );
return parseFloat( val.replace( /[^0-9\-\.]/g, '' ) );
var input = _this.element;
var type = input.attr( 'type' );
if ( ! input.is( 'input' ) || 'text' !== type && 'number' !== type ) {
console.error( 'Invalid target for ui.spinner' );
_this._procOptions( true );
_this._createButtons( input );
if ( ! input.is( ':enabled' ) ) {
_createButtons: function( input ) {
var options = _this.options;
var className = options.className;
var buttonWidth = options.width;
var showOn = options.showOn;
var height = input.outerHeight();
/* jshint validthis:true */
$( this ).removeClass( active );
/* jshint validthis:true */
if ( ! options.disabled ) {
input = _this.element[0];
dir = upButton === this ? 1 : - 1;
$( this ).addClass( active );
function setHoverDelay( callback ) {
if ( callback === hoverDelayCallback ) {
clearTimeout( hoverDelay );
hoverDelayCallback = callback;
hoverDelay = setTimeout( execute, 100 );
function invalidKey( keyCode, charCode ) {
ch = String.fromCharCode( charCode || keyCode );
if ( ch >= '0' && ch <= '9' || '-' === ch ) {
return ! ( _this.places > 0 && ch === options.point || ch === options.group );
function isSpecialKey( keyCode ) {
var vKeys = validKeys.length;
for ( i = 0; i < vKeys; i += 1 ) {
if ( validKeys[i] === keyCode ) {
wrapper = input.wrap( '<span class="spinner-wrpr" />' ).css(
width: ( _this.oWidth = input.outerWidth() ) - buttonWidth + '!important',
).after( '<span class="ui-spinner ui-widget"></span>' ).next();
'<div class="ui-spinner-buttons"><div class="ui-spinner-up ui-spinner-button ui-state-default ui-corner-tr"><span class="ui-icon ' +
options.upIconClass + '">' + options.addText +
'</span></div><div class="ui-spinner-down ui-spinner-button ui-state-default ui-corner-br"><span class="ui-icon ' +
options.downIconClass + '">' + options.subText + '</span></div></div>'
_this.btnContainer = btnContainer;
rtl = 'rtl' === input[0].dir;
wrapper.addClass( className );
wrapper.append( btnContainer.css( { height: height, left: 0, top: 0 } ) );
buttons = _this.buttons = btnContainer.find( '.ui-spinner-button' );
buttons.css( { width: '30px', height: height - ( 0 ) } );
buttons.eq( 0 ).css( { right: '0' } );
buttons.eq( 1 ).css( { left: '0' } );
btnContainer.width( '135px' );
if ( 'always' !== showOn ) {
btnContainer.css( 'opacity', 0 );
if ( 'hover' === showOn || 'both' === showOn ) {
'mouseenter' + eventNamespace,
if ( ! _this.focused || 'hover' === showOn ) {
'mouseleave' + eventNamespace,
if ( ! _this.focused || 'hover' === showOn ) {
_this.buttons.removeClass( hover );
if ( ! options.disabled ) {
$( this ).addClass( hover );
$( this ).removeClass( hover );
if ( ! options.disabled ) {
_this._doSpin( ( this === upButton ? 1 : - 1 ) * options.step );
'keydown' + eventNamespace,
if ( isSpecialKey( keyCode ) ) {
/*jslint bitwise: true */
large = keyCode === pageUp;
large = keyCode === pageDown;
dir = ( keyCode === right ) ^ rtl ? 1 : - 1;
limit = _this.options.min;
_this._setValue( limit );
limit = _this.options.max;
limit = _this.options.max;
_this._setValue( limit );
if ( ! inKeyDown && ! options.disabled ) {
$( dir > 0 ? upButton : downButton ).addClass( active );
_this._startSpin( dir, large );
'keyup' + eventNamespace,
if ( isSpecialKey( keyCode ) ) {
buttons.removeClass( active );
'keypress' + eventNamespace,
if ( invalidKey( e.keyCode, e.charCode ) ) {
'change' + eventNamespace,
'focus' + eventNamespace,
_this.element.trigger( 'select' );
setTimeout( selectAll, 0 );
if ( ! hovered && ( 'focus' === showOn || 'both' === showOn ) ) {
if ( ! hovered && ( 'focus' === showOn || 'both' === showOn ) ) {
_procOptions: function( init ) {
var input = _this.element;
var options = _this.options;
var places = options.places;