KameSame Open Framework - Jquery module

Progress module for KameSame Open Framework

目前為 2022-10-07 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/451523/1101989/KameSame%20Open%20Framework%20-%20Jquery%20module.js

  1. "use strict";
  2. // ==UserScript==
  3. // @name KameSame Open Framework - Jquery module
  4. // @namespace timberpile
  5. // @description Progress module for KameSame Open Framework
  6. // @version 0.1
  7. // @copyright 2022+, Robin Findley, Timberpile
  8. // @license MIT; http://opensource.org/licenses/MIT
  9. // ==/UserScript==
  10. // These lines are necessary to make sure that TSC does not put any exports in the
  11. // compiled js, which causes the script to crash
  12. // eslint-disable-next-line no-var, @typescript-eslint/no-unused-vars
  13. // var module = {};
  14. ((global) => {
  15. const ksof = global.ksof;
  16. console.log(ksof);
  17. //########################################################################
  18. //------------------------------
  19. // Published interface
  20. //------------------------------
  21. // eslint-disable-next-line no-var
  22. var version = '';
  23. ksof.Jquery = {
  24. version: version,
  25. };
  26. //########################################################################
  27. ksof.ready('document')
  28. .then(function () {
  29. const promises = [];
  30. try {
  31. $.fn.jquery;
  32. }
  33. catch (e) {
  34. promises.push(ksof.load_script(ksof.support_files['jquery.js'], true /* cache */));
  35. }
  36. return Promise.all(promises);
  37. })
  38. .then(function (data) {
  39. version = $.fn.jquery;
  40. // Notify listeners that we are ready.
  41. // Delay guarantees include() callbacks are called before ready() callbacks.
  42. setTimeout(function () { ksof.set_state('ksof.Jquery', 'ready'); }, 0);
  43. });
  44. })(window);
  45. // module.exports = null;