您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Firefox、Opera、Google Chrome向けのpolyfillです。
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/17895/113961/polyfill.js
// ==UserScript== // @name polyfill // @description Firefox、Opera、Google Chrome向けのpolyfillです。 // @version 1.1.0 // @license Mozilla Public License Version 2.0 (MPL 2.0); https://www.mozilla.org/MPL/2.0/ // @compatible Firefox // @compatible Opera 36以降 // @compatible Chrome // @author 100の人 // @homepage http://greasyfork.icu/scripts/17895 // ==/UserScript== (function () { 'use strict'; // Polyfill for Firefox, Opera, and Google Chrome if (new URLSearchParams('?').has('?')) { URLSearchParams = new Proxy(URLSearchParams, { construct: function (URLSearchParams, argumentsList) { if (argumentsList.length > 0 && !(argumentsList[0] instanceof URLSearchParams)) { argumentsList[0] = String(argumentsList[0]).replace(/^\?/, ''); } return new URLSearchParams(...argumentsList); }, }); } // Polyfill for Firefox 38 ESR if (!''.includes) { /** @see [Bug 1102219 – Rename String.prototype.contains to String.prototype.includes]{https://bugzilla.mozilla.org/show_bug.cgi?id=1102219} */ Object.defineProperty(String.prototype, 'includes', { writable: true, enumerable: false, configurable: true, value: String.prototype.contains, }); } // Polyfill for Opera and Google Chrome if (!(Symbol.iterator in NodeList.prototype)) { Object.defineProperties(NodeList.prototype, /** @lends NodeList# */ { /** * @see [Issue 401699 - chromium - Add iterator support to NodeList and friends]{@link https://code.google.com/p/chromium/issues/detail?id=401699} * @returns {Iterator.<Array.<number, Node>>} * @name NodeList#@@iterator */ [Symbol.iterator]: { writable: true, enumerable: false, configurable: true, value: function* () { for (var i = 0, l = this.length; i < l; i++) { yield this[i]; } } }, /** * @param {Function} callback * @param {*} thisArg * @function */ forEach: { writable: true, enumerable: true, configurable: true, value: Array.prototype.forEach }, /** * @returns {Iterator.<Array.<number, Node>>} * @function */ entries: { writable: true, enumerable: true, configurable: true, value: function* () { for (var i = 0, l = this.length; i < l; i++) { yield [i, this[i]]; } } }, /** * @returns {Iterator.<number>} * @function */ keys: { writable: true, enumerable: true, configurable: true, value: function* () { for (var i = 0, l = this.length; i < l; i++) { yield i; } } }, /** * @returns {Iterator.<Node>} * @function */ values: { writable: true, enumerable: true, configurable: true, value: function* () { for (var i = 0, l = this.length; i < l; i++) { yield this[i]; } } }, }); } })();