jQuery everywhere

injects jquery if not exists

目前为 2022-01-24 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name jQuery everywhere
  3. // @namespace https://greasyfork.org/en/users/12725-alistair1231
  4. // @version 0.2.2
  5. // @description injects jquery if not exists
  6. // @author Alistair1231
  7. // @match *://*/*
  8. // @grant GM_xmlhttpRequest
  9. // @license GPL-3.0
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. if(typeof jQuery=='undefined') {
  15. // https://stackoverflow.com/questions/54499985/how-can-i-load-an-external-script-on-a-webpage-using-tampermonkey
  16. GM_xmlhttpRequest({
  17. method : "GET",
  18. // from other domain than the @match one (.org / .com):
  19. url : "https://code.jquery.com/jquery-3.6.0.min.js",
  20. onload : (ev) =>
  21. {
  22. let e = document.createElement('script');
  23. e.innerText = ev.responseText;
  24. document.head.appendChild(e);
  25. }
  26. });
  27. }
  28. })();