Last active
August 5, 2020 17:24
-
-
Save jkozera/f3bbfdbeb1ffdcc08ef7a02acdfc625b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
function patchControls($, old$) { | |
var checkbox = $('<input type="checkbox" id="tests-checkbox"><label for="tests-checkbox">Tests</label></input>'); | |
checkbox.insertAfter(jQuery('.file-types.excludes h4')); | |
checkbox.click(() => { | |
$('.file-types.excludes input:text')[0].value = checkbox.is(':checked') ? '**/tests/**' : ''; | |
old$('.search-action.codicon-search-refresh').click(); | |
}); | |
} | |
function patchJQ(old$, jqjs) { | |
var attempt = 0; | |
var interval = setInterval(() => { | |
if (!window.jQuery) { | |
console.log('Trying eval().'); | |
eval(jqjs); | |
console.log('Attempt #' + (++attempt) + ': window.jQuery = ' + window.jQuery); | |
} | |
if (!window.jQuery) return; | |
clearInterval(interval); | |
window.$ = old$; | |
patchControls(window.jQuery, old$); | |
}, 3); | |
} | |
fetch('https://code.jquery.com/jquery-latest.min.js').then((r) => { return r.text(); }).then(patchJQ.bind(this, window.$)); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment