MCPcopy
hub / github.com/Tampermonkey/tampermonkey / reorderScripts

Function reorderScripts

src/background.js:3656–3673  ·  view source on GitHub ↗
(name, pos)

Source from the content-addressed store, hash-verified

3654};
3655
3656var reorderScripts = function(name, pos) {
3657 var scripts = determineScriptsToRun();
3658 // add position tag
3659 for (var i=0; i<scripts.length; i++) {
3660 var s = scripts[i];
3661 if (s.name == name) {
3662 var f = (s.position < pos) ? .5 : -.5;
3663 s.position = (Number(pos) + f);
3664 }
3665 }
3666 scripts = sortScripts(scripts);
3667 var p = 1;
3668 for (var i=0;i<scripts.length;i++) {
3669 var s = scripts[i];
3670 s.position = p++;
3671 storeScript(s.name, s, false);
3672 }
3673};
3674
3675var sortScripts = function(results) {
3676 var numComparisonAsc = function(a, b) { return a.position-b.position; };

Callers 4

convertDataFunction · 0.85
notifyOptionsTabFunction · 0.85
nextStepFunction · 0.85
background.jsFile · 0.85

Calls 3

determineScriptsToRunFunction · 0.85
storeScriptFunction · 0.85
sortScriptsFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…