Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
NumericFilter.js
01 /** @const */
02 var NumericFilter =
03 {
04 /**
05 * @param {*} attrValue
06 * @return {*}
07 */
08 filterFloat: function(attrValue)
09 {
10 return /^(?:0|-?[1-9]\d*)(?:\.\d+)?(?:e[1-9]\d*)?$/i.test(attrValue) ? attrValue : false;
11 },
12
13 /**
14 * @param {*} attrValue
15 * @return {*}
16 */
17 filterInt: function(attrValue)
18 {
19 return /^(?:0|-?[1-9]\d*)$/.test(attrValue) ? attrValue : false;
20 },
21
22 /**
23 * @param {*} attrValue
24 * @param {number} min
25 * @param {number} max
26 * @param {?Logger} logger
27 * @return {number|boolean}
28 */
29 filterRange: function(attrValue, min, max, logger)
30 {
31 if (!/^(?:0|-?[1-9]\d*)$/.test(attrValue))
32 {
33 return false;
34 }
35
36 attrValue = parseInt(attrValue, 10);
37
38 if (attrValue < min)
39 {
40 if (logger)
41 {
42 logger.warn(
43 'Value outside of range, adjusted up to min value',
44 {
45 'attrValue' : attrValue,
46 'min' : min,
47 'max' : max
48 }
49 );
50 }
51
52 return min;
53 }
54
55 if (attrValue > max)
56 {
57 if (logger)
58 {
59 logger.warn(
60 'Value outside of range, adjusted down to max value',
61 {
62 'attrValue' : attrValue,
63 'min' : min,
64 'max' : max
65 }
66 );
67 }
68
69 return max;
70 }
71
72 return attrValue;
73 },
74
75 /**
76 * @param {*} attrValue
77 * @return {*}
78 */
79 filterUint: function(attrValue)
80 {
81 return /^(?:0|[1-9]\d*)$/.test(attrValue) ? attrValue : false;
82 }
83 };