Furaffinity-Prototype-Extensions

Library to hold common prototype extensions for your Furaffinity Script

目前為 2025-02-02 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/525666/1530872/Furaffinity-Prototype-Extensions.js

  1. // ==UserScript==
  2. // @name Furaffinity-Prototype-Extensions
  3. // @namespace Violentmonkey Scripts
  4. // @grant GM_info
  5. // @version 1.0.0
  6. // @author Midori Dragon
  7. // @description Library to hold common prototype extensions for your Furaffinity Script
  8. // @icon https://www.furaffinity.net/themes/beta/img/banners/fa_logo.png
  9. // @license MIT
  10. // ==/UserScript==
  11. // jshint esversion: 8
  12. (() => {
  13. "use strict";
  14. var __webpack_modules__ = {
  15. 177: () => {
  16. Node.prototype.insertBeforeThis = function(newNode) {
  17. var _a;
  18. null === (_a = this.parentNode) || void 0 === _a || _a.insertBefore(newNode, this);
  19. };
  20. Node.prototype.insertAfterThis = function(newNode) {
  21. var _a;
  22. null === (_a = this.parentNode) || void 0 === _a || _a.insertBefore(newNode, this.nextSibling);
  23. };
  24. Node.prototype.getIndexOfThis = function() {
  25. if (null == this.parentNode) return -1;
  26. return Array.from(this.parentNode.children).indexOf(this);
  27. };
  28. Node.prototype.readdToDom = function() {
  29. var _a;
  30. const clone = this.cloneNode(false);
  31. null === (_a = this.parentNode) || void 0 === _a || _a.replaceChild(clone, this);
  32. return clone;
  33. };
  34. },
  35. 536: () => {
  36. String.prototype.trimEnd = function(toTrim) {
  37. if (null == toTrim) return "";
  38. if ("" === toTrim || "" === this) return this.toString();
  39. let result = this.toString();
  40. for (;result.endsWith(toTrim); ) result = result.slice(0, -toTrim.length);
  41. return result;
  42. };
  43. String.prototype.trimStart = function(toTrim) {
  44. if (null == toTrim) return "";
  45. if ("" === toTrim || "" === this) return this.toString();
  46. let result = this.toString();
  47. for (;result.startsWith(toTrim); ) result = result.slice(toTrim.length);
  48. return result;
  49. };
  50. }
  51. }, __webpack_module_cache__ = {};
  52. function __webpack_require__(moduleId) {
  53. var cachedModule = __webpack_module_cache__[moduleId];
  54. if (void 0 !== cachedModule) return cachedModule.exports;
  55. var module = __webpack_module_cache__[moduleId] = {
  56. exports: {}
  57. };
  58. __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  59. return module.exports;
  60. }
  61. __webpack_require__.n = module => {
  62. var getter = module && module.__esModule ? () => module.default : () => module;
  63. __webpack_require__.d(getter, {
  64. a: getter
  65. });
  66. return getter;
  67. };
  68. __webpack_require__.d = (exports, definition) => {
  69. for (var key in definition) if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
  70. enumerable: true,
  71. get: definition[key]
  72. });
  73. };
  74. __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
  75. __webpack_require__(177), __webpack_require__(536);
  76. })();