// ==UserScript==
// @name Vue开发路由跳转辅助工具《vue-router-tool》
// @namespace npm/vue-router-tool
// @version 0.0.7
// @author shixiaoshi
// @description 对于Vue项目的开发,多路由之间的切换是浪费时间且麻烦的,使用本插件,可以让您在路由之间顺畅切换。智能的路径补全,可以更快打开您开发的项目。
// @license MIT
// @icon https://vitejs.dev/logo.svg
// @match https://*/*
// @match http://*/*
// @require https://cdn.jsdelivr.net/npm/vue@3.2.45/dist/vue.global.prod.js
// @grant GM_deleteValue
// @grant GM_getValue
// @grant GM_listValues
// @grant GM_registerMenuCommand
// @grant GM_setValue
// @grant unsafeWindow
// @run-at document-end
// @noframes
// @downloadURL none
// ==/UserScript==
(t=>{const e=document.createElement("style");e.dataset.source="vite-plugin-monkey",e.innerText=t,document.head.appendChild(e)})('.monkey-box-wrap[data-v-65abfbd2]{position:fixed;z-index:9999;background:rgba(255,255,255,.9);box-shadow:0 4px 8px #07111b33;border-radius:8px}.monkey-box-wrap[data-v-65abfbd2]:before{content:"";display:block;width:8px;height:8px;background:#fff;z-index:1900;position:absolute;transform:rotate(45deg);left:20px}.belowPart[data-v-65abfbd2]:before{bottom:-4px}.upPart[data-v-65abfbd2]:before{top:-4px}.message-enter-from[data-v-65abfbd2]{min-height:0px;opacity:0}.message-enter-active[data-v-65abfbd2],.message-leave-active[data-v-65abfbd2]{transition:all .2s ease-out}.message-leave-to[data-v-65abfbd2]{min-height:0;opacity:0}.monkey-router-wrap[data-v-49b45eb0]{width:100%;padding:10px;max-height:300px;min-height:20px;overflow-y:auto;overflow-x:hidden;cursor:pointer}.monkey-router-wrap .monkey-router-item[data-v-49b45eb0]{margin-bottom:10px;border-radius:3px;padding:4px;align-items:center;justify-content:space-between;display:flex;transition:all .1s linear}.monkey-router-wrap .monkey-router-item .monkey-left[data-v-49b45eb0]{width:30px;height:30px;border-radius:5px;background:#fff;display:flex;justify-content:center;align-items:center;padding:2px;overflow:hidden;transition:padding .1s linear}.monkey-router-wrap .monkey-router-item .monkey-left[data-v-49b45eb0]:hover{padding:5px;transition:padding .1s linear}.monkey-router-wrap .monkey-router-item .monkey-middle[data-v-49b45eb0]{flex:1;margin:0 5px 0 10px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.monkey-router-wrap .monkey-router-item .monkey-middle .monkey-path-wrap[data-v-49b45eb0]{height:20px;display:block;font-size:14px;color:#303133;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.monkey-router-wrap .monkey-router-item .monkey-middle .monkey-name-wrap[data-v-49b45eb0]{font-size:12px;color:#909399}.monkey-router-wrap .monkey-router-item .monkey-right[data-v-49b45eb0]{width:15px;display:flex;justify-content:space-between;align-items:center;overflow:hidden}.monkey-router-wrap .monkey-router-item .monkey-right div[data-v-49b45eb0]{display:flex;justify-content:center;align-items:center;width:15px;height:15px}.monkey-router-wrap .monkey-router-item[data-v-49b45eb0]:hover{transform:translate(3px);background:#EBEDF0;box-shadow:0 4px 8px #07111b1a}.monkey-setting-wrap[data-v-45dd8a4a]{max-height:400px;overflow-y:auto;font-size:12px;overflow-x:hidden;padding:5px;color:#606266}.monkey-setting-wrap .monkey-setting-item[data-v-45dd8a4a]{padding:5px;border-radius:5px;transition:all .1s linear;margin-bottom:5px}.monkey-setting-wrap .monkey-setting-item[data-v-45dd8a4a]:hover{transform:translate(3px);background:#F5F7FA;color:#909399;box-shadow:0 4px 8px #07111b1a}.monkey-setting-wrap .monkey-setting-item .monkey-input-wrap[data-v-45dd8a4a]{overflow:hidden;display:flex}.monkey-setting-wrap .monkey-setting-item .monkey-input-wrap .monkey-input[data-v-45dd8a4a]{appearance:none;height:25px;border-radius:4px;border:1px solid #c8cccf;color:#6a6f77;outline:0;text-align:left;padding:0 5px;width:100%;flex:1;font-size:12px}.monkey-setting-wrap .monkey-setting-item .monkey-input-wrap .monkey-input[data-v-45dd8a4a]:focus{border:1px solid #3aa7e5}.monkey-setting-wrap .monkey-setting-item .monkey-tip-wrap[data-v-45dd8a4a]{flex:1;display:flex;margin-bottom:5px;align-items:center;height:100%}.monkey-setting-wrap .monkey-setting-item .monkey-tip-wrap .monkey-name[data-v-45dd8a4a]{display:flex;margin-right:5px}.monkey-setting-wrap .monkey-setting-item .monkey-tip-wrap .monkey-name span[data-v-45dd8a4a]{margin-right:5px}.monkey-setting-wrap .monkey-setting-item .monkey-tip-wrap .monkey-icon[data-v-45dd8a4a]{display:flex;width:14px;height:14px;justify-content:center;align-items:center;overflow:hidden}.monkey-setting-wrap .monkey-setting-item .monkey-tip-wrap .monkey-ensure[data-v-45dd8a4a]{cursor:pointer;height:20px;padding:0 9px;border-radius:4px;box-sizing:border-box;display:inline-flex;justify-content:center;align-items:center;border-color:var(--el-tag-border-color);color:#409eff;background:#ecf5ff;border:1px solid #d9ecff}.monkey-setting-wrap .monkey-setting-item .monkey-item-wrap[data-v-45dd8a4a]{height:20px;display:flex;cursor:pointer;align-items:center;justify-content:space-between}.monkey-setting-wrap .monkey-setting-item .monkey-item-wrap .monkey-left[data-v-45dd8a4a]{display:flex}.monkey-setting-wrap .monkey-setting-item .monkey-item-wrap .monkey-right[data-v-45dd8a4a]{width:36px;height:18px;background:#dcdfe6;border-radius:10px;display:flex;align-items:center;justify-content:flex-start;padding:0 2px;box-sizing:border-box}.monkey-setting-wrap .monkey-setting-item .monkey-item-wrap .monkey-right span[data-v-45dd8a4a]{height:14px;width:14px;background:#fff;display:block;border-radius:50%}.monkey-setting-wrap .monkey-setting-item .monkey-item-wrap .select[data-v-45dd8a4a]{justify-content:flex-end;background:#409eff;transition:all .2s linear}.monkey-setting-wrap .monkey-setting-item .monkey-checkbox-wrap span[data-v-45dd8a4a]{display:flex;padding-left:15px;height:20px;align-items:center;color:#a8abb2}.monkey-setting-wrap .monkey-setting-item .monkey-checkbox-wrap span input[data-v-45dd8a4a]{margin-right:5px}.monkey-wrap[data-v-80110e95]{position:fixed;cursor:pointer;z-index:9999;user-select:none;background:rgba(255,255,255,.5);backdrop-filter:blur(10px);box-shadow:0 4px 8px #07111b1a;border-radius:8px;display:flex;padding:5px 10px;height:40px;right:auto;min-width:175px}.monkey-wrap .v-drag-handle[data-v-80110e95]{cursor:move}.monkey-wrap .icon[data-v-80110e95]{width:20px;height:20px;display:inline-block;display:flex;justify-content:center;align-items:center;overflow:hidden;margin-left:10px}.monkey-wrap .monkey-home-wrap[data-v-80110e95]{overflow:hidden;display:flex;align-items:center;background:#E9F7FD;border-radius:15px;color:#3aa7e5}.monkey-wrap .monkey-home-wrap .monkey-name-wrap[data-v-80110e95]{display:flex;width:100%;align-items:center}.monkey-wrap .monkey-home-wrap .monkey-name-wrap .monkey-arrow[data-v-80110e95]{width:12px;height:12px;display:flex;justify-content:center;align-items:center;transform:rotate(180deg);margin-right:10px;transition:transform .3s}.monkey-wrap .monkey-home-wrap .monkey-name-wrap .monkey-arrow img[data-v-80110e95]{width:100%;height:auto}.monkey-wrap .monkey-home-wrap .monkey-name-wrap .monkey-name[data-v-80110e95]{text-align:center;display:inline-block;margin:0 10px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.monkey-wrap .monkey-home-wrap .monkey-name-wrap:hover .monkey-arrow[data-v-80110e95]{transform:rotate(0);transition:transform .3s}.monkey-wrap .monkey-menu-wrap[data-v-80110e95]{display:flex;align-items:center}');
(function(vue$1) {
"use strict";
const _imports_0 = "data:image/svg+xml;base64,PHN2ZyB0PSIxNjY5Mjc4NjExMTMxIiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjE0OTI3IiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+PHBhdGggZD0iTTEwMDUuOSA2OTFjMTEuMiAxMS4yIDE2LjcgMjUuOCAxNi43IDQwLjUgMCAxNC42LTUuNSAyOS4zLTE2LjcgNDAuNS0yMi4zIDIyLjMtNTguNSAyMi4zLTgwLjggMEw1MTEuNCAzNTguMSA5Ny42IDc3MS43Yy0yMi4zIDIyLjMtNTguNSAyMi4zLTgwLjggMC0yMi4zLTIyLjMtMjIuMy01OC41IDAtODAuOEw0NDYuNyAyNjFjMTcuMy0xNy4zIDQwLjItMjYuNyA2NC43LTI2LjdzNDcuNCA5LjUgNjQuNyAyNi43bDQyOS44IDQzMHogbTAgMCIgZmlsbD0iICMzQUE3RTUiIHAtaWQ9IjE0OTI4Ij48L3BhdGg+PC9zdmc+";
const _sfc_main$3 = /* @__PURE__ */ vue$1.defineComponent({
__name: "index",
props: ["top", "left", "width", "bottom", "upperPart"],
setup(__props) {
const props = __props;
vue$1.onMounted(() => {
visible.value = true;
boxWrap.value.addEventListener("click", (e) => {
e.stopPropagation();
});
});
const boxWrap = vue$1.ref();
const styles = vue$1.computed(
() => {
return {
left: props.left,
width: props.width,
bottom: props.upperPart ? "" : props.bottom,
top: props.upperPart ? props.top : ""
};
}
);
const customClass = vue$1.computed(() => {
return props.upperPart ? "upPart" : "belowPart";
});
let visible = vue$1.ref(false);
return (_ctx, _cache) => {
return vue$1.openBlock(), vue$1.createBlock(vue$1.Transition, {
name: "message",
onAfterLeave: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("destroy"))
}, {
default: vue$1.withCtx(() => [
vue$1.withDirectives(vue$1.createElementVNode("div", {
class: vue$1.normalizeClass(["monkey-box-wrap", vue$1.unref(customClass)]),
style: vue$1.normalizeStyle(vue$1.unref(styles)),
ref_key: "boxWrap",
ref: boxWrap
}, [
vue$1.renderSlot(_ctx.$slots, "default", {}, void 0, true)
], 6), [
[vue$1.vShow, vue$1.unref(visible)]
])
]),
_: 3
});
};
}
});
const index_vue_vue_type_style_index_0_scoped_65abfbd2_lang = "";
const _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target[key] = val;
}
return target;
};
const boxWrapComponent = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-65abfbd2"]]);
var monkeyWindow = window;
var unsafeWindow = /* @__PURE__ */ (() => {
return monkeyWindow.unsafeWindow;
})();
var GM_setValue = /* @__PURE__ */ (() => monkeyWindow.GM_setValue)();
var GM_deleteValue = /* @__PURE__ */ (() => monkeyWindow.GM_deleteValue)();
var GM_listValues = /* @__PURE__ */ (() => monkeyWindow.GM_listValues)();
var GM_registerMenuCommand = /* @__PURE__ */ (() => monkeyWindow.GM_registerMenuCommand)();
var GM_getValue = /* @__PURE__ */ (() => monkeyWindow.GM_getValue)();
const GM_setObject = function(name, value) {
GM_setValue(name, JSON.stringify(value));
};
const GM_getObject = function(name, defaultValue) {
let value = GM_getValue(name, "") || "";
try {
return JSON.parse(value);
} catch (e) {
return defaultValue;
}
};
let vm;
const bodyHight = document.documentElement.clientHeight;
const container = document.createElement("div");
const createBoxWarp = (dragBox, component) => {
if (!component) {
return vue$1.render(null, container);
}
const boxTop = GM_getObject("BOX_TOP", dragBox.offsetTop);
const boxLeft = GM_getObject("BOX_LEFT", dragBox.offsetLeft);
const centerLinePosition = boxTop + dragBox.clientHeight / 2;
const upperPart = bodyHight / 2 - centerLinePosition > 0 ? true : false;
const left = boxLeft + "px";
const width = dragBox.offsetWidth + "px";
if (vm) {
vue$1.render(null, container);
}
const props = {
upperPart,
top: boxTop + dragBox.offsetHeight + 10 + "px",
bottom: bodyHight - boxTop + 10 + "px",
width,
left,
onDestroy: () => {
vue$1.render(null, container);
}
};
vm = vue$1.createVNode(boxWrapComponent, props, () => vue$1.h(component));
vue$1.render(vm, container);
document.body.appendChild(container.firstElementChild);
//!表示一定有
};
const home = '';
const refresh = '';
const setting = '';
const vue = '';
const vueGray = '';
function getFulUrl(url, searchValue) {
let fulUrl = url;
if (searchValue) {
fulUrl += `?${searchValue}`;
}
return fulUrl;
}
const getSearchValue = (baseUrl, routerList) => {
let searchValue = GM_getObject("SEARCH_VALUE", "").trim();
if (!searchValue && location.search) {
GM_setObject("SEARCH_VALUE", location.search.slice(1));
searchValue = location.search.slice(1);
}
if (!searchValue && !location.search) {
return "";
}
if (searchValue && location.search && location.search.slice(1) !== searchValue) {
GM_setObject("SEARCH_VALUE", location.search.slice(1));
searchValue = location.search.slice(1);
}
if (!location.search) {
let difRouter = searchValue && GM_getObject("LAST_URL", "") && (routerList == null ? void 0 : routerList.some((res) => GM_getObject("LAST_URL", "").includes(res.pathName))) && !GM_getObject("LAST_URL", "").includes(location.pathname);
if (!difRouter) {
GM_setObject("SEARCH_VALUE", "");
searchValue = "";
}
}
return searchValue;
};
const getRouterInfo = () => {
var _a, _b, _c, _d, _e, _f, _g;
const vueApp = document.body.querySelector("div");
const baseUrl = (_d = (_c = (_b = (_a = vueApp == null ? void 0 : vueApp.__vue__) == null ? void 0 : _a.$router) == null ? void 0 : _b.options) == null ? void 0 : _c.base) != null ? _d : "";
let $router = (_g = (_f = (_e = vueApp == null ? void 0 : vueApp.__vue__) == null ? void 0 : _e.$router) == null ? void 0 : _f.options) == null ? void 0 : _g.routes;
if (($router == null ? void 0 : $router.length) > 0) {
$router = $router.filter((res) => !res.path.includes(":"));
}
const searchValue = getSearchValue(baseUrl, $router);
const routerList = ($router == null ? void 0 : $router.map((res) => {
var _a2, _b2, _c2, _d2, _e2, _f2;
let url = `${location.protocol}//${(location.host + baseUrl + (res == null ? void 0 : res.path)).replace(/\/\//, "/")}`;
const pathName = (baseUrl + (res == null ? void 0 : res.path)).replace(/\/\//, "/");
return {
path: res == null ? void 0 : res.path,
name: (_f2 = (_e2 = (_d2 = (_b2 = res.title) != null ? _b2 : (_a2 = res == null ? void 0 : res.meta) == null ? void 0 : _a2.title) != null ? _d2 : (_c2 = res == null ? void 0 : res.meta) == null ? void 0 : _c2.name) != null ? _e2 : res == null ? void 0 : res.name) != null ? _f2 : res == null ? void 0 : res.path,
fulUrl: getFulUrl(url, searchValue),
pathName,
select: pathName === location.pathname,
port: location.port
};
})) || [];
return routerList;
};
const routerJump = () => {
if (!location.href.includes("localhost"))
return;
const autoJump = GM_getObject("AUTO_JUMP", true);
if (!autoJump)
return;
const router = getRouterInfo();
if (router.length === 0)
return;
const urlInfo = GM_getObject("URL_INFO", "");
if (!(urlInfo == null ? void 0 : urlInfo.fulUrl)) {
GM_setObject("URL_INFO", router[0]);
if (location.href === GM_getObject("LAST_URL", ""))
return;
return location.href = router[0].fulUrl;
}
if (router.some((res) => res.pathName === urlInfo.pathName)) {
if (location.href === GM_getObject("LAST_URL", ""))
return;
let routerItem = router.find((res) => res.pathName === location.pathname);
if (routerItem) {
GM_setObject("URL_INFO", routerItem);
if (location.href === GM_getObject("LAST_URL", ""))
return;
GM_getObject("LAST_URL", routerItem.fulUrl);
if (location.href === routerItem.fulUrl)
return;
return location.href = routerItem.fulUrl;
} else {
if (location.href === GM_getObject("LAST_URL", ""))
return;
if (location.port === urlInfo.port) {
GM_setObject("LAST_URL", urlInfo.fulUrl);
return location.href = urlInfo.fulUrl;
}
const url = urlInfo.fulUrl.replace(new RegExp("(?<=localhost:)\\d*(?=\\/)"), location.port);
urlInfo.fulUrl = url;
GM_setObject("URL_INFO", urlInfo);
GM_setObject("LAST_URL", url);
return location.href = url;
}
} else {
GM_setObject("URL_INFO", router[0]);
if (location.href === GM_getObject("LAST_URL", ""))
return;
return location.href = router[0].fulUrl;
}
};
const _hoisted_1$2 = { class: "monkey-router-wrap" };
const _hoisted_2$2 = ["innerHTML"];
const _hoisted_3$2 = ["innerHTML"];
const _hoisted_4$2 = ["onClick"];
const _hoisted_5$2 = { class: "monkey-path-wrap" };
const _hoisted_6$2 = { class: "monkey-name-wrap" };
const _sfc_main$2 = /* @__PURE__ */ vue$1.defineComponent({
__name: "router",
setup(__props) {
const vTitle = {
mounted(el) {
el.onmouseenter = (e) => {
const { clientWidth, scrollWidth, title } = el;
if (!title && scrollWidth > clientWidth)
el.title = el.innerText;
};
}
};
const routers = getRouterInfo();
const jump = (urlInfo) => {
if (location.href.includes("localhost")) {
GM_setObject("URL_INFO", urlInfo);
}
GM_setObject("LAST_URL", urlInfo.fulUrl);
location.href = urlInfo.fulUrl;
};
return (_ctx, _cache) => {
return vue$1.openBlock(), vue$1.createElementBlock("div", _hoisted_1$2, [
(vue$1.openBlock(true), vue$1.createElementBlock(vue$1.Fragment, null, vue$1.renderList(vue$1.unref(routers), (item, index) => {
return vue$1.openBlock(), vue$1.createElementBlock("div", {
class: "monkey-router-item",
key: index
}, [
vue$1.withDirectives(vue$1.createElementVNode("div", {
class: "monkey-left",
innerHTML: vue$1.unref(vueGray)
}, null, 8, _hoisted_2$2), [
[vue$1.vShow, !item.select]
]),
vue$1.withDirectives(vue$1.createElementVNode("div", {
class: "monkey-left",
innerHTML: vue$1.unref(vue)
}, null, 8, _hoisted_3$2), [
[vue$1.vShow, item.select]
]),
vue$1.createElementVNode("div", {
class: "monkey-middle",
onClick: ($event) => jump(item)
}, [
vue$1.withDirectives((vue$1.openBlock(), vue$1.createElementBlock("div", _hoisted_5$2, [
vue$1.createTextVNode(vue$1.toDisplayString(item.path), 1)
])), [
[vTitle]
]),
vue$1.withDirectives((vue$1.openBlock(), vue$1.createElementBlock("div", _hoisted_6$2, [
vue$1.createTextVNode(vue$1.toDisplayString(item.name), 1)
])), [
[vTitle]
])
], 8, _hoisted_4$2)
]);
}), 128))
]);
};
}
});
const router_vue_vue_type_style_index_0_scoped_49b45eb0_lang = "";
const routerComponent = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-49b45eb0"]]);
const help = '';
const _withScopeId$1 = (n) => (vue$1.pushScopeId("data-v-45dd8a4a"), n = n(), vue$1.popScopeId(), n);
const _hoisted_1$1 = { class: "monkey-setting-wrap" };
const _hoisted_2$1 = { class: "monkey-setting-item" };
const _hoisted_3$1 = { class: "monkey-tip-wrap" };
const _hoisted_4$1 = { class: "monkey-name" };
const _hoisted_5$1 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue$1.createElementVNode("span", null, "\u8DEF\u7531search\u53C2\u6570", -1));
const _hoisted_6$1 = ["innerHTML"];
const _hoisted_7$1 = { class: "monkey-input-wrap" };
const _hoisted_8 = { class: "monkey-setting-item" };
const _hoisted_9 = { class: "monkey-tip-wrap monkey-item-wrap" };
const _hoisted_10 = { class: "monkey-left" };
const _hoisted_11 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue$1.createElementVNode("span", { class: "monkey-name" }, "\u4EC5\u5F00\u53D1\u6A21\u5F0F\u663E\u793A", -1));
const _hoisted_12 = ["innerHTML"];
const _hoisted_13 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue$1.createElementVNode("span", null, null, -1));
const _hoisted_14 = [
_hoisted_13
];
const _hoisted_15 = { class: "monkey-setting-item" };
const _hoisted_16 = { class: "monkey-tip-wrap monkey-item-wrap" };
const _hoisted_17 = { class: "monkey-left" };
const _hoisted_18 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue$1.createElementVNode("span", { class: "monkey-name" }, "\u8DEF\u7531\u667A\u80FD\u8865\u5168", -1));
const _hoisted_19 = ["innerHTML"];
const _hoisted_20 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue$1.createElementVNode("span", null, null, -1));
const _hoisted_21 = [
_hoisted_20
];
const _hoisted_22 = { class: "monkey-setting-item" };
const _hoisted_23 = { class: "monkey-tip-wrap" };
const _hoisted_24 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue$1.createElementVNode("span", { class: "monkey-name" }, "\u70B9\u51FB\u5237\u65B0\u6309\u94AE", -1));
const _hoisted_25 = ["innerHTML"];
const _hoisted_26 = { class: "monkey-checkbox-wrap" };
const _hoisted_27 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue$1.createElementVNode("label", { for: "localStorage" }, "\u6E05\u9664localStorage", -1));
const _hoisted_28 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue$1.createElementVNode("label", { for: "sessionStorage" }, "\u6E05\u9664sessionStorage", -1));
const _hoisted_29 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue$1.createElementVNode("label", { for: "cookie" }, "\u6E05\u9664cookie", -1));
const _sfc_main$1 = /* @__PURE__ */ vue$1.defineComponent({
__name: "setting",
setup(__props) {
vue$1.onMounted(() => {
document.addEventListener("keydown", (e) => {
const code = e.keyCode;
if (code == 13) {
save();
}
});
});
const vTip = {
mounted(el, binding) {
el.onmouseenter = (e) => {
el.title = binding.value;
};
}
};
const tip = vue$1.ref("\u8BBE\u7F6Eurl\u94FE\u63A5\u201C?\u201D\u540E\u7684\u5185\u5BB9\uFF1A\u5728\u5F00\u53D1\u6A21\u5F0F\u4E0B\uFF0C\u6B64\u503C\u5C06\u6DFB\u52A0\u5728\u6240\u6709url\u540E\u9762\u3002");
const jumpTip = vue$1.ref("\u5F00\u542F\u6B64\u529F\u80FD\u540E\uFF0C\u5F53\u60A8\u8F93\u5165\u4E0D\u5B8C\u6574\u8DEF\u7531\u65F6\uFF0C\u811A\u672C\u4F1A\u81EA\u52A8\u8865\u5168");
const refreshTip = vue$1.ref("\u5237\u65B0\u65F6\u7684\u989D\u5916\u9009\u9879");
let select = vue$1.ref();
select.value = GM_getObject("AUTO_JUMP", true);
const devStatus = vue$1.ref(GM_getObject("DEV", true));
const autoJump = () => {
select.value = !select.value;
GM_setObject("AUTO_JUMP", select.value);
};
const dev = () => {
devStatus.value = !devStatus.value;
GM_setObject("DEV", devStatus.value);
};
let inputValue = vue$1.ref("");
inputValue.value = GM_getObject("SEARCH_VALUE", "");
let ensureButton = vue$1.ref(false);
let localStorage2 = vue$1.ref(GM_getObject("CLEAR_LStORAGE", false));
let sessionStorage2 = vue$1.ref(GM_getObject("CLEAR_SStORAGE", false));
let cookie = vue$1.ref(GM_getObject("CLEAR_COOKIE", false));
vue$1.watch(inputValue, (v) => {
if (v.trim() !== GM_getObject("SEARCH_VALUE", "")) {
ensureButton.value = true;
} else {
ensureButton.value = false;
}
});
vue$1.watch(inputValue, (v) => {
if (v.trim() !== GM_getObject("SEARCH_VALUE", "")) {
ensureButton.value = true;
} else {
ensureButton.value = false;
}
});
vue$1.watch(localStorage2, (v) => {
GM_setObject("CLEAR_LStORAGE", v);
});
vue$1.watch(sessionStorage2, (v) => {
GM_setObject("CLEAR_SStORAGE", v);
});
vue$1.watch(cookie, (v) => {
GM_setObject("CLEAR_COOKIE", v);
});
const save = () => {
if (!ensureButton.value)
return;
GM_setObject("SEARCH_VALUE", inputValue.value.trim());
ensureButton.value = false;
let jumpUrl = location.protocol + "//" + location.host + location.pathname;
const queryInfo = inputValue.value.trim();
if (queryInfo) {
jumpUrl += `?${queryInfo}`;
}
location.href = jumpUrl;
};
return (_ctx, _cache) => {
return vue$1.openBlock(), vue$1.createElementBlock("div", _hoisted_1$1, [
vue$1.createElementVNode("div", _hoisted_2$1, [
vue$1.createElementVNode("div", _hoisted_3$1, [
vue$1.createElementVNode("div", _hoisted_4$1, [
_hoisted_5$1,
vue$1.withDirectives(vue$1.createElementVNode("span", {
class: "monkey-icon",
innerHTML: vue$1.unref(help)
}, null, 8, _hoisted_6$1), [
[vTip, tip.value]
])
]),
vue$1.withDirectives(vue$1.createElementVNode("div", {
class: "monkey-ensure",
onClick: save
}, "\u4FDD\u5B58", 512), [
[vue$1.vShow, vue$1.unref(ensureButton)]
])
]),
vue$1.createElementVNode("div", _hoisted_7$1, [
vue$1.withDirectives(vue$1.createElementVNode("input", {
type: "monkey-text",
class: "monkey-input",
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue$1.isRef(inputValue) ? inputValue.value = $event : inputValue = $event),
placeholder: "\u8F93\u5165\u793A\u4F8B\uFF1AloginName=wyc"
}, null, 512), [
[vue$1.vModelText, vue$1.unref(inputValue)]
])
])
]),
vue$1.createElementVNode("div", _hoisted_8, [
vue$1.createElementVNode("div", _hoisted_9, [
vue$1.createElementVNode("div", _hoisted_10, [
_hoisted_11,
vue$1.withDirectives(vue$1.createElementVNode("span", {
class: "monkey-icon",
innerHTML: vue$1.unref(help)
}, null, 8, _hoisted_12), [
[vTip, "\u5F00\u542F\u6B64\u529F\u80FD\u540E\uFF0C\u4EC5\u5728localhost\u57DF\u540D\u4E0B\u663E\u793A\u6B64\u63D2\u4EF6\uFF0C\u5426\u5219\u6240\u6709vue\u9875\u9762\u90FD\u4F1A\u663E\u793A\u6B64\u63D2\u4EF6"]
])
]),
vue$1.createElementVNode("div", {
class: vue$1.normalizeClass(["monkey-right", { select: devStatus.value }]),
onClick: _cache[1] || (_cache[1] = ($event) => dev())
}, _hoisted_14, 2)
])
]),
vue$1.createElementVNode("div", _hoisted_15, [
vue$1.createElementVNode("div", _hoisted_16, [
vue$1.createElementVNode("div", _hoisted_17, [
_hoisted_18,
vue$1.withDirectives(vue$1.createElementVNode("span", {
class: "monkey-icon",
innerHTML: vue$1.unref(help)
}, null, 8, _hoisted_19), [
[vTip, jumpTip.value]
])
]),
vue$1.createElementVNode("div", {
class: vue$1.normalizeClass(["monkey-right", { select: vue$1.unref(select) }]),
onClick: _cache[2] || (_cache[2] = ($event) => autoJump())
}, _hoisted_21, 2)
])
]),
vue$1.createElementVNode("div", _hoisted_22, [
vue$1.createElementVNode("div", _hoisted_23, [
_hoisted_24,
vue$1.withDirectives(vue$1.createElementVNode("span", {
class: "monkey-icon",
innerHTML: vue$1.unref(help)
}, null, 8, _hoisted_25), [
[vTip, refreshTip.value]
])
]),
vue$1.createElementVNode("div", _hoisted_26, [
vue$1.createElementVNode("span", null, [
vue$1.withDirectives(vue$1.createElementVNode("input", {
type: "checkbox",
id: "localStorage",
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => vue$1.isRef(localStorage2) ? localStorage2.value = $event : localStorage2 = $event)
}, null, 512), [
[vue$1.vModelCheckbox, vue$1.unref(localStorage2)]
]),
_hoisted_27
]),
vue$1.createElementVNode("span", null, [
vue$1.withDirectives(vue$1.createElementVNode("input", {
type: "checkbox",
id: "sessionStorage",
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue$1.isRef(sessionStorage2) ? sessionStorage2.value = $event : sessionStorage2 = $event)
}, null, 512), [
[vue$1.vModelCheckbox, vue$1.unref(sessionStorage2)]
]),
_hoisted_28
]),
vue$1.createElementVNode("span", null, [
vue$1.withDirectives(vue$1.createElementVNode("input", {
type: "checkbox",
id: "cookie",
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => vue$1.isRef(cookie) ? cookie.value = $event : cookie = $event)
}, null, 512), [
[vue$1.vModelCheckbox, vue$1.unref(cookie)]
]),
_hoisted_29
])
])
])
]);
};
}
});
const setting_vue_vue_type_style_index_0_scoped_45dd8a4a_lang = "";
const settingCoComponent = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-45dd8a4a"]]);
let realWidth = vue$1.ref();
const position = vue$1.computed(() => {
var _a, _b;
const bodyWidth = (_b = (_a = document == null ? void 0 : document.body) == null ? void 0 : _a.clientWidth) != null ? _b : 0;
const bodyHight2 = document.documentElement.clientHeight;
let boxTop = GM_getObject("BOX_TOP", 20) + "px";
let boxLeft = GM_getObject("BOX_LEFT", 50) + "px";
if (realWidth.value && realWidth.value + GM_getObject("BOX_LEFT", 50) - bodyWidth > 0) {
return {
boxTop,
boxLeft: bodyWidth - realWidth.value + "px"
};
}
if (GM_getObject("BOX_TOP", 20) < 0 || GM_getObject("BOX_TOP", 20) > bodyWidth || GM_getObject("BOX_TOP", 20) > bodyHight2 || GM_getObject("BOX_TOP", 20) < 0) {
return {
boxTop: "20px",
boxLeft: "20px"
};
} else {
return {
boxTop,
boxLeft
};
}
});
const _withScopeId = (n) => (vue$1.pushScopeId("data-v-80110e95"), n = n(), vue$1.popScopeId(), n);
const _hoisted_1 = { class: "monkey-home-wrap" };
const _hoisted_2 = ["innerHTML"];
const _hoisted_3 = { class: "monkey-name" };
const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue$1.createElementVNode("span", { class: "monkey-arrow" }, [
/* @__PURE__ */ vue$1.createElementVNode("img", {
src: _imports_0,
alt: ""
})
], -1));
const _hoisted_5 = { class: "monkey-menu-wrap" };
const _hoisted_6 = ["innerHTML"];
const _hoisted_7 = ["innerHTML"];
const _sfc_main = /* @__PURE__ */ vue$1.defineComponent({
__name: "App",
setup(__props) {
routerJump();
const routerName = vue$1.computed(() => {
const routerList = getRouterInfo();
let routerItem = routerList.find((res) => res.select);
if (!routerItem) {
return "---/---";
} else {
return (routerItem == null ? void 0 : routerItem.name) ? routerItem.name : "---/---";
}
});
const box = vue$1.ref();
vue$1.onMounted(() => {
realWidth.value = box.value.clientWidth;
});
document.addEventListener("click", () => {
createBoxWarp(box.value, null);
});
window.addEventListener("unload", () => {
const routerList = getRouterInfo();
if (routerList.some((res) => location.pathname.includes(res.pathName))) {
GM_setObject("LAST_URL", location.href);
}
if (GM_getObject("REFRESH", true)) {
if (GM_getObject("CLEAR_LStORAGE", false)) {
localStorage.clear();
console.log("[vue-router-tool] localStorage\u5DF2\u7ECF\u6E05\u9664");
}
if (GM_getObject("CLEAR_SStORAGE", false)) {
sessionStorage.clear();
console.log("[vue-router-tool] sessionStorage\u5DF2\u7ECF\u6E05\u9664");
}
if (GM_getObject("CLEAR_COOKIE", false)) {
let keys = document.cookie.match(/[^ =;]+(?=\=)/g);
if (keys) {
for (var i = keys.length; i--; )
document.cookie = keys[i] + "=0;expires=" + new Date(0).toUTCString();
}
console.log("[vue-router-tool] cookie\u5DF2\u7ECF\u6E05\u9664");
}
}
GM_setObject("REFRESH", false);
});
const reLoad = () => {
GM_setObject("REFRESH", true);
location.href = location.href;
};
return (_ctx, _cache) => {
const _directive_color = vue$1.resolveDirective("color");
const _directive_drag = vue$1.resolveDirective("drag");
return vue$1.withDirectives((vue$1.openBlock(), vue$1.createElementBlock("div", {
class: "monkey-wrap",
ref_key: "box",
ref: box,
style: vue$1.normalizeStyle({ top: vue$1.unref(position).boxTop, left: vue$1.unref(position).boxLeft })
}, [
vue$1.createElementVNode("div", _hoisted_1, [
vue$1.createElementVNode("span", {
class: "icon v-drag-handle",
innerHTML: vue$1.unref(home),
onMouseenter: _cache[0] || (_cache[0] = ($event) => vue$1.unref(createBoxWarp)(box.value, null))
}, null, 40, _hoisted_2),
vue$1.createElementVNode("div", {
class: "monkey-name-wrap",
onMouseenter: _cache[1] || (_cache[1] = ($event) => vue$1.unref(createBoxWarp)(box.value, routerComponent))
}, [
vue$1.createElementVNode("span", _hoisted_3, vue$1.toDisplayString(vue$1.unref(routerName)), 1),
_hoisted_4
], 32)
]),
vue$1.createElementVNode("div", _hoisted_5, [
vue$1.withDirectives(vue$1.createElementVNode("span", {
class: "icon",
innerHTML: vue$1.unref(refresh),
onClick: reLoad
}, null, 8, _hoisted_6), [
[_directive_color]
]),
vue$1.withDirectives(vue$1.createElementVNode("span", {
class: "icon",
innerHTML: vue$1.unref(setting),
onMouseenter: _cache[2] || (_cache[2] = ($event) => vue$1.unref(createBoxWarp)(box.value, settingCoComponent)),
onClick: _cache[3] || (_cache[3] = ($event) => vue$1.unref(createBoxWarp)(box.value, settingCoComponent))
}, null, 40, _hoisted_7), [
[_directive_color]
])
])
], 4)), [
[_directive_drag]
]);
};
}
});
const App_vue_vue_type_style_index_0_scoped_80110e95_lang = "";
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-80110e95"]]);
const directive$1 = {
beforeMount(el) {
const dragBox = el;
const dragArea = el.getElementsByClassName("v-drag-handle").length > 0 ? el.getElementsByClassName("v-drag-handle")[0] : el;
const bodyWidth = document.body.clientWidth;
const bodyHight2 = document.documentElement.clientHeight;
dragArea.onmousedown = (e) => {
let domLeft = dragBox.offsetLeft;
let domTop = dragBox.offsetTop;
e.preventDefault();
e.stopPropagation();
let mouseX = e.clientX - domLeft;
let mouseY = e.clientY - domTop;
const domWidth = dragBox.offsetWidth;
const domHeight = dragBox.offsetHeight;
document.onmousemove = (e2) => {
let domCenterLeft = e2.clientX - mouseX;
let domCenterTop = e2.clientY - mouseY;
dragBox.style.left = domCenterLeft + "px";
dragBox.style.top = domCenterTop + "px";
domLeft = dragBox.offsetLeft;
domTop = dragBox.offsetTop;
let domRight = bodyWidth - domLeft - domWidth;
let domBottom = bodyHight2 - domHeight - domTop;
if (domRight <= 0) {
dragBox.style.left = bodyWidth - domWidth + "px";
}
if (domBottom < 0) {
dragBox.style.top = bodyHight2 - domHeight + "px";
}
if (domLeft < 0) {
dragBox.style.left = 0;
}
if (domTop < 0) {
dragBox.style.top = 0;
}
};
document.onmouseup = (e2) => {
e2.preventDefault();
document.onmousemove = null;
document.onmouseup = null;
GM_setObject("BOX_LEFT", dragBox.offsetLeft);
GM_setObject("BOX_TOP", dragBox.offsetTop);
};
};
}
};
const drag = {
install: function(app) {
app.directive("drag", directive$1);
}
};
const color = {
beforeMount(el) {
const wrapDom = el;
const path = el.querySelector("path");
wrapDom.onmouseenter = function() {
path.style.fill = "#3AA7E5";
};
wrapDom.onmouseleave = function() {
path.style.fill = "#C7CBCF";
};
}
};
const directives = {
install: function(app) {
app.directive("color", color);
}
};
const directive = {
install: function(app) {
app.use(drag);
app.use(directives);
}
};
const resetting = () => {
GM_registerMenuCommand("\u91CD\u7F6E\u811A\u672C", function() {
const list = GM_listValues();
if (list.length > 0)
list.forEach((res) => GM_deleteValue(res));
window.location.reload();
});
};
const toolVisibleSet = () => {
const dev = GM_getObject("DEV", true);
let tip = dev ? "\u5728\u6240\u6709vue\u9875\u9762\u663E\u793A\u6B64\u63D2\u4EF6" : "\u4EC5\u5F00\u53D1\u6A21\u5F0F\u663E\u793A\u6B64\u63D2\u4EF6";
GM_registerMenuCommand(tip, function() {
GM_setObject("DEV", !dev);
window.location.reload();
});
};
const registerMenuCommand = function() {
resetting();
toolVisibleSet();
};
unsafeWindow.addEventListener("error", (event) => {
let m = `${event.type}: ${event.message}
`;
console.log(m);
console.log(11);
});
unsafeWindow.addEventListener("load", () => {
const toolVisible = () => {
registerMenuCommand();
if (GM_getObject("DEV", true) && !location.hostname.includes("localhost"))
return false;
const vueApp = document.body.querySelector("div");
return (vueApp == null ? void 0 : vueApp.__vue__) ? true : false;
};
window.addEventListener("pushstate", () => {
alert(11);
});
if (toolVisible()) {
vue$1.createApp(App).use(directive).mount(
(() => {
const app = document.createElement("div");
document.body.append(app);
return app;
})()
);
}
});
})(Vue);