MCPcopy Index your code
hub / github.com/violentmonkey/violentmonkey / NewScript

Function NewScript

src/background/utils/script.js:17–27  ·  view source on GitHub ↗
(tabId)

Source from the content-addressed store, hash-verified

15
16addOwnCommands({
17 async NewScript(tabId) {
18 const tab = tabId >= 0 && await getTab(tabId) || {};
19 const tabUrl = tab.url;
20 const url = injectableRe.test(tabUrl) && `${tabUrl.split(/[#?]/)[0]}*`;
21 const { host = 'example.org', domain } = url ? commands.GetTabDomain(url) : {};
22 return newScript({
23 url: url || `*://${host}/*`,
24 name: domain || '',
25 icon: tab.favIconUrl || '',
26 });
27 },
28});
29
30hookOptionsInit((changes, firstRun) => {

Callers

nothing calls this directly

Calls 3

getTabFunction · 0.90
newScriptFunction · 0.85
testMethod · 0.45

Tested by

no test coverage detected