MCPcopy Index your code
hub / github.com/Tampermonkey/tampermonkey / convertMgmtToMenuItems

Function convertMgmtToMenuItems

src/background.js:5265–5298  ·  view source on GitHub ↗
(tab, options)

Source from the content-addressed store, hash-verified

5263};
5264
5265var convertMgmtToMenuItems = function(tab, options) {
5266 if (options == undefined) options = false;
5267
5268 var url = tab ? tab.url : null;
5269 var scripts = [];
5270
5271 if (tab) {
5272 if (!ctxRegistry.isEmpty(tab.id)) {
5273 var it = function(i, v) {
5274 if (V || UV) console.log("Found at ctxRegistry["+tab.id+"].urls -> " + i);
5275
5276 var s = determineScriptsToRun(i);
5277 for (var j=0; j<s.length; j++) {
5278 var drin = false;
5279 for (var k=0; k<scripts.length; k++) {
5280 if (scripts[k].name == s[j].name) {
5281 drin = true;
5282 break;
5283 }
5284 }
5285 if (!drin) scripts.push(s[j]);
5286 }
5287 };
5288
5289 ctxRegistry.iterateUrls(tab.id, it);
5290 } else {
5291 console.log("bg: WARN: ctxRegistry["+tab.id+"].urls is empty!");
5292 }
5293 } else {
5294 scripts = determineScriptsToRun(url);
5295 }
5296
5297 return convertScriptsToMenuItems(scripts, options);
5298};
5299
5300/* ###clipboard ### */
5301

Callers 2

createActionMenuItemsFunction · 0.85
createOptionItemsFunction · 0.85

Calls 2

determineScriptsToRunFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…