Skip to content

Instantly share code, notes, and snippets.

@kunki
Last active June 29, 2022 13:58
Show Gist options
  • Save kunki/afc4e69df868266f3eb0ed02fcf0546a to your computer and use it in GitHub Desktop.
Save kunki/afc4e69df868266f3eb0ed02fcf0546a to your computer and use it in GitHub Desktop.
優化115網盤文件重命名邏輯,支持修改後綴名。
// ==UserScript==
// @name 115-rename-enhancer
// @name:zh-CN 115重命名增强
// @name:zh-HK 115重命名增強
// @name:zh-TW 115重命名增強
// @version 0.1.1
// @author kunki
// @description 優化115網盤文件重命名邏輯,支持修改後綴名。
// @description:zh-CN 優化115網盤文件重命名邏輯,支持修改後綴名。
// @description:zh-HK 優化115網盤文件重命名邏輯,支持修改後綴名。
// @description:zh-TW 優化115網盤文件重命名邏輯,支持修改後綴名。
// @match https://115.com/*
// @exclude https://115.com/s/*
// @icon https://115.com/favicon.ico
// @grant none
// @license GPL-3.0 License
// @run-at document-end
// @namespace https://greasyfork.org/scripts/447226
// @supportURL https://gist.github.com/kunki/afc4e69df868266f3eb0ed02fcf0546a
// @homepageURL https://gist.github.com/kunki/afc4e69df868266f3eb0ed02fcf0546a
// ==/UserScript==
(function() {
let _indexOf = String.prototype.indexOf;
Object.defineProperty(String.prototype, 'indexOf', {
configurable: true,
writable: true,
value: function(search, start) {
try {
let me = String.prototype.indexOf;
// caller is forbidden in strict mode, so try and catch exception simply.
if (me.caller !== me) {
if (me.caller.toString().indexOf('cache.suffix') != -1) {
return -1;
}
}
} catch (e) {}
return _indexOf.apply(this, [search, start]);
},
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment