Add bg-body to default table Pass event properly
jdarwood007

jdarwood007 commited on 2023-11-19 10:11:18
Showing 1 changed files, with 20 additions and 29 deletions.

... ...
@@ -75,8 +75,7 @@
75 75
 
76 76
 		// Parse a float with 0s at the end.
77 77
 		// Reference: https://stackoverflow.com/questions/4868556/how-do-i-stop-parsefloat-from-stripping-zeroes-to-right-of-decimal
78
-		function customParseFloat(number)
79
-		{
78
+		function customParseFloat(number) {
80 79
 			if (isNaN(parseFloat(number)) !== false)
81 80
 				return number;
82 81
 
... ...
@@ -86,8 +85,7 @@
86 85
 			return parseFloat(str).toFixed(arr.length === 2 ? arr[1].length : 0);
87 86
 		}
88 87
 
89
-		function setNewValue(container, value)
90
-		{
88
+		function setNewValue(container, value, event) {
91 89
 			if (options.onBeforeSetNewvalue !== undefined)
92 90
 				options.onBeforeSetNewvalue(this, event, container, value);
93 91
 
... ...
@@ -118,14 +116,12 @@
118 116
 		}
119 117
 
120 118
 		// https://stackoverflow.com/questions/9553354/how-do-i-get-the-decimal-places-of-a-floating-point-number-in-javascript
121
-		function precision(a)
122
-		{
119
+		function precision(a) {
123 120
 			if (!isFinite(a))
124 121
 				return 0;
125 122
 
126 123
 			var e = 1, p = 0;
127
-			while (Math.round(a * e) / e !== a)
128
-			{
124
+			while (Math.round(a * e) / e !== a) {
129 125
 				e *= 10;
130 126
 				p++;
131 127
 			}
... ...
@@ -133,20 +129,17 @@
133 129
 			return parseInt(p);
134 130
 		}
135 131
 
136
-		function FindPercision(v, p)
137
-		{
132
+		function FindPercision(v, p) {
138 133
 			if (!isFinite(v))
139 134
 				return 0;
140 135
 			return parseInt(v).toString().length + p;
141 136
 		}
142 137
 
143
-		function findMinMaxValue()
144
-		{
138
+		function findMinMaxValue() {
145 139
 			var testValue;
146 140
 			for (var i = 0; i < arguments.length; i++) {
147 141
 				testValue = arguments[i];
148
-				if (typeof testValue !== 'undefined' && !isNaN(testValue))
149
-				{
142
+				if (typeof testValue !== 'undefined' && !isNaN(testValue)) {
150 143
 					if (options.type === 'number' && parseInt(testValue) !== null)
151 144
 						return parseInt(testValue);
152 145
 					else if (parseFloat(testValue) !== null)
... ...
@@ -202,7 +195,7 @@
202 195
 				if (options.onBeforeClickDecrease !== undefined)
203 196
 					options.onBeforeClickDecrease(this, event);
204 197
 				if ($base.val() > $minValue)
205
-					setNewValue($base, parseFloat(parseFloat($base.val()) - parseFloat($step)).toPrecision(FindPercision($base.val(), $percision)));
198
+					setNewValue($base, parseFloat(parseFloat($base.val()) - parseFloat($step)).toPrecision(FindPercision($base.val(), $percision)), event);
206 199
 				if (options.onAfterClickDecrease !== undefined)
207 200
 					options.onAfterClickDecrease(this, event);
208 201
 				if (options.debug)
... ...
@@ -218,7 +211,7 @@
218 211
 				if (options.onBeforeClickIncrease !== undefined)
219 212
 					options.onBeforeClickIncrease(this, event);
220 213
 				if ($base.val() < $maxValue)
221
-					setNewValue($base, parseFloat(parseFloat($base.val()) + parseFloat($step)).toPrecision(FindPercision($base.val(), $percision)));
214
+					setNewValue($base, parseFloat(parseFloat($base.val()) + parseFloat($step)).toPrecision(FindPercision($base.val(), $percision)), event);
222 215
 				if (options.onAfterClickIncrease !== undefined)
223 216
 					options.onAfterClickIncrease(this, event);
224 217
 				if (options.debug)
... ...
@@ -226,8 +219,7 @@
226 219
 			});
227 220
 
228 221
 			// The Popup Numberpad
229
-			if (!options.disableVirtualKeyboard)
230
-			{
222
+			if (!options.disableVirtualKeyboard) {
231 223
 				var $KeyboardLayout;
232 224
 
233 225
 				if (options.onBeforeVirtualKeyboardInitalized !== undefined)
... ...
@@ -248,7 +240,7 @@
248 240
 						$KeyboardLayout =
249 241
 							'<div class="modal-dialog modal-dialog-centered m-auto" style="width: 250px;">' +
250 242
 							'<div class="modal-content">' +
251
-									'<table>' +
243
+							'<table class="bg-body">' +
252 244
 							'<tr>' +
253 245
 							'<td colspan="4">{INPUTBOX}</td>' +
254 246
 							'</tr><tr>' +
... ...
@@ -308,8 +300,7 @@
308 300
 						if (options.onBeforeVirtualKeyboardButton !== undefined)
309 301
 							options.onBeforeVirtualKeyboardButton(this, event, thisFunction);
310 302
 
311
-						switch (thisFunction)
312
-						{
303
+						switch (thisFunction) {
313 304
 							case 'DELETE':
314 305
 								$VirtualKeyboardInput.val($VirtualKeyboardInput.val().toString().slice(0, -1));
315 306
 								break;
... ...
@@ -320,11 +311,11 @@
320 311
 
321 312
 							case 'DONE':
322 313
 								if ($VirtualKeyboardInput.val() > $maxValue)
323
-									setNewValue($base, $maxValue);
314
+									setNewValue($base, $maxValue, event);
324 315
 								else if ($VirtualKeyboardInput.val() < $minValue)
325
-									setNewValue($base, $minValue);
316
+									setNewValue($base, $minValue, event);
326 317
 								else
327
-									setNewValue($base, $VirtualKeyboardInput.val());
318
+									setNewValue($base, $VirtualKeyboardInput.val(), event);
328 319
 
329 320
 								$VirtualKeyboard.remove();
330 321
 								break;
... ...
@@ -335,12 +326,12 @@
335 326
 
336 327
 							case 'UP':
337 328
 								if ($VirtualKeyboardInput.val() < $maxValue)
338
-									setNewValue($VirtualKeyboardInput, parseFloat($VirtualKeyboardInput.val()) + parseFloat($step));
329
+									setNewValue($VirtualKeyboardInput, parseFloat($VirtualKeyboardInput.val()) + parseFloat($step), event);
339 330
 								break;
340 331
 
341 332
 							case 'DOWN':
342 333
 								if ($VirtualKeyboardInput.val() > $minValue)
343
-									setNewValue($VirtualKeyboardInput, parseFloat($VirtualKeyboardInput.val()) - parseFloat($step));
334
+									setNewValue($VirtualKeyboardInput, parseFloat($VirtualKeyboardInput.val()) - parseFloat($step), event);
344 335
 								break;
345 336
 
346 337
 							case 'SEP':
... ...
@@ -349,7 +340,7 @@
349 340
 								break;
350 341
 
351 342
 							case 'INVERSE':
352
-								setNewValue($VirtualKeyboardInput, parseFloat($VirtualKeyboardInput.val()) * -1);
343
+								setNewValue($VirtualKeyboardInput, parseFloat($VirtualKeyboardInput.val()) * -1, event);
353 344
 								break;
354 345
 
355 346
 							// Default to assume its numbers.
... ...
@@ -357,9 +348,9 @@
357 348
 								if ($(this).attr('data-custom-function'))
358 349
 									$(this).attr('data-custom-function')(this, event, thisFunction);
359 350
 								else if ($VirtualKeyboardInput.val() == '0' || $VirtualKeyboardInput.val() == '0.000')
360
-									setNewValue($VirtualKeyboardInput, $(this).attr('data-function'));
351
+									setNewValue($VirtualKeyboardInput, $(this).attr('data-function'), event);
361 352
 								else
362
-									setNewValue($VirtualKeyboardInput, $VirtualKeyboardInput.val().toString() + $(this).attr('data-function'));
353
+									setNewValue($VirtualKeyboardInput, $VirtualKeyboardInput.val().toString() + $(this).attr('data-function'), event);
363 354
 						}
364 355
 
365 356
 						if (options.onAfterVirtualKeyboardButton !== undefined)
366 357