// ==UserScript==
// @name Vue开发路由跳转辅助工具《vue-router-tool》
// @namespace npm/vue-router-tool
// @version 0.0.6
// @author shixiaoshi
// @description 对于Vue项目的开发,多路由之间的切换是浪费时间且麻烦的,使用本插件,可以让您在路由之间顺畅切换。智能的路径补全,可以更快打开您开发的项目。
// @license MIT
// @icon https://vitejs.dev/logo.svg
// @match https://*/*
// @match http://*/*
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.global.prod.js
// @grant GM_deleteValue
// @grant GM_getValue
// @grant GM_listValues
// @grant GM_registerMenuCommand
// @grant GM_setValue
// @run-at document-end
// @noframes
// ==/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 style = "";
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 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 = '<svg t="1669278323056" class="icon" viewBox="0 0 1030 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="13893" width="200" height="200"><path d="M996.7104 441.97888 609.4336 38.8096C585.36448 13.77792 553.20064 0 518.72256 0S452.08064 13.77792 428.01664 38.8096L40.73984 441.97888c-39.9616 41.61536-34.816 77.58336-28.2112 92.61056 4.70528 10.65984 20.60288 39.9616 66.39616 39.9616l56.76544 0 0 310.15936c0 70.41536 50.56 136.71936 122.41408 136.71936l65.14688 0L422.9632 1021.42976l0-72.87808 0-255.36c0-35.19488-5.32992-54.79936 30.61248-54.79936l65.14688 0 65.14688 0c35.93728 0 30.61248 19.60448 30.61248 54.79936l0 255.36 0 72.87808 99.71712 0 65.152 0c71.84896 0 122.40384-66.304 122.40384-136.71936l0-310.15936 56.77056 0c45.77792 0 61.68576-29.30176 66.39616-39.9616C1031.53664 519.56736 1036.672 483.59424 996.7104 441.97888z" p-id="13894" fill=" #3AA7E5"></path></svg>';
const refresh = '<svg t="1669279529953" class="icon" viewBox="0 0 1025 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="23522" width="200" height="200"><path d="M1017.856 460.8l-185.408-233.536c-20.48-25.6-58.368-25.6-78.848 0L569.216 460.8C554.88 478.208 568.256 504.832 590.784 504.832l72.704 0c-2.048 136.192-2.048 309.312-240.704 447.552-6.144 4.096-3.072 13.312 4.096 12.288 456.768-70.656 493.632-376.896 494.656-458.816l75.776 0C1019.904 504.832 1032.192 478.208 1017.856 460.8L1017.856 460.8zM434.048 519.168 361.344 519.168c2.048-136.192 2.048-309.312 240.704-447.552 6.144-4.096 3.072-13.312-4.096-12.288C141.12 129.984 104.256 437.248 103.232 518.144L27.456 518.144c-22.528 0-35.84 26.624-21.504 44.032l185.344 233.536c20.48 25.6 58.368 25.6 78.848 0l185.408-233.536C468.864 545.792 456.576 519.168 434.048 519.168L434.048 519.168zM434.048 519.168" p-id="23523" fill="#C7CBCF"></path></svg>';
const setting = '<svg t="1669279735275" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="46658" width="200" height="200"><path d="M1017.377674 456.010825c-3.988848-22.373567-25.431206-44.900629-47.617507-49.979298l-16.45067-3.802606c-39.015595-11.780301-73.665767-37.860283-95.66685-75.9416-22.185278-38.356586-27.235294-81.920778-17.633612-121.807207l4.860704-15.611559c6.66991-21.719674-1.994424-51.633984-19.256576-66.345034 0 0-15.643282-13.20986-59.709917-38.699394-44.060495-25.457812-63.191204-32.410154-63.191204-32.410154-21.37789-7.726985-51.54291-0.37146-66.99688 16.32992l-11.594059 12.462846c-29.665647 28.045753-69.645197 45.215808-113.584941 45.215808-44.152593 0-84.258009-17.294898-113.954355-45.526893L385.393999 67.804269c-15.393595-16.669658-45.591361-24.056905-66.967204-16.325827 0 0-19.131733 6.915503-63.290465 32.405037-43.996027 25.490557-59.546188 38.639019-59.546188 38.639019-17.326621 14.71105-26.019607 44.500517-19.289322 66.313312l4.827959 15.769149c9.474792 39.853683 4.364401 83.325777-17.633612 121.653711-22.063505 38.235836-57.056484 64.380286-96.228645 76.030627L51.186288 405.967058c-22.090111 5.050016-43.564191 27.608801-47.553039 49.950645 0 0-3.613294 20.09978-3.613294 71.109548 0 51.012837 3.613294 71.019497 3.613294 71.019497 4.02057 22.434965 25.461905 44.933375 47.553039 50.105165l15.708773 3.492544c39.325657 11.713786 74.411757 37.95238 96.600105 76.343759 22.091134 38.327934 27.14115 81.892125 17.573237 121.779577l-4.767584 15.579837c-6.730285 21.686928 1.962701 51.601238 19.349697 66.309218 0 0 15.551184 13.21293 59.644425 38.702464 44.093241 25.551956 63.164598 32.411177 63.164598 32.411177 21.408589 7.726985 51.509141 0.311085 66.967204-16.269545l11.06194-11.902074c29.697369-28.355815 69.829392-45.617967 114.047476-45.617967 44.189432 0 84.387969 17.386996 114.210181 45.617967l0.027629 0 10.940167 11.902074c15.45397 16.58063 45.493124 23.99653 66.930365 16.269545 0 0 19.071358-6.979972 63.321164-32.411177 44.002167-25.489534 59.579957-38.702464 59.579957-38.702464 17.328667-14.70798 25.928532-44.496423 19.323091-66.309218l-4.860704-16.080234c-9.349949-39.761586-4.239558-83.139535 17.633612-121.279181 22.25077-38.452777 57.277518-64.569598 96.538707-76.343759l0-0.065492 15.705704-3.612271c22.187325-5.051039 43.62866-27.545356 47.615461-49.983391 0 0 3.613294-20.068058 3.613294-71.109548C1020.990968 476.078883 1017.377674 456.010825 1017.377674 456.010825zM510.507508 691.592284c-90.588181 0-164.067706-73.665767-164.067706-164.532287 0-90.741677 73.478502-164.342975 164.067706-164.342975 90.584088 0 163.970492 73.633021 163.970492 164.467819C674.478 618.052384 601.091596 691.592284 510.507508 691.592284z" p-id="46659" fill="#C7CBCF"></path></svg>';
const vue = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>';
const vueGray = '<svg t="1669605726745" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3188" width="200" height="200"><path d="M512 504L764.8 68.8h-134.4L512 275.2 393.6 70.4h-134.4L512 504zM819.2 70.4L512 600 204.8 68.8H0l512 886.4L1024 70.4H819.2z" fill="#C7CBCF" p-id="3189"></path></svg>';
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.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 = '<svg t="1669619334491" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="27331" width="200" height="200"><path d="M512 0a512 512 0 1 0 512 512A512 512 0 0 0 512 0z m0 897.365333a102.4 102.4 0 1 1 102.4-102.4 102.4 102.4 0 0 1-102.4 102.4z m0-260.949333c-68.266667 0-123.050667-318.976-123.050667-386.901333a123.050667 123.050667 0 0 1 246.101334 0c0 67.925333-54.784 386.901333-123.050667 386.901333z" p-id="27332" fill="#C7CBCF"></path></svg>';
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();
};
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("load", () => {
if (toolVisible()) {
vue$1.createApp(App).use(directive).mount(
(() => {
const app = document.createElement("div");
document.body.append(app);
return app;
})()
);
}
});
})(Vue);