// ==UserScript==
// @name 网盘文件批量重命名
// @namespace cloud-disk-plugin
// @version 0.0.3-beta
// @author realafei
// @description 网盘文件批量重命名,支持百度网盘
// @license MIT
// @icon data:image/png;base64,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
// @homepage https://github.com/realafei/cloud-disk-plugin
// @source https://github.com/realafei/cloud-disk-plugin
// @match https://pan.baidu.com/disk/main*
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.global.prod.js
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/system.min.js
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/extras/named-register.min.js
// @require data:application/javascript,%3B(typeof%20System!%3D'undefined')%26%26(System%3Dnew%20System.constructor())%3B
// @grant none
// ==/UserScript==
(a=>{if(typeof GM_addStyle=="function"){GM_addStyle(a);return}const r=document.createElement("style");r.textContent=a,document.head.append(r)})(' .fade-enter-from,.fade-leave-to{opacity:0}.fade-enter-to,.fade-leave-from{opacity:1}.fade-enter-active,.fade-leave-active{transition:opacity var(--transition-default)}.fade-bottom-enter-from,.fade-bottom-leave-to{opacity:0;transform:translateY(10%)}.fade-bottom-enter-to,.fade-bottom-leave-from{opacity:1;transform:none}.fade-bottom-enter-active,.fade-bottom-leave-active{transition:opacity .3s,transform .3s ease}:root{--color-white: #ffffff;--color-black: #000000;--color-primary: var(--color-primary-500);--color-primary-50: #eff8ff;--color-primary-100: #def1ff;--color-primary-200: #b6e4ff;--color-primary-300: #75d0ff;--color-primary-400: #2cb9ff;--color-primary-500: #06a7ff;--color-primary-600: #007fd4;--color-primary-700: #0065ab;--color-primary-800: #00558d;--color-primary-900: #064774;--color-primary-950: #042d4d;--color-gray: var(--color-gray-500);--color-gray-50: #f6f7f9;--color-gray-100: #edeef1;--color-gray-200: #d7dae0;--color-gray-300: #b4bbc5;--color-gray-400: #8b95a5;--color-gray-500: #636d7e;--color-gray-600: #576072;--color-gray-700: #474e5d;--color-gray-800: #3d434f;--color-gray-900: #363b44;--color-gray-950: #24262d;--color-red: var(--color-red-500);--color-red-50: #fef2f2;--color-red-100: #fee2e2;--color-red-200: #fecaca;--color-red-300: #fca5a5;--color-red-400: #f87171;--color-red-500: #ef4444;--color-red-600: #dc2626;--color-red-700: #b91c1c;--color-red-800: #991b1b;--color-red-900: #7f1d1d;--color-red-950: #450a0a;--gutter: 10px;--shadow: 0 3px 10px 0 rgba(0, 0, 0, .2);--shadow-md: 0 5px 16px 0 rgba(0, 0, 0, .3);--transition-all: all var(--transition-default);--transition-default: var(--transition-duration) var(--transition-timing-function);--transition-duration: .3s;--transition-timing-function: ease-in-out}.material-input[data-v-10b0d85a]{color:var(--color-gray);display:block;position:relative;font-size:14px;box-sizing:border-box;margin-top:.5rem;padding-top:.75rem;margin-bottom:.5rem;border-bottom:1px solid var(--color-gray);background-color:transparent}.material-input.is-focus[data-v-10b0d85a]{border-bottom-color:var(--color-primary)}.material-input_input[data-v-10b0d85a],.material-input_textarea[data-v-10b0d85a]{color:var(--color-gray-700);width:100%;min-height:1.25rem;transition:border-bottom-color var(--transition-default);box-sizing:border-box;line-height:1.25rem;padding-top:.25rem;border-bottom:1px solid transparent;padding-bottom:.25rem;background-color:inherit}.material-input.is-focus .material-input_input[data-v-10b0d85a],.material-input.is-focus .material-input_textarea[data-v-10b0d85a]{border-bottom-color:var(--color-primary)}.material-input_label[data-v-10b0d85a]{top:calc(100% - 1.375rem);left:.5rem;color:inherit;position:absolute;transition:top var(--transition-default),left var(--transition-default),color var(--transition-default),font-size var(--transition-default);line-height:1;background-color:transparent}.material-input.is-focus .material-input_label[data-v-10b0d85a]{color:var(--color-primary-600)}.material-input.is-active .material-input_label[data-v-10b0d85a]{top:0;left:0;font-size:.75rem}.material-radio[data-v-89299f62]{cursor:pointer}.material-radio.radio[data-v-89299f62]{display:inline-flex;min-width:1em;min-height:1em;white-space:nowrap;align-items:center}.material-checkbox+.material-radio[data-v-89299f62],.material-radio.radio+.material-radio.radio[data-v-89299f62]{margin-left:.5em}.material-radio.radio .material-radio-input[data-v-89299f62]{width:1em;height:1em;display:inline-block;position:relative}.material-radio.radio .material-radio-input[data-v-89299f62]:before{width:100%;height:100%;border:2px solid var(--color-primary);content:"";display:block;box-sizing:border-box;transition:var(--transition-all);border-radius:50%;background-color:transparent}.material-radio.radio .material-radio-input[data-v-89299f62]:after{top:50%;left:50%;width:0;height:0;content:"";display:block;position:absolute;transform:translate(-50%,-50%);box-sizing:border-box;transition:var(--transition-all);border-radius:50%;background-color:var(--color-primary)}.material-radio.radio.is-checked .material-radio-input[data-v-89299f62]:after{width:50%;height:50%}.material-radio.radio .material-radio-input-original[data-v-89299f62]{top:0;left:0;width:0;height:0;margin:0;z-index:-1;outline:none;opacity:0;position:absolute}.material-radio.radio .material-radio-label[data-v-89299f62]{margin-left:.5em}.material-radio.button[data-v-89299f62]{color:var(--color-gray-900);height:auto;border:1px solid var(--color-gray-300);padding:8px 15px;transition:var(--transition-all);line-height:1;border-radius:var(--gutter);background-color:var(--color-white)}.material-radio.button[data-v-89299f62]:has(+.material-radio.button){border-right:none;border-top-right-radius:0;border-bottom-right-radius:0}.material-radio.button+.material-radio.button[data-v-89299f62]{border-left:none;border-top-left-radius:0;border-bottom-left-radius:0}.material-radio.button.is-checked[data-v-89299f62]{color:var(--color-gray-50);border-color:var(--color-primary);background-color:var(--color-primary)}.material-radio.button .material-radio-input-original[data-v-89299f62]{top:0;left:0;width:0;height:0;margin:0;z-index:-1;outline:none;opacity:0;position:absolute}*:has(>.material-loading){position:relative}.material-loading[data-v-9bee3f9f]{top:0;left:0;right:0;bottom:0;margin:0;z-index:2000;display:flex;position:absolute;transition:opacity var(--el-transition-default);align-items:center;justify-content:center;background-color:#ffffffe6}.material-loading-spinner[data-v-9bee3f9f]{width:2em;height:2em;animation:spin-9bee3f9f 1s linear infinite}.material-loading-spinner-path[data-v-9bee3f9f]{stroke:var(--color-primary);animation:loading-dash-9bee3f9f 1.5s ease-in-out infinite;stroke-width:.2em;stroke-linecap:round;stroke-dasharray:90,150;stroke-dashoffset:0}@keyframes spin-9bee3f9f{to{transform:rotate(1turn)}}@keyframes loading-dash-9bee3f9f{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}to{stroke-dasharray:90,150;stroke-dashoffset:-120px}}.material-checkbox[data-v-fb8b54b7]{cursor:pointer;display:inline-flex;min-width:1em;min-height:1em;white-space:nowrap;align-items:center}.material-radio+.material-checkbox[data-v-fb8b54b7],.material-checkbox+.material-checkbox[data-v-fb8b54b7]{margin-left:.5em}.material-checkbox-input[data-v-fb8b54b7]{width:1em;height:1em;display:inline-block;position:relative}.material-checkbox-input[data-v-fb8b54b7]:before{width:100%;height:100%;content:"";display:block;box-sizing:border-box;transition:var(--transition-all);border-top:2px solid var(--color-primary);border-left:2px solid var(--color-primary);border-right:2px solid var(--color-primary);border-bottom:2px solid var(--color-primary);border-radius:2px;background-color:transparent}.material-checkbox .material-checkbox-input[data-v-fb8b54b7]:after{top:50%;left:50%;width:0;height:0;content:"";display:block;position:absolute}.material-checkbox:not(.is-indeterminate) .material-checkbox-input[data-v-fb8b54b7]:after{top:0;left:30%;width:40%;height:80%;content:"";display:block;position:absolute;transform:rotate(40deg);box-sizing:border-box;transition:var(--transition-all);border-right:2px solid transparent;border-bottom:2px solid transparent}.material-checkbox.is-checked .material-checkbox-input[data-v-fb8b54b7]:before{background-color:var(--color-primary)}.material-checkbox.is-checked:not(.is-indeterminate) .material-checkbox-input[data-v-fb8b54b7]:after{border-right-color:#fff;border-bottom-color:#fff}.material-checkbox.is-indeterminate .material-checkbox-input[data-v-fb8b54b7]:before{background-color:var(--color-primary)}.material-checkbox.is-indeterminate .material-checkbox-input[data-v-fb8b54b7]:after{top:50%;left:50%;width:60%;height:2px;content:"";display:block;position:absolute;transform:translate(-50%,-50%);box-sizing:border-box;transition:var(--transition-all);background-color:var(--color-white)}.material-checkbox-input-original[data-v-fb8b54b7]{top:0;left:0;width:0;height:0;margin:0;z-index:-1;outline:none;opacity:0;position:absolute}.material-checkbox-label[data-v-fb8b54b7]{margin-left:.5em}.main-panel[data-v-6addc32b]{top:0;left:0;right:0;z-index:10000;display:flex;position:fixed;align-items:end;justify-content:center}.main-panel[data-v-6addc32b]:has(div){height:100vh}.main-panel-mask[data-v-6addc32b]{width:100vw;height:100vh;position:absolute;-webkit-backdrop-filter:blur(5px);backdrop-filter:blur(5px)}.main-panel-content[data-v-6addc32b]{z-index:1;display:grid;padding:var(--gutter);grid-gap:var(--gutter);overflow:hidden;max-width:100vw;min-width:768px;min-height:60vh;max-height:90vh;box-sizing:border-box;box-shadow:var(--shadow);background-color:var(--color-white);grid-template-rows:auto 1fr;border-top-left-radius:var(--gutter);border-top-right-radius:var(--gutter)}.main-panel-content-header[data-v-6addc32b]{padding:var(--gutter);border-radius:var(--gutter);background-color:var(--color-gray-100)}.main-panel-content-header-title[data-v-6addc32b]{display:flex;align-items:top;justify-content:space-between}.main-panel-content-header-title-content[data-v-6addc32b]{font-size:18px}.main-panel-content-header-title-current-version[data-v-6addc32b]{font-size:12px}.main-panel-content-header-title-new-version[data-v-6addc32b]{color:var(--color-red);font-size:12px}.main-panel-content-header-form[data-v-6addc32b]{display:grid;grid-gap:var(--gutter);grid-template-columns:1fr 1fr}.main-panel-content-header-ctrl[data-v-6addc32b]{display:grid;grid-gap:var(--gutter);margin-top:var(--gutter);grid-template-columns:1fr auto auto}.main-panel-content-header-ctrl-option[data-v-6addc32b]{display:flex;align-items:center}.main-panel-content-header-ctrl-confirm-button[data-v-6addc32b]{color:var(--color-primary-700);height:auto;padding:8px 15px;transition:var(--transition-all);line-height:1;border-color:transparent;border-radius:var(--gutter);background-color:transparent}.main-panel-content-header-ctrl-confirm-button[data-v-6addc32b]:hover{color:var(--color-primary-50);background-color:var(--color-primary-700)}.main-panel-content-header-ctrl-confirm-button[disabled][data-v-6addc32b]{color:var(--color-gray-500);cursor:not-allowed}.main-panel-content-header-ctrl-confirm-button[disabled][data-v-6addc32b]:hover{color:var(--color-gray-700);background-color:var(--color-gray-100)}.main-panel-content-header-ctrl-reset-button[data-v-6addc32b]{color:var(--color-gray-500);height:auto;padding:8px 15px;transition:var(--transition-all);line-height:1;border-color:transparent;border-radius:var(--gutter);background-color:transparent}.main-panel-content-header-ctrl-reset-button[data-v-6addc32b]:hover{color:var(--color-gray-50);background-color:var(--color-gray-300)}.main-panel-content-body[data-v-6addc32b]{overflow:auto}.main-panel-content-body-grid[data-v-6addc32b]{display:grid;grid-gap:10px;font-size:12px;line-height:1;grid-template-columns:auto minmax(200px,1fr) auto minmax(200px,1fr)}.main-panel-content-body-grid-item[data-v-6addc32b]{display:contents;color:var(--color-gray)}.main-panel-content-body-grid-item.is-change[data-v-6addc32b]{color:var(--color-gray-900)}.main-panel-content-body-grid-item.is-error[data-v-6addc32b]{color:var(--color-red)}.main-panel-content-body-grid-item:not(.is-checked) .main-panel-content-body-grid-item-new_file_name[data-v-6addc32b]{color:var(--color-gray-300)}.enter-component[data-v-3ff86bbd]{margin-right:16px}.enter-component-button[data-v-3ff86bbd]{color:#fff;border:none;height:32px;cursor:pointer;padding:8px 24px;font-size:14px;transition:var(--transition-all);line-height:1;font-weight:700;white-space:nowrap;border-radius:16px;background-image:linear-gradient(135deg,var(--color-primary-400) 0%,var(--color-primary-600) 100%)}.enter-component-button[data-v-3ff86bbd]:hover{background-image:linear-gradient(135deg,var(--color-primary-600) 0%,var(--color-primary-700) 100%)}.enter-component-button[data-v-3ff86bbd]:active{background-image:linear-gradient(135deg,var(--color-primary-600) 0%,var(--color-primary-800) 100%)}.enter-component-button[disabled][data-v-3ff86bbd]{color:var(--color-primary-700);cursor:not-allowed;background-image:linear-gradient(135deg,var(--color-primary-100) 0%,var(--color-primary-300) 100%)} ');
System.addImportMap({ imports: {"vue":"user:vue"} });
System.set("user:vue", (()=>{const _=Vue;('default' in _)||(_.default=_);return _})());
System.register("./__entry.js", ['./__monkey.entry-V4Jgkl1w.js', 'vue'], (function (exports, module) {
'use strict';
return {
setters: [null, null],
execute: (function () {
})
};
}));
System.register("./__monkey.entry-V4Jgkl1w.js", ['vue'], (function (exports, module) {
'use strict';
var defineComponent, computed, ref, onMounted, inject, onUnmounted, defineAsyncComponent, nextTick, createApp, openBlock, createElementBlock, normalizeClass, toDisplayString, createCommentVNode, withDirectives, vModelDynamic, normalizeStyle, vModelText, createElementVNode, Fragment, createTextVNode, renderSlot, resolveComponent, createBlock, Teleport, createVNode, Transition, withCtx, renderList, resolveDynamicComponent, pushScopeId, popScopeId;
return {
setters: [module => {
defineComponent = module.defineComponent;
computed = module.computed;
ref = module.ref;
onMounted = module.onMounted;
inject = module.inject;
onUnmounted = module.onUnmounted;
defineAsyncComponent = module.defineAsyncComponent;
nextTick = module.nextTick;
createApp = module.createApp;
openBlock = module.openBlock;
createElementBlock = module.createElementBlock;
normalizeClass = module.normalizeClass;
toDisplayString = module.toDisplayString;
createCommentVNode = module.createCommentVNode;
withDirectives = module.withDirectives;
vModelDynamic = module.vModelDynamic;
normalizeStyle = module.normalizeStyle;
vModelText = module.vModelText;
createElementVNode = module.createElementVNode;
Fragment = module.Fragment;
createTextVNode = module.createTextVNode;
renderSlot = module.renderSlot;
resolveComponent = module.resolveComponent;
createBlock = module.createBlock;
Teleport = module.Teleport;
createVNode = module.createVNode;
Transition = module.Transition;
withCtx = module.withCtx;
renderList = module.renderList;
resolveDynamicComponent = module.resolveDynamicComponent;
pushScopeId = module.pushScopeId;
popScopeId = module.popScopeId;
}],
execute: (function () {
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
const is = (val, type) => Object.prototype.toString.call(val) === `[object ${type}]`;
const isString = (val) => is(val, "String");
const isNull = (val) => val === null;
const isUndefined = (val) => val === void 0;
const isVoid = (val) => isNull(val) || isUndefined(val);
const isEmpty = (val) => isVoid(val) || val === "";
const _sfc_main$5 = defineComponent({
name: "MaterialInput",
props: {
modelValue: {
type: [String, Number],
default: ""
},
label: {
type: String,
default: ""
},
type: {
type: String,
default: "textarea"
},
disabled: {
type: Boolean,
default: false
},
readonly: {
type: Boolean,
default: false
},
placeholder: {
type: String,
default: ""
}
},
emits: ["update:modelValue"],
setup(props, { emit }) {
const computedValue = computed({
get: () => props.modelValue,
set: (val) => emit("update:modelValue", val)
});
const computedPlaceholder = computed(
() => props.label ? "" : props.placeholder
);
const isFocus = ref(false);
const isActive = computed(
() => !isEmpty(props.modelValue) || isFocus.value
);
const inputRef = ref();
const textareaRef = ref();
const textareaStyle = ref({});
const onInputBlur = () => {
isFocus.value = false;
};
const onInputFocus = () => {
isFocus.value = true;
};
const onTextareaBlur = () => {
isFocus.value = false;
calcTextareaStyle();
};
const onTextareaFocus = () => {
isFocus.value = true;
calcTextareaStyle();
};
const onTextareaInput = () => {
calcTextareaStyle();
};
const calcTextareaStyle = () => {
textareaStyle.value.height = "auto";
nextTick(() => {
var _a;
textareaStyle.value.height = ((_a = textareaRef.value) == null ? void 0 : _a.value) ? textareaRef.value.scrollHeight + 1 + "px" : "auto";
});
};
onMounted(() => {
if (props.type === "textarea") {
onTextareaInput();
}
});
return {
computedValue,
computedPlaceholder,
isFocus,
isActive,
inputRef,
textareaRef,
textareaStyle,
onInputBlur,
onInputFocus,
onTextareaBlur,
onTextareaInput,
onTextareaFocus
};
}
});
const _export_sfc = exports("_", (sfc, props) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target[key] = val;
}
return target;
});
const _hoisted_1$4 = {
key: 0,
class: "material-input_label"
};
const _hoisted_2$4 = ["type", "value", "disabled", "readonly", "placeholder"];
const _hoisted_3$4 = ["disabled", "readonly", "placeholder"];
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("label", {
class: normalizeClass(["material-input", { "is-focus": _ctx.isFocus, "is-active": _ctx.isActive }])
}, [
_ctx.label ? (openBlock(), createElementBlock("div", _hoisted_1$4, toDisplayString(_ctx.label), 1)) : createCommentVNode("", true),
_ctx.type !== "textarea" ? withDirectives((openBlock(), createElementBlock("input", {
key: 1,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.computedValue = $event),
ref: "inputRef",
class: "material-input_input",
type: _ctx.type,
value: _ctx.modelValue,
disabled: _ctx.disabled,
readonly: _ctx.readonly,
placeholder: _ctx.computedPlaceholder,
onBlur: _cache[1] || (_cache[1] = (...args) => _ctx.onInputBlur && _ctx.onInputBlur(...args)),
onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.onInputFocus && _ctx.onInputFocus(...args))
}, null, 40, _hoisted_2$4)), [
[vModelDynamic, _ctx.computedValue]
]) : withDirectives((openBlock(), createElementBlock("textarea", {
key: 2,
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => _ctx.computedValue = $event),
ref: "textareaRef",
class: "material-input_textarea",
rows: "1",
style: normalizeStyle(_ctx.textareaStyle),
disabled: _ctx.disabled,
readonly: _ctx.readonly,
placeholder: _ctx.computedPlaceholder,
onBlur: _cache[4] || (_cache[4] = (...args) => _ctx.onTextareaBlur && _ctx.onTextareaBlur(...args)),
onFocus: _cache[5] || (_cache[5] = (...args) => _ctx.onTextareaFocus && _ctx.onTextareaFocus(...args)),
onInput: _cache[6] || (_cache[6] = (...args) => _ctx.onTextareaInput && _ctx.onTextareaInput(...args))
}, null, 44, _hoisted_3$4)), [
[vModelText, _ctx.computedValue]
])
], 2);
}
const MaterialInput = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5], ["__scopeId", "data-v-10b0d85a"]]);
const _sfc_main$4 = defineComponent({
name: "MaterialRadio",
props: {
modelValue: {
type: [String, Number, Boolean],
default: false
},
label: {
type: [String, Number, Boolean],
default: ""
},
disabled: {
type: Boolean,
default: false
},
readonly: {
type: Boolean,
default: false
},
type: {
type: String,
default: "radio"
}
},
emits: ["update:modelValue"],
setup(props, { emit }) {
const isChecked = computed(() => props.modelValue === props.label);
const onChange = () => {
if (!props.disabled && !props.readonly) {
emit("update:modelValue", props.label);
}
};
return {
isChecked,
onChange
};
}
});
const _hoisted_1$3 = { class: "material-radio-input" };
const _hoisted_2$3 = ["value", "checked"];
const _hoisted_3$3 = {
key: 0,
class: "material-radio-label"
};
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("label", {
class: normalizeClass(["material-radio", {
"is-disabled": _ctx.disabled,
"is-readonly": _ctx.readonly,
"is-checked": _ctx.isChecked,
[_ctx.type]: true
}]),
onChange: _cache[0] || (_cache[0] = (...args) => _ctx.onChange && _ctx.onChange(...args))
}, [
createElementVNode("span", _hoisted_1$3, [
createElementVNode("input", {
class: "material-radio-input-original",
type: "radio",
value: _ctx.label,
checked: _ctx.isChecked
}, null, 8, _hoisted_2$3)
]),
_ctx.label || _ctx.$slots.default ? (openBlock(), createElementBlock("span", _hoisted_3$3, [
!_ctx.$slots.default && _ctx.label ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
createTextVNode(toDisplayString(_ctx.label), 1)
], 64)) : createCommentVNode("", true),
renderSlot(_ctx.$slots, "default", {}, void 0, true)
])) : createCommentVNode("", true)
], 34);
}
const MaterialRadio = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4], ["__scopeId", "data-v-89299f62"]]);
const _sfc_main$3 = defineComponent({
name: "MaterialLoading"
});
const _withScopeId$1 = (n) => (pushScopeId("data-v-9bee3f9f"), n = n(), popScopeId(), n);
const _hoisted_1$2 = { class: "material-loading" };
const _hoisted_2$2 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("svg", {
class: "material-loading-spinner",
viewBox: "0 0 50 50"
}, [
/* @__PURE__ */ createElementVNode("circle", {
class: "material-loading-spinner-path",
cx: "25",
cy: "25",
r: "20",
fill: "none"
})
], -1));
const _hoisted_3$2 = [
_hoisted_2$2
];
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", _hoisted_1$2, _hoisted_3$2);
}
const MaterialLoading = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["__scopeId", "data-v-9bee3f9f"]]);
const _sfc_main$2 = defineComponent({
name: "MaterialCheckbox",
props: {
modelValue: {
type: Boolean,
default: false
},
label: {
type: String,
default: ""
},
disabled: {
type: Boolean,
default: false
},
readonly: {
type: Boolean,
default: false
},
indeterminate: {
type: Boolean,
default: false
}
},
emits: ["update:modelValue"],
setup(props, { emit }) {
const onChange = () => {
if (!props.disabled && !props.readonly) {
emit("update:modelValue", !props.modelValue);
}
};
return {
onChange
};
}
});
const _hoisted_1$1 = { class: "material-checkbox-input" };
const _hoisted_2$1 = ["checked"];
const _hoisted_3$1 = {
key: 0,
class: "material-checkbox-label"
};
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("label", {
class: normalizeClass(["material-checkbox", {
"is-checked": _ctx.modelValue,
"is-disabled": _ctx.disabled,
"is-readonly": _ctx.readonly,
"is-indeterminate": _ctx.indeterminate
}]),
onChange: _cache[0] || (_cache[0] = (...args) => _ctx.onChange && _ctx.onChange(...args))
}, [
createElementVNode("span", _hoisted_1$1, [
createElementVNode("input", {
class: "material-checkbox-input-original",
type: "checkbox",
checked: _ctx.modelValue
}, null, 8, _hoisted_2$1)
]),
_ctx.label || _ctx.$slots.default ? (openBlock(), createElementBlock("span", _hoisted_3$1, [
!_ctx.$slots.default && _ctx.label ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
createTextVNode(toDisplayString(_ctx.label), 1)
], 64)) : createCommentVNode("", true),
renderSlot(_ctx.$slots, "default", {}, void 0, true)
])) : createCommentVNode("", true)
], 34);
}
const MaterialCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-fb8b54b7"]]);
const regexp$1 = /@version\s+(.+)\n/;
const getNewVersion = () => {
return fetch(`${"https://update.greasyfork.org/scripts/488421/%E7%BD%91%E7%9B%98%E6%96%87%E4%BB%B6%E6%89%B9%E9%87%8F%E9%87%8D%E5%91%BD%E5%90%8D.meta.js"}?t=${Date.now()}`).then((res) => {
if (res.ok) {
return res.text();
} else {
return Promise.reject(new Error("getNewVersion error"));
}
}).then((res) => {
var _a;
return ((_a = regexp$1.exec(res)) == null ? void 0 : _a[1]) || "";
});
};
const useVersion = () => {
const currentVersion = "0.0.3-beta";
const newVersion = ref("");
const hasNewVersion = ref(false);
const updateUrl = "https://update.greasyfork.org/scripts/488421/%E7%BD%91%E7%9B%98%E6%96%87%E4%BB%B6%E6%89%B9%E9%87%8F%E9%87%8D%E5%91%BD%E5%90%8D.user.js";
onMounted(() => {
getNewVersion().then((res) => {
newVersion.value = res;
hasNewVersion.value = currentVersion !== res;
});
});
return {
currentVersion,
newVersion,
hasNewVersion,
updateUrl
};
};
const _sfc_main$1 = defineComponent({
name: "MainPanel",
components: {
MaterialInput,
MaterialRadio,
MaterialLoading,
MaterialCheckbox
},
setup() {
const { currentVersion, newVersion, hasNewVersion, updateUrl } = useVersion();
const providerRef = inject("providerRef");
const onMaskClick = () => {
if (!(providerRef == null ? void 0 : providerRef.value.isLoading)) {
providerRef == null ? void 0 : providerRef.value.setVisible(false);
}
};
const onResetClick = () => {
providerRef == null ? void 0 : providerRef.value.reset();
};
const onConfirmClick = () => {
providerRef == null ? void 0 : providerRef.value.batchRename();
};
const onIsCheckUpdate = (item, val) => {
providerRef == null ? void 0 : providerRef.value.updateItemIsCheck(item, val);
};
const onCheckedAllUpdate = (val) => {
providerRef == null ? void 0 : providerRef.value.updateCheckedAll(val);
};
const currentList = ref([]);
const updateCurrentList = (val) => {
currentList.value = val;
};
onMounted(() => {
providerRef == null ? void 0 : providerRef.value.onCurrentListUpdate(updateCurrentList);
});
onUnmounted(() => {
providerRef == null ? void 0 : providerRef.value.offCurrentListUpdate(updateCurrentList);
});
return {
currentVersion,
newVersion,
hasNewVersion,
updateUrl,
providerRef,
currentList,
onMaskClick,
onResetClick,
onConfirmClick,
onIsCheckUpdate,
onCheckedAllUpdate
};
}
});
const _withScopeId = (n) => (pushScopeId("data-v-6addc32b"), n = n(), popScopeId(), n);
const _hoisted_1 = {
key: 0,
class: "main-panel"
};
const _hoisted_2 = {
key: 0,
class: "main-panel-content"
};
const _hoisted_3 = { class: "main-panel-content-header" };
const _hoisted_4 = { class: "main-panel-content-header-title" };
const _hoisted_5 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { class: "main-panel-content-header-title-content" }, " 批量重命名当前目录下所有文件 ", -1));
const _hoisted_6 = ["href"];
const _hoisted_7 = {
key: 1,
class: "main-panel-content-header-title-current-version"
};
const _hoisted_8 = {
key: 0,
class: "main-panel-content-header-form"
};
const _hoisted_9 = { class: "main-panel-content-header-form-item" };
const _hoisted_10 = { class: "main-panel-content-header-form-item" };
const _hoisted_11 = { class: "main-panel-content-header-form-item" };
const _hoisted_12 = { class: "main-panel-content-header-form-item" };
const _hoisted_13 = { class: "main-panel-content-header-ctrl" };
const _hoisted_14 = { class: "main-panel-content-header-ctrl-option" };
const _hoisted_15 = ["disabled"];
const _hoisted_16 = ["disabled"];
const _hoisted_17 = { class: "main-panel-content-body" };
const _hoisted_18 = { class: "main-panel-content-body-grid" };
const _hoisted_19 = { class: "main-panel-content-body-grid-item-checkbox" };
const _hoisted_20 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "main-panel-content-body-grid-item-old_file_name" }, " 原文件名 ", -1));
const _hoisted_21 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "main-panel-content-body-grid-item-right-arrow" }, " ⮕ ", -1));
const _hoisted_22 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "main-panel-content-body-grid-item-new_file_name" }, " 新文件名 ", -1));
const _hoisted_23 = { class: "main-panel-content-body-grid-item-checkbox" };
const _hoisted_24 = ["title"];
const _hoisted_25 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "main-panel-content-body-grid-item-right-arrow" }, " ⮕ ", -1));
const _hoisted_26 = ["title"];
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
const _component_material_input = resolveComponent("material-input");
const _component_material_radio = resolveComponent("material-radio");
const _component_material_checkbox = resolveComponent("material-checkbox");
const _component_material_loading = resolveComponent("material-loading");
return openBlock(), createBlock(Teleport, { to: "body" }, [
_ctx.providerRef ? (openBlock(), createElementBlock("div", _hoisted_1, [
createVNode(Transition, { name: "fade" }, {
default: withCtx(() => [
_ctx.providerRef.visible ? (openBlock(), createElementBlock("div", {
key: 0,
class: "main-panel-mask",
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onMaskClick && _ctx.onMaskClick(...args))
})) : createCommentVNode("", true)
]),
_: 1
}),
createVNode(Transition, { name: "fade-bottom" }, {
default: withCtx(() => [
_ctx.providerRef.visible ? (openBlock(), createElementBlock("div", _hoisted_2, [
createElementVNode("div", _hoisted_3, [
createElementVNode("div", _hoisted_4, [
_hoisted_5,
_ctx.hasNewVersion ? (openBlock(), createElementBlock("a", {
key: 0,
href: _ctx.updateUrl,
target: "_blank",
class: "main-panel-content-header-title-new-version"
}, " 发现新版本:" + toDisplayString(_ctx.newVersion) + " 点击更新 ", 9, _hoisted_6)) : (openBlock(), createElementBlock("span", _hoisted_7, " 当前版本:" + toDisplayString(_ctx.currentVersion), 1))
]),
_ctx.providerRef.replaceParams ? (openBlock(), createElementBlock("form", _hoisted_8, [
_ctx.providerRef.replaceParams.renameMode === "series" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
createElementVNode("div", _hoisted_9, [
createVNode(_component_material_input, {
modelValue: _ctx.providerRef.replaceParams.title,
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.providerRef.replaceParams.title = $event),
label: "剧名"
}, null, 8, ["modelValue"])
]),
createElementVNode("div", _hoisted_10, [
createVNode(_component_material_input, {
modelValue: _ctx.providerRef.replaceParams.season,
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.providerRef.replaceParams.season = $event),
label: "季数",
type: "number"
}, null, 8, ["modelValue"])
])
], 64)) : createCommentVNode("", true),
_ctx.providerRef.replaceParams.renameMode === "pattern" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
createElementVNode("div", _hoisted_11, [
createVNode(_component_material_input, {
modelValue: _ctx.providerRef.replaceParams.pattern,
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => _ctx.providerRef.replaceParams.pattern = $event),
label: "正则"
}, null, 8, ["modelValue"])
]),
createElementVNode("div", _hoisted_12, [
createVNode(_component_material_input, {
modelValue: _ctx.providerRef.replaceParams.replace,
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.providerRef.replaceParams.replace = $event),
label: "替换文本"
}, null, 8, ["modelValue"])
])
], 64)) : createCommentVNode("", true)
])) : createCommentVNode("", true),
createElementVNode("div", _hoisted_13, [
createElementVNode("div", _hoisted_14, [
createVNode(_component_material_radio, {
modelValue: _ctx.providerRef.replaceParams.renameMode,
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => _ctx.providerRef.replaceParams.renameMode = $event),
label: "series"
}, {
default: withCtx(() => [
createTextVNode(" 剧集模式 ")
]),
_: 1
}, 8, ["modelValue"]),
createVNode(_component_material_radio, {
modelValue: _ctx.providerRef.replaceParams.renameMode,
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => _ctx.providerRef.replaceParams.renameMode = $event),
label: "pattern"
}, {
default: withCtx(() => [
createTextVNode(" 正则模式 ")
]),
_: 1
}, 8, ["modelValue"]),
createVNode(_component_material_checkbox, {
modelValue: _ctx.providerRef.replaceParams.autoEpisode,
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => _ctx.providerRef.replaceParams.autoEpisode = $event)
}, {
default: withCtx(() => [
createTextVNode(" 自动集数 ")
]),
_: 1
}, 8, ["modelValue"])
]),
createElementVNode("button", {
class: "main-panel-content-header-ctrl-reset-button",
disabled: _ctx.providerRef.isLoading,
onClick: _cache[8] || (_cache[8] = (...args) => _ctx.onResetClick && _ctx.onResetClick(...args))
}, " 重置 ", 8, _hoisted_15),
createElementVNode("button", {
class: "main-panel-content-header-ctrl-confirm-button",
disabled: !_ctx.providerRef.shouldContinue || _ctx.providerRef.isLoading,
onClick: _cache[9] || (_cache[9] = (...args) => _ctx.onConfirmClick && _ctx.onConfirmClick(...args))
}, " 应用 ", 8, _hoisted_16)
])
]),
createElementVNode("div", _hoisted_17, [
createElementVNode("ul", _hoisted_18, [
createElementVNode("li", {
class: normalizeClass(["main-panel-content-body-grid-item", {
"is-error": _ctx.providerRef.hasError,
"is-change": _ctx.providerRef.hasChange,
"is-checked": !_ctx.providerRef.hasUncheckedAll
}])
}, [
createElementVNode("div", _hoisted_19, [
createVNode(_component_material_checkbox, {
"model-value": _ctx.providerRef.hasCheckedAll,
indeterminate: !_ctx.providerRef.hasCheckedAll && !_ctx.providerRef.hasUncheckedAll,
"onUpdate:modelValue": _ctx.onCheckedAllUpdate
}, null, 8, ["model-value", "indeterminate", "onUpdate:modelValue"])
]),
_hoisted_20,
_hoisted_21,
_hoisted_22
], 2),
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.currentList, (item) => {
return openBlock(), createElementBlock("li", {
key: item.id,
class: normalizeClass(["main-panel-content-body-grid-item", {
"is-error": item.isError,
"is-change": item.isChange,
"is-checked": item.isChecked
}])
}, [
createElementVNode("div", _hoisted_23, [
createVNode(_component_material_checkbox, {
"model-value": item.isChecked,
"onUpdate:modelValue": ($event) => _ctx.onIsCheckUpdate(item, $event)
}, null, 8, ["model-value", "onUpdate:modelValue"])
]),
createElementVNode("div", {
class: "main-panel-content-body-grid-item-old_file_name",
title: item.oldFileName
}, toDisplayString(item.oldFileName), 9, _hoisted_24),
_hoisted_25,
createElementVNode("div", {
class: "main-panel-content-body-grid-item-new_file_name",
title: item.newFileName
}, toDisplayString(item.newFileName), 9, _hoisted_26)
], 2);
}), 128))
])
]),
_ctx.providerRef.isLoading ? (openBlock(), createBlock(_component_material_loading, { key: 0 })) : createCommentVNode("", true)
])) : createCommentVNode("", true)
]),
_: 1
})
])) : createCommentVNode("", true)
]);
}
const MainPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-6addc32b"]]);
const _sfc_main = defineComponent({
name: "App",
components: {
MainPanel
},
setup() {
const providerRef = inject("providerRef");
const EnterComponent2 = computed(() => {
var _a;
return (_a = providerRef == null ? void 0 : providerRef.value) == null ? void 0 : _a.EnterComponent();
});
return {
EnterComponent: EnterComponent2
};
}
});
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
const _component_main_panel = resolveComponent("main-panel");
return openBlock(), createElementBlock(Fragment, null, [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.EnterComponent))),
createVNode(_component_main_panel)
], 64);
}
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
const scriptRel = function detectScriptRel() {
const relList = typeof document !== "undefined" && document.createElement("link").relList;
return relList && relList.supports && relList.supports("modulepreload") ? "modulepreload" : "preload";
}();
const assetsURL = function(dep) {
return "/" + dep;
};
const seen = {};
const __vitePreload = function preload(baseModule, deps, importerUrl) {
let promise = Promise.resolve();
if (deps && deps.length > 0) {
const links = document.getElementsByTagName("link");
promise = Promise.all(deps.map((dep) => {
dep = assetsURL(dep);
if (dep in seen)
return;
seen[dep] = true;
const isCss = dep.endsWith(".css");
const cssSelector = isCss ? '[rel="stylesheet"]' : "";
const isBaseRelative = !!importerUrl;
if (isBaseRelative) {
for (let i = links.length - 1; i >= 0; i--) {
const link2 = links[i];
if (link2.href === dep && (!isCss || link2.rel === "stylesheet")) {
return;
}
}
} else if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) {
return;
}
const link = document.createElement("link");
link.rel = isCss ? "stylesheet" : scriptRel;
if (!isCss) {
link.as = "script";
link.crossOrigin = "";
}
link.href = dep;
document.head.appendChild(link);
if (isCss) {
return new Promise((res, rej) => {
link.addEventListener("load", res);
link.addEventListener("error", () => rej(new Error(`Unable to preload CSS for ${dep}`)));
});
}
}));
}
return promise.then(() => baseModule()).catch((err) => {
const e = new Event("vite:preloadError", { cancelable: true });
e.payload = err;
window.dispatchEvent(e);
if (!e.defaultPrevented) {
throw err;
}
});
};
const complementZero = (payload) => {
if (isString(payload)) {
payload = parseInt(payload);
if (isNaN(payload)) {
return "";
}
}
return (payload < 10 ? "0" : "") + payload;
};
class Provider {
constructor() {
// 显示加载
__publicField(this, "isLoading", false);
// 主面板显示控制
__publicField(this, "visible", false);
// 替换参数
__publicField(this, "replaceParams", new ReplaceParams(
() => this._onReplaceParamsUpdate.call(this)
));
// 原始文件列表数据
__publicField(this, "originList", []);
// 当前文件列表数据
__publicField(this, "_currentList", []);
// 文件列表更新回调函数集合
__publicField(this, "_currentListUpdateHandlerSet", /* @__PURE__ */ new Set());
// 取消选中的文件列表
__publicField(this, "_uncheckedList", /* @__PURE__ */ new Set());
// 是否有错误
__publicField(this, "hasError", false);
// 是否有变更
__publicField(this, "hasChange", false);
// 是否全选
__publicField(this, "hasCheckedAll", false);
// 是否全不选
__publicField(this, "hasUncheckedAll", false);
// 是否可继续
__publicField(this, "shouldContinue", false);
}
// 匹配测试
static test() {
return false;
}
setVisible(val = false) {
this.visible = val;
if (val) {
this._updateOriginList();
}
}
// 替换参数更新回调函数
_onReplaceParamsUpdate() {
this._updateCurrentList();
}
// 重置替换参数
_resetReplaceParams() {
this.replaceParams.reset();
}
// 更新原始文件列表数据
_updateOriginList() {
this.getOriginList().then((res) => {
this.originList = res;
this._uncheckedList = /* @__PURE__ */ new Set();
this._updateCurrentList();
});
}
get currentList() {
return this._currentList;
}
// 更新当前文件列表数据
_updateCurrentList() {
const renameMode = this.replaceParams.renameMode;
const result = this.originList.map((item) => {
return {
id: item.id,
ext: item.ext,
isError: false,
fileName: item.fileName,
isChange: false,
isMatched: false,
isChecked: !this._uncheckedList.has(item.id),
isLoading: false,
oldFileName: item.fullFileName,
newFileName: ""
};
});
const newFileNameSet = /* @__PURE__ */ new Set();
if (renameMode === RENAME_MODE_SERIES) {
if (this.replaceParams.title || this.replaceParams.season) {
const season = this.replaceParams.season ? ".S" + complementZero(this.replaceParams.season) : "";
result.forEach((item, index) => {
const fileName = this.replaceParams.title || item.fileName;
let newFileName = fileName + season;
if (this.replaceParams.autoEpisode) {
const episode = (season ? "" : ".") + "E" + complementZero(index + 1);
newFileName += episode;
}
newFileName += "." + item.ext;
item.newFileName = newFileName;
this._listItemGeneralMethod(item, newFileNameSet);
});
}
}
if (renameMode === RENAME_MODE_PATTERN) {
let regexp2;
if (this.replaceParams.pattern) {
try {
regexp2 = new RegExp(this.replaceParams.pattern);
} catch (error) {
console.error("regexp error", error);
}
if (regexp2) {
result.forEach((item, index) => {
if (this.replaceParams.autoEpisode) {
item.isMatched = !!(regexp2 == null ? void 0 : regexp2.test(item.fileName));
if (item.isMatched) {
let newFileName = item.fileName.replace(
regexp2,
this.replaceParams.replace
);
newFileName += (newFileName ? ".E" : "E") + complementZero(index + 1);
newFileName += "." + item.ext;
item.newFileName = newFileName;
this._listItemGeneralMethod(item, newFileNameSet);
}
} else {
item.isMatched = !!(regexp2 == null ? void 0 : regexp2.test(item.oldFileName));
if (item.isMatched) {
item.newFileName = item.oldFileName.replace(
regexp2,
this.replaceParams.replace
);
this._listItemGeneralMethod(item, newFileNameSet);
}
}
});
}
}
}
this._currentList = result;
this._updateHasError();
this._updateHasChange();
this._updateHasCheckedAll();
this._updateShouldContinue();
this._emitCurrentListUpdateHandler();
}
// 文件列表项通用处理
_listItemGeneralMethod(item, newFileNameSet) {
item.isChange = item.oldFileName !== item.newFileName;
item.isError = item.isChecked && (!item.newFileName || newFileNameSet.has(item.newFileName));
item.isChecked && newFileNameSet.add(item.newFileName);
}
// 绑定文件列表更新回调函数
onCurrentListUpdate(handler) {
if (!this._currentListUpdateHandlerSet.has(handler)) {
this._currentListUpdateHandlerSet.add(handler);
}
}
// 解绑文件列表更新回调函数
offCurrentListUpdate(handler) {
if (this._currentListUpdateHandlerSet.has(handler)) {
this._currentListUpdateHandlerSet.delete(handler);
}
}
// 触发文件列表更新回调函数
_emitCurrentListUpdateHandler() {
this._currentListUpdateHandlerSet.forEach((handler) => {
handler(this._currentList);
});
}
// 更新是否选中文件列表
updateItemIsCheck(item, val) {
if (val) {
this._uncheckedList.delete(item.id);
} else {
this._uncheckedList.add(item.id);
}
this._updateCurrentList();
}
// 更新是否全选
updateCheckedAll(val) {
if (val) {
this._uncheckedList = /* @__PURE__ */ new Set();
} else {
this._currentList.forEach((item) => {
this._uncheckedList.add(item.id);
});
}
this._updateCurrentList();
}
_updateHasError() {
this.hasError = this._currentList.some(
(item) => item.isChecked && item.isError
);
}
_updateHasChange() {
this.hasChange = this._currentList.some(
(item) => item.isChecked && item.isChange
);
}
_updateHasCheckedAll() {
this.hasCheckedAll = this._uncheckedList.size === 0;
this.hasUncheckedAll = this._uncheckedList.size === this._currentList.length;
}
_updateShouldContinue() {
this.shouldContinue = !this.hasError && this.hasChange;
}
// 批量重命名
batchRename() {
if (!this.shouldContinue) {
return;
}
this.isLoading = true;
const data = this.currentList.filter(
(item) => item.isChecked && item.isChange && !item.isError
);
this.renameRequest(data).then(() => {
this._resetReplaceParams();
}).finally(() => {
this.visible = false;
this.isLoading = false;
});
}
// 重置
reset() {
this._resetReplaceParams();
this._updateOriginList();
}
}
class ReplaceParams {
constructor(onUpdateHandler) {
// 剧名
__publicField(this, "_title", "");
// 季数
__publicField(this, "_season", "");
// 正则
__publicField(this, "_pattern", "");
// 替换文本
__publicField(this, "_replace", "");
// 自动集数
__publicField(this, "_autoEpisode", true);
// 重命名模式
__publicField(this, "_renameMode", RENAME_MODE_SERIES);
// private _onUpdateTimer: NodeJS.Timeout | undefined;
__publicField(this, "_onUpdate", () => {
this.onUpdateHandler && this.onUpdateHandler(this);
});
__publicField(this, "onUpdateHandler");
this.onUpdateHandler = onUpdateHandler;
}
get title() {
return this._title;
}
set title(val) {
this._title = val;
this._onUpdate();
}
get season() {
return this._season;
}
set season(val) {
this._season = val;
this._onUpdate();
}
get pattern() {
return this._pattern;
}
set pattern(val) {
this._pattern = val;
this._onUpdate();
}
get replace() {
return this._replace;
}
set replace(val) {
this._replace = val;
this._onUpdate();
}
get autoEpisode() {
return this._autoEpisode;
}
set autoEpisode(val) {
this._autoEpisode = val;
this._onUpdate();
}
get renameMode() {
return this._renameMode;
}
set renameMode(val) {
this._renameMode = val;
this._onUpdate();
}
reset(val) {
this.title = (val == null ? void 0 : val.title) || "";
this.season = (val == null ? void 0 : val.season) || "";
this.pattern = (val == null ? void 0 : val.pattern) || "";
this.replace = (val == null ? void 0 : val.replace) || "";
this.autoEpisode = val ? !!val.autoEpisode : true;
this.renameMode = (val == null ? void 0 : val.renameMode) || RENAME_MODE_SERIES;
}
}
const RENAME_MODE_SERIES = "series";
const RENAME_MODE_PATTERN = "pattern";
const querySelector = (payload, count = 0, timeout = 100) => {
let element = document.querySelector(payload);
if (element) {
return Promise.resolve(element);
} else if (count > 0) {
return new Promise((resolve, reject) => {
const timer = window.setTimeout(() => {
element = document.querySelector(payload);
if (element) {
resolve(element);
window.clearInterval(timer);
} else if (--count <= 0) {
reject();
window.clearInterval(timer);
}
}, timeout);
});
} else {
return Promise.reject();
}
};
const regexp = /^(.+)\.([^.]+)$/;
const fileNameParse = (payload) => {
const matchResult = payload.match(regexp);
return {
ext: (matchResult == null ? void 0 : matchResult[2]) || "",
fileName: (matchResult == null ? void 0 : matchResult[1]) || payload
};
};
defineAsyncComponent(
() => __vitePreload(() => module.import('./EnterComponent-fYNwVPK--ssno6y9k.js'), void 0 )
);
const sleep = (timeout) => {
return new Promise((resolve) => {
setTimeout(resolve, timeout);
});
};
const EnterComponent = defineAsyncComponent(
() => __vitePreload(() => module.import('./EnterComponent-DJ_Sjn3u-YEY3a03j.js'), void 0 )
);
class ProviderBaidu extends Provider {
constructor() {
super(...arguments);
__publicField(this, "type", "baidu");
__publicField(this, "rootElementId", "cloud-disk-plugin");
__publicField(this, "rootElementInsertTarget", ".wp-s-agile-tool-bar__header");
__publicField(this, "rootElementInsertMethod", "prepend");
__publicField(this, "EnterComponent", () => EnterComponent);
}
getOriginList() {
return querySelector(".nd-new-main-list").then((res) => {
var _a;
const fileList = (_a = res == null ? void 0 : res.__vue__) == null ? void 0 : _a.fileList;
if (!fileList) {
return Promise.reject();
}
const result = [];
fileList.forEach((item) => {
if (item.isdir === 0) {
result.push({
id: item.fs_id,
fullFileName: item.formatName,
...fileNameParse(item.formatName)
});
}
});
return result;
});
}
// getOriginListByElement() {
// const trList = document.querySelectorAll(
// "table.wp-s-pan-table__body-table tbody>tr"
// );
// const result: IOriginListItem[] = [];
// trList.forEach((item, index) => {
// const elementA = item.querySelector("a");
// if (!elementA) {
// return;
// }
// const elementImgAlt = item.querySelector("img[alt]")?.getAttribute("alt");
// if (elementImgAlt === "folder" || elementImgAlt === "share") {
// return;
// }
// const fullFileName = elementA.getAttribute("title") || "";
// result.push({
// id: item.getAttribute("data-id") || fullFileName || index + "",
// fullFileName,
// ...fileNameParse(fullFileName),
// });
// });
// return Promise.resolve(result);
// }
async renameRequest(data) {
const path = getPath();
const token = await getToken();
const filelist = data.map((item) => {
return {
id: item.id,
path: path + item.oldFileName,
newname: item.newFileName
};
});
const body = new FormData();
body.append("filelist", JSON.stringify(filelist));
return fetch(
`https://pan.baidu.com/api/filemanager?async=2&onnest=fail&opera=rename&bdstoken=${token}&clienttype=0&app_id=250528&web=1`,
{
body,
method: "POST"
}
).then((res) => {
if (res.ok) {
return res.json();
} else {
return Promise.reject(new Error("filemanager error"));
}
}).then((res) => {
if (res.errno === 0) {
return this.waitResult(res, data);
}
return Promise.reject(res);
});
}
refresh() {
return querySelector(".nd-new-main-list").then((res) => {
var _a;
(_a = res == null ? void 0 : res.__vue__) == null ? void 0 : _a.reloadList();
return new Promise((resolve) => {
let count = 20;
const timer = setInterval(() => {
if (res.__vue__.$store.state.fileList.loadingList === false || --count < 0) {
resolve();
clearInterval(timer);
}
}, 500);
});
});
}
async waitResult(res, data) {
let count = 10;
const timeout = Math.max(data.length * 50, 1e3);
while (count-- > 0) {
console.log("waitResult", count);
await this.refresh();
const originList = await this.getOriginList();
const originListMap = new Map(
originList.map((item) => [item.id, item.fullFileName])
);
const isMatched = data.every(
(item) => originListMap.has(item.id) && originListMap.get(item.id) === item.newFileName
);
if (!isMatched) {
await sleep(timeout);
} else {
return res;
}
}
}
}
__publicField(ProviderBaidu, "test", () => /https:\/\/pan\.baidu\.com\/disk\/main\/?#\/index\?category=all/.test(
location.href
));
const getPath = () => {
const currentPath = location.href.match(/path=(.+?)(?:&|$)/);
let result;
if (currentPath) {
result = decodeURIComponent(currentPath[1]);
if (result.charAt(0) !== "/") {
result = "/" + result;
}
if (result.charAt(result.length - 1) !== "/") {
result += "/";
}
} else {
result = "/";
}
return result;
};
const getToken = () => {
return querySelector(".nd-main-list, .nd-new-main-list").then(
(res) => {
var _a, _b;
return ((_b = (_a = res == null ? void 0 : res.__vue__) == null ? void 0 : _a.yunData) == null ? void 0 : _b.bdstoken) ? res.__vue__.yunData.bdstoken : Promise.reject();
}
);
};
defineAsyncComponent(
() => __vitePreload(() => module.import('./EnterComponent-ad64xRzd-ENY-V6YB.js'), void 0 )
);
const getProvider = /* @__PURE__ */ ((instance) => {
return () => {
if (instance) {
return Promise.resolve(instance);
}
if (ProviderBaidu.test()) {
instance = new ProviderBaidu();
}
return instance ? Promise.resolve(instance) : Promise.reject();
};
})();
const getProviderRef = /* @__PURE__ */ ((instanceRef) => {
return () => {
if (!instanceRef) {
return getProvider().then((res) => {
instanceRef = ref(res);
return instanceRef;
});
}
return Promise.resolve(instanceRef);
};
})();
const init = (providerRef) => {
querySelector(providerRef.value.rootElementInsertTarget).then(
(target) => querySelector("#" + providerRef.value.rootElementId).catch(() => {
const app = createApp(App);
app.provide("providerRef", providerRef);
app.mount(
(() => {
const root = document.createElement("div");
root.setAttribute("id", providerRef.value.rootElementId);
target[providerRef.value.rootElementInsertMethod](root);
return root;
})()
);
})
);
};
setInterval(
() => getProviderRef().then((providerRef) => init(providerRef)),
300
);
})
};
}));
System.register("./EnterComponent-fYNwVPK--ssno6y9k.js", ['vue', './__monkey.entry-V4Jgkl1w.js'], (function (exports, module) {
'use strict';
var defineComponent, openBlock, createElementBlock, _export_sfc;
return {
setters: [module => {
defineComponent = module.defineComponent;
openBlock = module.openBlock;
createElementBlock = module.createElementBlock;
}, module => {
_export_sfc = module._;
}],
execute: (function () {
const _sfc_main = defineComponent({
name: "EnterComponentAli",
setup() {
return {};
}
});
const _hoisted_1 = { class: "enter-component" };
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", _hoisted_1, "EnterComponentAli");
}
const EnterComponent = exports("default", /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]));
})
};
}));
System.register("./EnterComponent-DJ_Sjn3u-YEY3a03j.js", ['vue', './__monkey.entry-V4Jgkl1w.js'], (function (exports, module) {
'use strict';
var defineComponent, inject, openBlock, createElementBlock, createElementVNode, pushScopeId, popScopeId, _export_sfc;
return {
setters: [module => {
defineComponent = module.defineComponent;
inject = module.inject;
openBlock = module.openBlock;
createElementBlock = module.createElementBlock;
createElementVNode = module.createElementVNode;
pushScopeId = module.pushScopeId;
popScopeId = module.popScopeId;
}, module => {
_export_sfc = module._;
}],
execute: (function () {
const _sfc_main = defineComponent({
name: "EnterComponentBaidu",
setup() {
const providerRef = inject("providerRef");
const onClick = () => {
providerRef == null ? void 0 : providerRef.value.setVisible(true);
};
return {
onClick
};
}
});
const _withScopeId = (n) => (pushScopeId("data-v-3ff86bbd"), n = n(), popScopeId(), n);
const _hoisted_1 = { class: "enter-component" };
const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { class: "enter-component-button-text" }, "重命名", -1));
const _hoisted_3 = [
_hoisted_2
];
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", _hoisted_1, [
createElementVNode("button", {
type: "button",
class: "enter-component-button",
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
}, _hoisted_3)
]);
}
const EnterComponent = exports("default", /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-3ff86bbd"]]));
})
};
}));
System.register("./EnterComponent-ad64xRzd-ENY-V6YB.js", ['vue', './__monkey.entry-V4Jgkl1w.js'], (function (exports, module) {
'use strict';
var defineComponent, openBlock, createElementBlock, _export_sfc;
return {
setters: [module => {
defineComponent = module.defineComponent;
openBlock = module.openBlock;
createElementBlock = module.createElementBlock;
}, module => {
_export_sfc = module._;
}],
execute: (function () {
const _sfc_main = defineComponent({
name: "EnterComponentQuark",
setup() {
return {};
}
});
const _hoisted_1 = { class: "enter-component" };
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", _hoisted_1, "EnterComponentQuark");
}
const EnterComponent = exports("default", /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]));
})
};
}));
System.import("./__entry.js", "./");function __vite__mapDeps(indexes) {
if (!__vite__mapDeps.viteFileDeps) {
__vite__mapDeps.viteFileDeps = []
}
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}