html-snapshots 5.11.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HISTORY.md +6 -0
- package/README.md +66 -106
- package/lib/async/exists.js +1 -1
- package/lib/async/index.js +4 -3
- package/lib/common/index.js +31 -0
- package/lib/common/sitemap/sitemap-collection.js +2 -2
- package/lib/common/sitemap/sitemap.js +5 -6
- package/lib/html-snapshots.js +41 -78
- package/lib/input-generators/_base.js +12 -11
- package/lib/input-generators/array.js +1 -2
- package/lib/input-generators/index.js +2 -2
- package/lib/input-generators/robots.js +1 -1
- package/lib/input-generators/textfile.js +2 -2
- package/lib/playwright/index.js +125 -0
- package/lib/playwright/removeScripts.js +11 -0
- package/lib/puppeteer/index.js +7 -7
- package/lib/puppeteer/removeScripts.js +1 -1
- package/package.json +34 -31
- package/eslint.config.js +0 -23
- package/lib/phantom/customFilter.js +0 -24
- package/lib/phantom/default.js +0 -21
- package/lib/phantom/modules/cli.js +0 -100
- package/lib/phantom/modules/detectors.js +0 -48
- package/lib/phantom/modules/globals.js +0 -43
- package/lib/phantom/modules/selectorDetect.js +0 -108
- package/lib/phantom/modules/verbose.js +0 -71
- package/lib/phantom/removeScripts.js +0 -30
package/eslint.config.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const js = require('@eslint/js');
|
|
2
|
-
const globals = require('globals');
|
|
3
|
-
|
|
4
|
-
module.exports = [{
|
|
5
|
-
ignores: [
|
|
6
|
-
'tmp/**',
|
|
7
|
-
'coverage/**',
|
|
8
|
-
'examples/**',
|
|
9
|
-
'test/mocha/html-snapshots/server/**'
|
|
10
|
-
]
|
|
11
|
-
}, {
|
|
12
|
-
languageOptions: {
|
|
13
|
-
sourceType: 'commonjs',
|
|
14
|
-
globals: {
|
|
15
|
-
...globals.node
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
files: ["**/*.js"],
|
|
19
|
-
rules: {
|
|
20
|
-
...js.configs.recommended.rules,
|
|
21
|
-
"no-console": 0
|
|
22
|
-
}
|
|
23
|
-
}];
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* customFilter.js
|
|
3
|
-
*
|
|
4
|
-
* Produce a single snapshot for a web page.
|
|
5
|
-
* Snapshot taken when selector is(:visible).
|
|
6
|
-
* Applies a custom filter to the snapshot output.
|
|
7
|
-
*
|
|
8
|
-
* This is a phantomJS script that runs in phantomjs.
|
|
9
|
-
*
|
|
10
|
-
* Copyright (c) 2013 - 2025 Alex Grant, LocalNerve, contributors
|
|
11
|
-
* Licensed under the MIT license.
|
|
12
|
-
*/
|
|
13
|
-
var selectorDetect = require("./modules/selectorDetect");
|
|
14
|
-
var cli = require("./modules/cli");
|
|
15
|
-
var detectors = require("./modules/detectors");
|
|
16
|
-
|
|
17
|
-
var options = cli.selector();
|
|
18
|
-
var customFilter = require(options.module);
|
|
19
|
-
|
|
20
|
-
selectorDetect(
|
|
21
|
-
options,
|
|
22
|
-
options.useJQuery ? detectors.jquerySelector : detectors.querySelector,
|
|
23
|
-
customFilter
|
|
24
|
-
);
|
package/lib/phantom/default.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* default.js
|
|
3
|
-
*
|
|
4
|
-
* Produce a single snapshot for a web page.
|
|
5
|
-
* Snapshot taken when a selector is detected visible.
|
|
6
|
-
*
|
|
7
|
-
* This is a phantomJS script that runs in phantomjs.
|
|
8
|
-
*
|
|
9
|
-
* Copyright (c) 2013 - 2025 Alex Grant, LocalNerve, contributors
|
|
10
|
-
* Licensed under the MIT license.
|
|
11
|
-
*/
|
|
12
|
-
var selectorDetect = require("./modules/selectorDetect");
|
|
13
|
-
var cli = require("./modules/cli");
|
|
14
|
-
var detectors = require("./modules/detectors");
|
|
15
|
-
|
|
16
|
-
var options = cli.selector();
|
|
17
|
-
|
|
18
|
-
selectorDetect(
|
|
19
|
-
options,
|
|
20
|
-
options.useJQuery ? detectors.jquerySelector : detectors.querySelector
|
|
21
|
-
);
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* cli.js
|
|
3
|
-
*
|
|
4
|
-
* Handles phantomjs command line interface.
|
|
5
|
-
* Reads the command line arguments and returns options.
|
|
6
|
-
*
|
|
7
|
-
* This is a module for a phantomJS script that runs in phantomjs.
|
|
8
|
-
*
|
|
9
|
-
* Copyright (c) 2013 - 2025 Alex Grant, LocalNerve, contributors
|
|
10
|
-
* Licensed under the MIT license.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
var system = require("system");
|
|
14
|
-
var globals = require("./globals");
|
|
15
|
-
|
|
16
|
-
module.exports = {
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* command line argument handling for selector based snapshot scripts
|
|
20
|
-
* args: PHANTOM_SCRIPT OUTPUTFILE URL SELECTOR [TIMEOUT INTERVAL USEJQUERY FILTER]
|
|
21
|
-
*/
|
|
22
|
-
selector: function () {
|
|
23
|
-
|
|
24
|
-
var options = {};
|
|
25
|
-
var defaults = {
|
|
26
|
-
|
|
27
|
-
// outputFile (required)
|
|
28
|
-
// The file to write the snapshot to
|
|
29
|
-
// encoding is the same as served from url
|
|
30
|
-
outputFile: "snapshot.html",
|
|
31
|
-
|
|
32
|
-
// url (required)
|
|
33
|
-
// The url to produce the snapshot from
|
|
34
|
-
url: "http://localhost/",
|
|
35
|
-
|
|
36
|
-
// selector (required)
|
|
37
|
-
// The selector to wait for before taking the snapshot
|
|
38
|
-
// When the selector is visible, this defines document readiness
|
|
39
|
-
selector: "body",
|
|
40
|
-
|
|
41
|
-
// timeout (optional)
|
|
42
|
-
// The maximum amount of time (ms) to wait before giving up on the snapshot
|
|
43
|
-
timeout: 10000,
|
|
44
|
-
|
|
45
|
-
// checkInterval (optional)
|
|
46
|
-
// The frequency (ms) to check for document readiness
|
|
47
|
-
checkInterval: 250,
|
|
48
|
-
|
|
49
|
-
// useJQuery (optional)
|
|
50
|
-
// flag to indicate use jQuery selector or not. jQuery must already exist in page.
|
|
51
|
-
useJQuery: false,
|
|
52
|
-
|
|
53
|
-
// verbose (optional)
|
|
54
|
-
// flag to indicate verbose output is desired.
|
|
55
|
-
verbose: false
|
|
56
|
-
|
|
57
|
-
// module (optional)
|
|
58
|
-
// An external module to load
|
|
59
|
-
// (default undefined)
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
if (system.args.length < 4) {
|
|
63
|
-
globals.exit(3, "phantomjs script '"+system.args[0]+"' expected these arguments: OUTPUTFILE URL SELECTOR [TIMEOUT INTERVAL JQUERY MODULE]");
|
|
64
|
-
} else {
|
|
65
|
-
|
|
66
|
-
options.outputFile = system.args[1];
|
|
67
|
-
options.url = system.args[2];
|
|
68
|
-
options.selector = system.args[3];
|
|
69
|
-
if (system.args[4]) {
|
|
70
|
-
options.timeout = parseInt(system.args[4], 10);
|
|
71
|
-
}
|
|
72
|
-
if (system.args[5]) {
|
|
73
|
-
options.checkInterval = parseInt(system.args[5], 10);
|
|
74
|
-
}
|
|
75
|
-
if (system.args[6]) {
|
|
76
|
-
var useJQuery = system.args[6].toLowerCase();
|
|
77
|
-
options.useJQuery =
|
|
78
|
-
(useJQuery === "true" || useJQuery === "yes" || useJQuery === "1");
|
|
79
|
-
}
|
|
80
|
-
if (system.args[7]) {
|
|
81
|
-
var verbose = system.args[7].toLowerCase();
|
|
82
|
-
options.verbose =
|
|
83
|
-
(verbose === "true" || verbose === "yes" || verbose === "1");
|
|
84
|
-
}
|
|
85
|
-
if (system.args[8] && system.args[8] !== "undefined") {
|
|
86
|
-
options.module = system.args[8];
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// ensure defaults, replaces false with false in two cases (useJQuery, verbose)
|
|
90
|
-
Object.keys(defaults).forEach(function(prop) {
|
|
91
|
-
if (!options[prop]) {
|
|
92
|
-
options[prop] = defaults[prop];
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return options;
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* detectors.js
|
|
3
|
-
*
|
|
4
|
-
* A collection of detector functions that detect when a page is ready for a snapshot.
|
|
5
|
-
*
|
|
6
|
-
* The detector functions are run in PhantomJS page.evaluate in the context of a webpage,
|
|
7
|
-
* in a sandboxed execution context.
|
|
8
|
-
* Other special rules apply: http://phantomjs.org/api/webpage/method/evaluate.html
|
|
9
|
-
*
|
|
10
|
-
* The detector functions return true when the page is ready, false if not.
|
|
11
|
-
*
|
|
12
|
-
* This is a module for a phantomJS script that runs in phantomjs.
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) 2013 - 2025 Alex Grant, LocalNerve, contributors
|
|
15
|
-
* Licensed under the MIT license.
|
|
16
|
-
*/
|
|
17
|
-
/* global document, $ */
|
|
18
|
-
module.exports = {
|
|
19
|
-
|
|
20
|
-
// Use plain Web API detection, with standard selectors
|
|
21
|
-
// https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/Selectors
|
|
22
|
-
// Returns true on element visibility
|
|
23
|
-
querySelector: function(options) {
|
|
24
|
-
var result = false;
|
|
25
|
-
var el = document.querySelector(options.selector);
|
|
26
|
-
|
|
27
|
-
if (el) {
|
|
28
|
-
// el must be an HTMLElement that is visible
|
|
29
|
-
result = el.offsetWidth && el.offsetHeight;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return result;
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
// Use JQuery selectors
|
|
36
|
-
// Returns true on element visibility
|
|
37
|
-
jquerySelector: function(options) {
|
|
38
|
-
var result = false;
|
|
39
|
-
|
|
40
|
-
if (typeof $ !== "undefined") {
|
|
41
|
-
// the definition of document readiness is visibility
|
|
42
|
-
result = $(options.selector).is(":visible");
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return result;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* globals.js
|
|
3
|
-
*
|
|
4
|
-
* Globals and module utilities.
|
|
5
|
-
*
|
|
6
|
-
* This is a module for a phantomJS script that runs in phantomjs.
|
|
7
|
-
*
|
|
8
|
-
* Copyright (c) 2013 - 2025 Alex Grant, LocalNerve, contributors
|
|
9
|
-
* Licensed under the MIT license.
|
|
10
|
-
*/
|
|
11
|
-
/* global phantom */
|
|
12
|
-
/**
|
|
13
|
-
* Exit phantomJS
|
|
14
|
-
*/
|
|
15
|
-
function _exit(code, msg) {
|
|
16
|
-
if (code !== 0) {
|
|
17
|
-
console.error(msg);
|
|
18
|
-
} else {
|
|
19
|
-
console.log(msg);
|
|
20
|
-
}
|
|
21
|
-
phantom.exit(code);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Global error handler
|
|
26
|
-
*/
|
|
27
|
-
phantom.onError = function(msg, trace) {
|
|
28
|
-
var msgStack = ["PhantomJS error: " + msg];
|
|
29
|
-
if (trace && trace.length) {
|
|
30
|
-
msgStack.push("Trace:");
|
|
31
|
-
trace.forEach(function(t) {
|
|
32
|
-
msgStack.push(" -> " + (t.file || t.sourceURL) + ": " + t.line + (t.function ? " (in function " + t.function +")" : ""));
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
// Don't call _exit from here, causes strange crash w/linux rebuilt binary.
|
|
36
|
-
// https://github.com/ariya/phantomjs/issues/14132
|
|
37
|
-
console.log(msgStack.join("\n"));
|
|
38
|
-
phantom.exit(-1);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
module.exports = {
|
|
42
|
-
exit: _exit
|
|
43
|
-
};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* selectorDetect.js
|
|
3
|
-
*
|
|
4
|
-
* Produce a single snapshot for a web page when a given selector is detected.
|
|
5
|
-
*
|
|
6
|
-
* This is a module for a phantomJS script that runs in phantomjs.
|
|
7
|
-
*
|
|
8
|
-
* Copyright (c) 2013 - 2025 Alex Grant, LocalNerve, contributors
|
|
9
|
-
* Licensed under the MIT license.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
// Get the start time immediately since we're already in a PhantomJS process instance
|
|
13
|
-
// The spawner is already counting down (with allowances)...
|
|
14
|
-
var start = new Date().getTime();
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Dependencies, phantomjs
|
|
18
|
-
*/
|
|
19
|
-
var page = require("webpage").create();
|
|
20
|
-
var fs = require("fs");
|
|
21
|
-
var globals = require("./globals");
|
|
22
|
-
var verbose = require("./verbose");
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* waitFor
|
|
26
|
-
*
|
|
27
|
-
* Heavily borrowed from phantomJS 'waitFor' example
|
|
28
|
-
*/
|
|
29
|
-
function waitFor (testFx, onReady, onTimeout, timeout, checkInterval) {
|
|
30
|
-
var condition = false,
|
|
31
|
-
interval = setInterval(function () {
|
|
32
|
-
if ( (new Date().getTime() - start < timeout) && !condition ) {
|
|
33
|
-
// If not timeout yet and condition not yet fulfilled
|
|
34
|
-
condition = testFx();
|
|
35
|
-
} else {
|
|
36
|
-
clearInterval(interval); // Stop this interval
|
|
37
|
-
if ( !condition ) {
|
|
38
|
-
// If condition still not fulfilled (timeout but condition is 'false')
|
|
39
|
-
onTimeout();
|
|
40
|
-
} else {
|
|
41
|
-
// Condition fulfilled (timeout and/or condition is 'true')
|
|
42
|
-
onReady((new Date().getTime() - start));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}, checkInterval);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* snapshot
|
|
50
|
-
*
|
|
51
|
-
* Opens the page and waits for the selector to become visible. Then takes the html snapshot.
|
|
52
|
-
* Applies an optional output filter to the html content.
|
|
53
|
-
*
|
|
54
|
-
*/
|
|
55
|
-
function snapshot (options, detector, filter) {
|
|
56
|
-
filter = filter || function(content) { return content; };
|
|
57
|
-
|
|
58
|
-
console.log("Creating snapshot for "+options.url+"...");
|
|
59
|
-
|
|
60
|
-
// https://github.com/ariya/phantomjs/issues/10930
|
|
61
|
-
page.customHeaders = {
|
|
62
|
-
"Accept-Encoding": "identity"
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
// add optional verbose output
|
|
66
|
-
if (options.verbose) {
|
|
67
|
-
verbose(page);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// create the snapshot
|
|
71
|
-
page.open(options.url, {
|
|
72
|
-
resourceTimeout: options.timeout - 300 // a little space to report problems.
|
|
73
|
-
}, function (status) {
|
|
74
|
-
if (status !== "success") {
|
|
75
|
-
// if phantomJS could not load the page, so end right now
|
|
76
|
-
globals.exit(2, "Unable to load page " + options.url);
|
|
77
|
-
} else {
|
|
78
|
-
// phantomJS loaded the page, so wait for it to be ready
|
|
79
|
-
waitFor(
|
|
80
|
-
|
|
81
|
-
// The test to determine readiness
|
|
82
|
-
function () {
|
|
83
|
-
return page.evaluate(detector, {
|
|
84
|
-
selector: options.selector,
|
|
85
|
-
url: options.url
|
|
86
|
-
});
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
// The onReady callback
|
|
90
|
-
function (time) {
|
|
91
|
-
fs.write(options.outputFile, filter(page.content), "w");
|
|
92
|
-
globals.exit(0, "snapshot for "+options.url+" finished in "+time+" ms\n written to "+options.outputFile);
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
// The onTimeout callback
|
|
96
|
-
function () {
|
|
97
|
-
globals.exit(1, "timed out waiting for "+options.selector+" to become visible for "+options.url);
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
options.timeout,
|
|
101
|
-
options.checkInterval
|
|
102
|
-
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
module.exports = snapshot;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* verbose.js
|
|
3
|
-
*
|
|
4
|
-
* Adds handlers to WebPage module to produce additional output for debugging.
|
|
5
|
-
*
|
|
6
|
-
* This is a module for a phantomJS script that runs in phantomjs.
|
|
7
|
-
*
|
|
8
|
-
* Copyright (c) 2013 - 2025 Alex Grant, LocalNerve, contributors
|
|
9
|
-
* Licensed under the MIT license.
|
|
10
|
-
*/
|
|
11
|
-
/* global window */
|
|
12
|
-
var system = require("system");
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Decorate the given WebPage with handlers to produce verbose output.
|
|
16
|
-
* Source:
|
|
17
|
-
* https://newspaint.wordpress.com/2013/04/25/getting-to-the-bottom-of-why-a-phantomjs-page-load-fails/
|
|
18
|
-
*/
|
|
19
|
-
function verbose (page) {
|
|
20
|
-
|
|
21
|
-
page.onResourceError = function(resourceError) {
|
|
22
|
-
system.stderr.writeLine('= onResourceError()');
|
|
23
|
-
system.stderr.writeLine(' - unable to load url: "' + resourceError.url + '"');
|
|
24
|
-
system.stderr.writeLine(' - error code: ' + resourceError.errorCode + ', description: ' + resourceError.errorString );
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
page.onError = function(msg, trace) {
|
|
28
|
-
system.stderr.writeLine('= onError()');
|
|
29
|
-
var msgStack = [' ERROR: ' + msg];
|
|
30
|
-
if (trace) {
|
|
31
|
-
msgStack.push(' TRACE:');
|
|
32
|
-
trace.forEach(function(t) {
|
|
33
|
-
msgStack.push(' -> ' + t.file + ': ' + t.line + (t.function ? ' (in function "' + t.function + '")' : ''));
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
system.stderr.writeLine(msgStack.join('\n'));
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
page.onResourceRequested = function (request) {
|
|
40
|
-
system.stderr.writeLine('= onResourceRequested()');
|
|
41
|
-
system.stderr.writeLine(' request: ' + JSON.stringify(request, undefined, 4));
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
page.onResourceReceived = function(response) {
|
|
45
|
-
system.stderr.writeLine('= onResourceReceived()' );
|
|
46
|
-
system.stderr.writeLine(' id: ' + response.id + ', stage: "' + response.stage + '", response: ' + JSON.stringify(response));
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
page.onLoadStarted = function() {
|
|
50
|
-
system.stderr.writeLine('= onLoadStarted()');
|
|
51
|
-
var currentUrl = page.evaluate(function() {
|
|
52
|
-
return window.location.href;
|
|
53
|
-
});
|
|
54
|
-
system.stderr.writeLine(' leaving url: ' + currentUrl);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
page.onNavigationRequested = function(url, type, willNavigate, main) {
|
|
58
|
-
system.stderr.writeLine('= onNavigationRequested');
|
|
59
|
-
system.stderr.writeLine(' destination_url: ' + url);
|
|
60
|
-
system.stderr.writeLine(' type (cause): ' + type);
|
|
61
|
-
system.stderr.writeLine(' will navigate: ' + willNavigate);
|
|
62
|
-
system.stderr.writeLine(' from page\'s main frame: ' + main);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
page.onLoadFinished = function(status) {
|
|
66
|
-
system.stderr.writeLine('= onLoadFinished()');
|
|
67
|
-
system.stderr.writeLine(' status: ' + status);
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
module.exports = verbose;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* removeScripts.js
|
|
3
|
-
*
|
|
4
|
-
* Produce a single snapshot for a web page.
|
|
5
|
-
* Snapshot taken when selector is(:visible).
|
|
6
|
-
* Applies a single filter to remove any script tags.
|
|
7
|
-
*
|
|
8
|
-
* This is a phantomJS script that runs in phantomjs.
|
|
9
|
-
*
|
|
10
|
-
* Copyright (c) 2013 - 2025 Alex Grant, LocalNerve, contributors
|
|
11
|
-
* Licensed under the MIT license.
|
|
12
|
-
*/
|
|
13
|
-
var selectorDetect = require("./modules/selectorDetect");
|
|
14
|
-
var cli = require("./modules/cli");
|
|
15
|
-
var detectors = require("./modules/detectors");
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Remove all script tags from content
|
|
19
|
-
*/
|
|
20
|
-
function removeScriptTags(content) {
|
|
21
|
-
return content.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "");
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
var options = cli.selector();
|
|
25
|
-
|
|
26
|
-
selectorDetect(
|
|
27
|
-
options,
|
|
28
|
-
options.useJQuery ? detectors.jquerySelector : detectors.querySelector,
|
|
29
|
-
removeScriptTags
|
|
30
|
-
);
|