no message
This commit is contained in:
211
Ruaka/Ruaka.ui.css
Normal file
211
Ruaka/Ruaka.ui.css
Normal file
@@ -0,0 +1,211 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html, body {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
|
||||
.iframe-container {
|
||||
display: flex;
|
||||
transition: width 0.5s ease, transform 0.4s ease; /* 增加 width 的动画效果 */
|
||||
height: 100%;
|
||||
}
|
||||
iframe {
|
||||
width: 100%; /* 每个iframe占用100%宽度 */
|
||||
height: 100%;
|
||||
border: none;
|
||||
}
|
||||
.mdui-bottom-nav {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
background-color: #fff;
|
||||
}
|
||||
.mdui-bottom-nav a {
|
||||
flex-grow: 1;
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.mdui-card {
|
||||
background-color:#F2F3FA;
|
||||
|
||||
box-shadow: none;
|
||||
}
|
||||
body {
|
||||
background-color:#F8F9FF;
|
||||
}
|
||||
.mdui-bottom-nav-active {
|
||||
color:#D7E3F7;
|
||||
}
|
||||
|
||||
|
||||
.rk-jump-in {
|
||||
animation: rji 0.5s ease-in-out;
|
||||
opacity: 1;
|
||||
|
||||
}
|
||||
/* 隐藏滚动条,但保留滑动功能 */
|
||||
.rx {
|
||||
overflow-x: scroll; /* 保留横向滚动功能 */
|
||||
scrollbar-width: none; /* 针对 Firefox 浏览器隐藏滚动条 */
|
||||
}
|
||||
|
||||
*::-webkit-scrollbar {
|
||||
display: none; /* 针对 WebKit 浏览器(如 Chrome, Safari)隐藏滚动条 */
|
||||
}
|
||||
|
||||
@keyframes rji {
|
||||
0% { opacity: 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
100% {
|
||||
|
||||
opacity: 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.rk-jump-out {
|
||||
animation: rjo 0.5s ease-in-out;
|
||||
opacity: 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@keyframes rjo {
|
||||
0%{
|
||||
|
||||
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.mdui-menu {
|
||||
|
||||
border-radius: 15px;
|
||||
|
||||
}
|
||||
|
||||
.rk-j-ro {
|
||||
|
||||
border-radius: 15px;
|
||||
}
|
||||
|
||||
.rk-ro {
|
||||
|
||||
border-radius: 15px;
|
||||
background-color: rgba(0, 0, 0, 0.01);
|
||||
backdrop-filter: blur(10px);
|
||||
-webkit-backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.rk-to {
|
||||
|
||||
background-color: rgba(205, 205, 255, 0.03);
|
||||
backdrop-filter: blur(10px);
|
||||
-webkit-backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.rk-a-show {
|
||||
transform: scale(1);
|
||||
animation: fccs 0.5s ease-in-out;
|
||||
}
|
||||
@keyframes fccs {
|
||||
0% {
|
||||
transform: scale(0);
|
||||
|
||||
}
|
||||
100% {
|
||||
|
||||
|
||||
transform: scale(1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.rk-a-hidden {
|
||||
transform: scale(0);
|
||||
animation: fccs 0.5s ease-in-out;
|
||||
}
|
||||
@keyframes fccs {
|
||||
0% {
|
||||
|
||||
transform: scale(1);
|
||||
}
|
||||
100% {
|
||||
|
||||
|
||||
transform: scale(0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.mdui-overlay {
|
||||
|
||||
background-color: rgba(255, 255, 255, 0);
|
||||
backdrop-filter: blur(5px);
|
||||
-webkit-backdrop-filter: blur(5px);
|
||||
}
|
||||
.mdui-btn {
|
||||
border-radius: 15px
|
||||
}
|
||||
.mdui-card {
|
||||
border-radius: 15px
|
||||
}
|
||||
.mdui-dialog {
|
||||
border-radius: 15px
|
||||
}
|
||||
.rk-mid {
|
||||
max-width: 416px; /* 最大宽度不超过 512px */
|
||||
width: 100%; /* 宽度为 100%,但不会超过 max-width */
|
||||
position: absolute; /* 使用绝对定位 */
|
||||
top: 50%; /* 距离顶部 50% */
|
||||
left: 50%; /* 距离左侧 50% */
|
||||
transform: translate(-50%, -50%); /* 通过 transform 将元素的中心点移到准确的中间位置 */
|
||||
}
|
||||
.rk-in-gray-bg {
|
||||
background-color: #ECEEF4; /* Material Design 风格的浅灰色 */
|
||||
border-top-left-radius: 6px; /* 左上角圆角 */
|
||||
border-top-right-radius: 6px; /* 右上角圆角 */
|
||||
padding-bottom: 0px;
|
||||
padding-top: 0px;
|
||||
}
|
||||
.rk-in-la {
|
||||
|
||||
padding-right:15px;
|
||||
padding-left:15px;
|
||||
}
|
||||
|
||||
|
||||
code {color:#2196F3}
|
||||
|
||||
|
||||
|
||||
|
||||
.mdui-table {
|
||||
white-space: nowrap;
|
||||
}
|
||||
210
Ruaka/Ruaka.ui.css.bak
Normal file
210
Ruaka/Ruaka.ui.css.bak
Normal file
@@ -0,0 +1,210 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html, body {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.iframe-container {
|
||||
display: flex;
|
||||
transition: transform 0.4s ease;
|
||||
|
||||
height: 100%;
|
||||
}
|
||||
iframe {
|
||||
width: 100%; /* 每个iframe占用100%宽度 */
|
||||
height: 100%;
|
||||
border: none;
|
||||
}
|
||||
.mdui-bottom-nav {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
background-color: #fff;
|
||||
}
|
||||
.mdui-bottom-nav a {
|
||||
flex-grow: 1;
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.mdui-card {
|
||||
background-color:#F2F3FA;
|
||||
|
||||
box-shadow: none;
|
||||
}
|
||||
body {
|
||||
background-color:#F8F9FF;
|
||||
}
|
||||
.mdui-bottom-nav-active {
|
||||
color:#D7E3F7;
|
||||
}
|
||||
|
||||
|
||||
.rk-jump-in {
|
||||
animation: rji 0.5s ease-in-out;
|
||||
opacity: 1;
|
||||
|
||||
}
|
||||
/* 隐藏滚动条,但保留滑动功能 */
|
||||
.rx {
|
||||
overflow-x: scroll; /* 保留横向滚动功能 */
|
||||
scrollbar-width: none; /* 针对 Firefox 浏览器隐藏滚动条 */
|
||||
}
|
||||
|
||||
*::-webkit-scrollbar {
|
||||
display: none; /* 针对 WebKit 浏览器(如 Chrome, Safari)隐藏滚动条 */
|
||||
}
|
||||
|
||||
@keyframes rji {
|
||||
0% { opacity: 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
100% {
|
||||
|
||||
opacity: 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.rk-jump-out {
|
||||
animation: rjo 0.5s ease-in-out;
|
||||
opacity: 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@keyframes rjo {
|
||||
0%{
|
||||
|
||||
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.mdui-menu {
|
||||
|
||||
border-radius: 15px;
|
||||
|
||||
}
|
||||
|
||||
.rk-j-ro {
|
||||
|
||||
border-radius: 15px;
|
||||
}
|
||||
|
||||
.rk-ro {
|
||||
|
||||
border-radius: 15px;
|
||||
background-color: rgba(0, 0, 0, 0.01);
|
||||
backdrop-filter: blur(10px);
|
||||
-webkit-backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.rk-to {
|
||||
|
||||
background-color: rgba(205, 205, 255, 0.03);
|
||||
backdrop-filter: blur(10px);
|
||||
-webkit-backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.rk-a-show {
|
||||
transform: scale(1);
|
||||
animation: fccs 0.5s ease-in-out;
|
||||
}
|
||||
@keyframes fccs {
|
||||
0% {
|
||||
transform: scale(0);
|
||||
|
||||
}
|
||||
100% {
|
||||
|
||||
|
||||
transform: scale(1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.rk-a-hidden {
|
||||
transform: scale(0);
|
||||
animation: fccs 0.5s ease-in-out;
|
||||
}
|
||||
@keyframes fccs {
|
||||
0% {
|
||||
|
||||
transform: scale(1);
|
||||
}
|
||||
100% {
|
||||
|
||||
|
||||
transform: scale(0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.mdui-overlay {
|
||||
|
||||
background-color: rgba(255, 255, 255, 0);
|
||||
backdrop-filter: blur(5px);
|
||||
-webkit-backdrop-filter: blur(5px);
|
||||
}
|
||||
.mdui-btn {
|
||||
border-radius: 15px
|
||||
}
|
||||
.mdui-card {
|
||||
border-radius: 15px
|
||||
}
|
||||
.mdui-dialog {
|
||||
border-radius: 15px
|
||||
}
|
||||
.rk-mid {
|
||||
max-width: 416px; /* 最大宽度不超过 512px */
|
||||
width: 100%; /* 宽度为 100%,但不会超过 max-width */
|
||||
position: absolute; /* 使用绝对定位 */
|
||||
top: 50%; /* 距离顶部 50% */
|
||||
left: 50%; /* 距离左侧 50% */
|
||||
transform: translate(-50%, -50%); /* 通过 transform 将元素的中心点移到准确的中间位置 */
|
||||
}
|
||||
.rk-in-gray-bg {
|
||||
background-color: #ECEEF4; /* Material Design 风格的浅灰色 */
|
||||
border-top-left-radius: 6px; /* 左上角圆角 */
|
||||
border-top-right-radius: 6px; /* 右上角圆角 */
|
||||
padding-bottom: 0px;
|
||||
padding-top: 0px;
|
||||
}
|
||||
.rk-in-la {
|
||||
|
||||
padding-right:15px;
|
||||
padding-left:15px;
|
||||
}
|
||||
|
||||
|
||||
code {color:#2196F3}
|
||||
|
||||
|
||||
|
||||
|
||||
.mdui-table {
|
||||
white-space: nowrap;
|
||||
}
|
||||
BIN
Ruaka/bili.png
Normal file
BIN
Ruaka/bili.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 65 KiB |
149
Ruaka/jump.js
Normal file
149
Ruaka/jump.js
Normal file
@@ -0,0 +1,149 @@
|
||||
// 主函数:拦截所有跳转行为并处理
|
||||
function interceptRedirects() {
|
||||
// 拦截点击和 JavaScript 触发的跳转
|
||||
document.addEventListener('click', function (event) {
|
||||
if (event.target.tagName === 'A' && event.target.href && !isJavascriptUrl(event.target.href)) {
|
||||
event.preventDefault(); // 阻止默认跳转
|
||||
handleRedirect(event.target.href); // 处理跳转
|
||||
}
|
||||
});
|
||||
|
||||
// 拦截 location.href 或其他形式的直接跳转
|
||||
const originalPushState = history.pushState;
|
||||
const originalReplaceState = history.replaceState;
|
||||
|
||||
// 重写 pushState 以监听 pushState 跳转
|
||||
history.pushState = function () {
|
||||
originalPushState.apply(history, arguments);
|
||||
handleRedirect(location.href); // 处理跳转
|
||||
};
|
||||
|
||||
// 重写 replaceState 以监听 replaceState 跳转
|
||||
history.replaceState = function () {
|
||||
originalReplaceState.apply(history, arguments);
|
||||
handleRedirect(location.href); // 处理跳转
|
||||
};
|
||||
|
||||
// 监听 hash 变化的跳转
|
||||
window.addEventListener('hashchange', function () {
|
||||
handleRedirect(location.href); // 处理跳转
|
||||
});
|
||||
|
||||
// 处理通过 <meta> 标签的跳转 (http-equiv="refresh")
|
||||
function observeMetaTags() {
|
||||
const metaObserver = new MutationObserver(function (mutations) {
|
||||
mutations.forEach(function (mutation) {
|
||||
mutation.addedNodes.forEach(function (node) {
|
||||
// 检查添加的节点及其子节点中是否包含 <meta> 标签
|
||||
if (node.nodeType === 1) { // 确保是元素节点
|
||||
// 检查当前节点是否是 <meta> 标签
|
||||
if (node.tagName === 'META' && node.httpEquiv === 'refresh') {
|
||||
handleMetaRefresh(node);
|
||||
}
|
||||
|
||||
// 检查子节点中是否包含 <meta> 标签
|
||||
node.querySelectorAll('meta[http-equiv="refresh"]').forEach(meta => {
|
||||
handleMetaRefresh(meta);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// 监听整个文档的变化,捕捉 <meta> 标签的插入
|
||||
metaObserver.observe(document.documentElement, { childList: true, subtree: true });
|
||||
}
|
||||
|
||||
// 处理 <meta> 标签的刷新
|
||||
function handleMetaRefresh(meta) {
|
||||
const content = meta.content;
|
||||
const timeout = parseInt(content.split(';')[0].trim()) * 1000 || 0;
|
||||
const url = content.split('url=')[1]?.trim();
|
||||
if (url && !isJavascriptUrl(url)) {
|
||||
// 使用 setTimeout 延时处理跳转
|
||||
setTimeout(() => {
|
||||
handleRedirect(url); // 处理跳转
|
||||
}, timeout);
|
||||
}
|
||||
}
|
||||
|
||||
observeMetaTags(); // 开始监听 <meta> 标签
|
||||
|
||||
// 处理跳转逻辑
|
||||
function handleRedirect(url) {
|
||||
// 给 body 添加 class
|
||||
document.body.classList.add('rk-jump-out');
|
||||
|
||||
rk.tip('Loading...', '<div class="mdui-progress"><div class="mdui-progress-indeterminate"></div></div>', 6000);
|
||||
// 延迟 0.5 秒后执行跳转
|
||||
setTimeout(() => {
|
||||
window.location.href = url; // 跳转到目标 URL
|
||||
}, 500);
|
||||
|
||||
// 在跳转后移除类名
|
||||
setTimeout(() => {
|
||||
document.body.classList.remove('rk-jump-out');
|
||||
}, 2000); // 确保跳转完成后移除类名
|
||||
}
|
||||
|
||||
// 判断 URL 是否以 "javascript:" 开头
|
||||
function isJavascriptUrl(url) {
|
||||
return url.trim().toLowerCase().startsWith("javascript:");
|
||||
}
|
||||
|
||||
// 监听动态生成的元素(包括 <a> 和其他可能的跳转元素)
|
||||
const observer = new MutationObserver(function (mutations) {
|
||||
mutations.forEach(function (mutation) {
|
||||
mutation.addedNodes.forEach(function (node) {
|
||||
// 动态生成的 <a> 标签
|
||||
if (node.tagName === 'A' && node.href && !isJavascriptUrl(node.href)) {
|
||||
node.addEventListener('click', function (event) {
|
||||
event.preventDefault();
|
||||
handleRedirect(node.href); // 处理跳转
|
||||
});
|
||||
}
|
||||
|
||||
// 动态生成的其他元素(可能包含跳转逻辑的元素)
|
||||
if (node.nodeType === 1) {
|
||||
node.querySelectorAll('a').forEach(a => {
|
||||
if (!isJavascriptUrl(a.href)) {
|
||||
a.addEventListener('click', function (event) {
|
||||
event.preventDefault();
|
||||
handleRedirect(a.href); // 处理跳转
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
|
||||
// 专门监听 mdui-dialog 的展示和链接点击行为
|
||||
function observeDialogLinks() {
|
||||
const dialogs = document.querySelectorAll('.mdui-dialog');
|
||||
|
||||
dialogs.forEach(dialog => {
|
||||
dialog.addEventListener('open.mdui.dialog', function() {
|
||||
// 在对话框打开时,绑定其内的 <a> 标签的点击事件
|
||||
dialog.querySelectorAll('a').forEach(a => {
|
||||
if (!isJavascriptUrl(a.href)) {
|
||||
a.addEventListener('click', function(event) {
|
||||
event.preventDefault();
|
||||
handleRedirect(a.href); // 处理跳转
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化时调用一次,监听所有 .mdui-dialog
|
||||
observeDialogLinks();
|
||||
}
|
||||
|
||||
// 在页面加载完成时初始化拦截器
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
interceptRedirects();
|
||||
});
|
||||
148
Ruaka/jump.js.bak
Normal file
148
Ruaka/jump.js.bak
Normal file
@@ -0,0 +1,148 @@
|
||||
// 主函数:拦截所有跳转行为并处理
|
||||
function interceptRedirects() {
|
||||
// 拦截点击和 JavaScript 触发的跳转
|
||||
document.addEventListener('click', function (event) {
|
||||
if (event.target.tagName === 'A' && event.target.href && !isJavascriptUrl(event.target.href)) {
|
||||
event.preventDefault(); // 阻止默认跳转
|
||||
handleRedirect(event.target.href); // 处理跳转
|
||||
}
|
||||
});
|
||||
|
||||
// 拦截 location.href 或其他形式的直接跳转
|
||||
const originalPushState = history.pushState;
|
||||
const originalReplaceState = history.replaceState;
|
||||
|
||||
// 重写 pushState 以监听 pushState 跳转
|
||||
history.pushState = function () {
|
||||
originalPushState.apply(history, arguments);
|
||||
handleRedirect(location.href); // 处理跳转
|
||||
};
|
||||
|
||||
// 重写 replaceState 以监听 replaceState 跳转
|
||||
history.replaceState = function () {
|
||||
originalReplaceState.apply(history, arguments);
|
||||
handleRedirect(location.href); // 处理跳转
|
||||
};
|
||||
|
||||
// 监听 hash 变化的跳转
|
||||
window.addEventListener('hashchange', function () {
|
||||
handleRedirect(location.href); // 处理跳转
|
||||
});
|
||||
|
||||
// 处理通过 <meta> 标签的跳转 (http-equiv="refresh")
|
||||
function observeMetaTags() {
|
||||
const metaObserver = new MutationObserver(function (mutations) {
|
||||
mutations.forEach(function (mutation) {
|
||||
mutation.addedNodes.forEach(function (node) {
|
||||
// 检查添加的节点及其子节点中是否包含 <meta> 标签
|
||||
if (node.nodeType === 1) { // 确保是元素节点
|
||||
// 检查当前节点是否是 <meta> 标签
|
||||
if (node.tagName === 'META' && node.httpEquiv === 'refresh') {
|
||||
handleMetaRefresh(node);
|
||||
}
|
||||
|
||||
// 检查子节点中是否包含 <meta> 标签
|
||||
node.querySelectorAll('meta[http-equiv="refresh"]').forEach(meta => {
|
||||
handleMetaRefresh(meta);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// 监听整个文档的变化,捕捉 <meta> 标签的插入
|
||||
metaObserver.observe(document.documentElement, { childList: true, subtree: true });
|
||||
}
|
||||
|
||||
// 处理 <meta> 标签的刷新
|
||||
function handleMetaRefresh(meta) {
|
||||
const content = meta.content;
|
||||
const timeout = parseInt(content.split(';')[0].trim()) * 1000 || 0;
|
||||
const url = content.split('url=')[1]?.trim();
|
||||
if (url && !isJavascriptUrl(url)) {
|
||||
// 使用 setTimeout 延时处理跳转
|
||||
setTimeout(() => {
|
||||
handleRedirect(url); // 处理跳转
|
||||
}, timeout);
|
||||
}
|
||||
}
|
||||
|
||||
observeMetaTags(); // 开始监听 <meta> 标签
|
||||
|
||||
// 处理跳转逻辑
|
||||
function handleRedirect(url) {
|
||||
// 给 body 添加 class
|
||||
document.body.classList.add('rk-jump-out');
|
||||
|
||||
// 延迟 0.5 秒后执行跳转
|
||||
setTimeout(() => {
|
||||
window.location.href = url; // 跳转到目标 URL
|
||||
}, 500);
|
||||
|
||||
// 在跳转后移除类名
|
||||
setTimeout(() => {
|
||||
document.body.classList.remove('rk-jump-out');
|
||||
}, 2000); // 确保跳转完成后移除类名
|
||||
}
|
||||
|
||||
// 判断 URL 是否以 "javascript:" 开头
|
||||
function isJavascriptUrl(url) {
|
||||
return url.trim().toLowerCase().startsWith("javascript:");
|
||||
}
|
||||
|
||||
// 监听动态生成的元素(包括 <a> 和其他可能的跳转元素)
|
||||
const observer = new MutationObserver(function (mutations) {
|
||||
mutations.forEach(function (mutation) {
|
||||
mutation.addedNodes.forEach(function (node) {
|
||||
// 动态生成的 <a> 标签
|
||||
if (node.tagName === 'A' && node.href && !isJavascriptUrl(node.href)) {
|
||||
node.addEventListener('click', function (event) {
|
||||
event.preventDefault();
|
||||
handleRedirect(node.href); // 处理跳转
|
||||
});
|
||||
}
|
||||
|
||||
// 动态生成的其他元素(可能包含跳转逻辑的元素)
|
||||
if (node.nodeType === 1) {
|
||||
node.querySelectorAll('a').forEach(a => {
|
||||
if (!isJavascriptUrl(a.href)) {
|
||||
a.addEventListener('click', function (event) {
|
||||
event.preventDefault();
|
||||
handleRedirect(a.href); // 处理跳转
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
|
||||
// 专门监听 mdui-dialog 的展示和链接点击行为
|
||||
function observeDialogLinks() {
|
||||
const dialogs = document.querySelectorAll('.mdui-dialog');
|
||||
|
||||
dialogs.forEach(dialog => {
|
||||
dialog.addEventListener('open.mdui.dialog', function() {
|
||||
// 在对话框打开时,绑定其内的 <a> 标签的点击事件
|
||||
dialog.querySelectorAll('a').forEach(a => {
|
||||
if (!isJavascriptUrl(a.href)) {
|
||||
a.addEventListener('click', function(event) {
|
||||
event.preventDefault();
|
||||
handleRedirect(a.href); // 处理跳转
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化时调用一次,监听所有 .mdui-dialog
|
||||
observeDialogLinks();
|
||||
}
|
||||
|
||||
// 在页面加载完成时初始化拦截器
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
interceptRedirects();
|
||||
});
|
||||
92
Ruaka/res.js
Normal file
92
Ruaka/res.js
Normal file
@@ -0,0 +1,92 @@
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
// 获取所有的表单
|
||||
const forms = document.querySelectorAll('form');
|
||||
|
||||
forms.forEach(function (form) {
|
||||
// 检查是否包含 normal 属性,若有则跳过
|
||||
if (form.hasAttribute('normal')) {
|
||||
return; // 跳过此表单
|
||||
}
|
||||
|
||||
// 移除之前可能绑定的事件监听器,确保不会重复绑定
|
||||
form.removeEventListener('submit', handleFormSubmit);
|
||||
|
||||
// 绑定新的事件监听器
|
||||
form.addEventListener('submit', handleFormSubmit);
|
||||
});
|
||||
|
||||
function handleFormSubmit(event) {
|
||||
event.preventDefault(); // 阻止默认提交
|
||||
|
||||
const form = event.target;
|
||||
|
||||
// 添加防止重复提交的标志
|
||||
if (form.dataset.isSubmitting === 'true') {
|
||||
return; // 如果已经在提交,则直接返回,防止重复提交
|
||||
}
|
||||
|
||||
form.dataset.isSubmitting = 'true'; // 标记表单为正在提交
|
||||
|
||||
// 显示加载提示
|
||||
rk.tip('Loading...', '<div class="mdui-progress"><div class="mdui-progress-indeterminate"></div></div>', 6000);
|
||||
|
||||
// 获取表单中的提交按钮
|
||||
const submitButton = form.querySelector('button[type="submit"]');
|
||||
|
||||
// 给提交按钮设置禁用状态
|
||||
if (submitButton) {
|
||||
submitButton.disabled = true;
|
||||
}
|
||||
|
||||
// 给id为 rk-form-load 的元素添加 rk-a-show class
|
||||
const loader = document.getElementById('rk-form-load');
|
||||
if (loader) {
|
||||
loader.classList.remove('rk-a-hidden');
|
||||
loader.classList.add('rk-a-show');
|
||||
}
|
||||
|
||||
// 使用 FormData 对象获取表单数据
|
||||
const formData = new FormData(form);
|
||||
|
||||
// 使用 fetch 发起请求
|
||||
fetch(form.action, {
|
||||
method: form.method,
|
||||
body: formData,
|
||||
})
|
||||
.then(response => response.text()) // 获取纯文本响应
|
||||
.then(data => {
|
||||
// 提交成功时的处理
|
||||
rk.tip('Tip', data, 3); // 使用 rk.tip 输出提示
|
||||
|
||||
// 延迟移除加载的 rk-a-show 类并添加 rk-a-hidden 类
|
||||
setTimeout(() => {
|
||||
if (loader) {
|
||||
loader.classList.remove('rk-a-show');
|
||||
loader.classList.add('rk-a-hidden');
|
||||
}
|
||||
// 恢复提交按钮的可点击状态
|
||||
if (submitButton) {
|
||||
submitButton.disabled = false;
|
||||
}
|
||||
form.dataset.isSubmitting = 'false'; // 解除提交锁定
|
||||
}, 500); // 延迟 0.5 秒
|
||||
})
|
||||
.catch(error => {
|
||||
// 处理错误情况
|
||||
rk.tip('错误', '提交出错: ' + error.message, 3); // 使用 rk.tip 输出错误信息
|
||||
|
||||
// 延迟移除加载的 rk-a-show 类并添加 rk-a-hidden 类
|
||||
setTimeout(() => {
|
||||
if (loader) {
|
||||
loader.classList.add('rk-a-hidden');
|
||||
loader.classList.remove('rk-a-show');
|
||||
}
|
||||
// 恢复提交按钮的可点击状态
|
||||
if (submitButton) {
|
||||
submitButton.disabled = false;
|
||||
}
|
||||
form.dataset.isSubmitting = 'false'; // 解除提交锁定
|
||||
}, 500); // 延迟 0.5 秒
|
||||
});
|
||||
}
|
||||
});
|
||||
90
Ruaka/res.js.bak
Normal file
90
Ruaka/res.js.bak
Normal file
@@ -0,0 +1,90 @@
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
// 获取所有的表单
|
||||
const forms = document.querySelectorAll('form');
|
||||
|
||||
forms.forEach(function (form) {
|
||||
// 检查是否包含 normal 属性,若有则跳过
|
||||
if (form.hasAttribute('normal')) {
|
||||
return; // 跳过此表单
|
||||
}
|
||||
|
||||
// 移除之前可能绑定的事件监听器,确保不会重复绑定
|
||||
form.removeEventListener('submit', handleFormSubmit);
|
||||
|
||||
// 绑定新的事件监听器
|
||||
form.addEventListener('submit', handleFormSubmit);
|
||||
});
|
||||
|
||||
function handleFormSubmit(event) {
|
||||
event.preventDefault(); // 阻止默认提交
|
||||
|
||||
const form = event.target;
|
||||
|
||||
// 添加防止重复提交的标志
|
||||
if (form.dataset.isSubmitting === 'true') {
|
||||
return; // 如果已经在提交,则直接返回,防止重复提交
|
||||
}
|
||||
|
||||
form.dataset.isSubmitting = 'true'; // 标记表单为正在提交
|
||||
|
||||
// 获取表单中的提交按钮
|
||||
const submitButton = form.querySelector('button[type="submit"]');
|
||||
|
||||
// 给提交按钮设置禁用状态
|
||||
if (submitButton) {
|
||||
submitButton.disabled = true;
|
||||
}
|
||||
|
||||
// 给id为 rk-form-load 的元素添加 rk-a-show class
|
||||
const loader = document.getElementById('rk-form-load');
|
||||
if (loader) {
|
||||
loader.classList.remove('rk-a-hidden');
|
||||
loader.classList.add('rk-a-show');
|
||||
}
|
||||
|
||||
// 使用 FormData 对象获取表单数据
|
||||
const formData = new FormData(form);
|
||||
|
||||
// 使用 fetch 发起请求
|
||||
fetch(form.action, {
|
||||
method: form.method,
|
||||
body: formData,
|
||||
})
|
||||
|
||||
.then(response => response.text()) // 获取纯文本响应
|
||||
.then(data => {
|
||||
// 提交成功时的处理
|
||||
rk.tip('Tip', data, 3); // 使用 rk.tip 输出提示
|
||||
|
||||
// 延迟移除加载的 rk-a-show 类并添加 rk-a-hidden 类
|
||||
setTimeout(() => {
|
||||
if (loader) {
|
||||
loader.classList.remove('rk-a-show');
|
||||
loader.classList.add('rk-a-hidden');
|
||||
}
|
||||
// 恢复提交按钮的可点击状态
|
||||
if (submitButton) {
|
||||
submitButton.disabled = false;
|
||||
}
|
||||
form.dataset.isSubmitting = 'false'; // 解除提交锁定
|
||||
}, 500); // 延迟 0.5 秒
|
||||
})
|
||||
.catch(error => {
|
||||
// 处理错误情况
|
||||
rk.tip('错误', '提交出错: ' + error.message, 3); // 使用 rk.tip 输出错误信息
|
||||
|
||||
// 延迟移除加载的 rk-a-show 类并添加 rk-a-hidden 类
|
||||
setTimeout(() => {
|
||||
if (loader) {
|
||||
loader.classList.add('rk-a-hidden');
|
||||
loader.classList.remove('rk-a-show');
|
||||
}
|
||||
// 恢复提交按钮的可点击状态
|
||||
if (submitButton) {
|
||||
submitButton.disabled = false;
|
||||
}
|
||||
form.dataset.isSubmitting = 'false'; // 解除提交锁定
|
||||
}, 500); // 延迟 0.5 秒
|
||||
});
|
||||
}
|
||||
});
|
||||
47
Ruaka/tip.css
Normal file
47
Ruaka/tip.css
Normal file
@@ -0,0 +1,47 @@
|
||||
.rk-tip-in {
|
||||
bottom:50px;
|
||||
right:10px;
|
||||
animation: rki 1s ease;
|
||||
}
|
||||
|
||||
@keyframes rki {
|
||||
0% {
|
||||
right:-520px;
|
||||
bottom:60px;
|
||||
}
|
||||
40% {
|
||||
right:10px;
|
||||
bottom:60px;
|
||||
}
|
||||
60 %{
|
||||
right:10px;
|
||||
bottom:20px;
|
||||
|
||||
}
|
||||
100 %{
|
||||
right:10px;
|
||||
bottom:50px;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.rk-tip-out {
|
||||
right:-520px;
|
||||
bottom:-110px;
|
||||
animation: rko 1s ease;
|
||||
}
|
||||
|
||||
@keyframes rko {
|
||||
0% {
|
||||
bottom:50px;
|
||||
right:10px;
|
||||
}
|
||||
50% {
|
||||
bottom:-20px;
|
||||
right:10px;
|
||||
}
|
||||
100% {
|
||||
bottom:110px;
|
||||
right:-520px;
|
||||
}
|
||||
}
|
||||
47
Ruaka/tip.css.bak
Normal file
47
Ruaka/tip.css.bak
Normal file
@@ -0,0 +1,47 @@
|
||||
.rk-tip-in {
|
||||
bottom:30px;
|
||||
right:10px;
|
||||
animation: rki 1s ease;
|
||||
}
|
||||
|
||||
@keyframes rki {
|
||||
0% {
|
||||
right:-520px;
|
||||
bottom:50px;
|
||||
}
|
||||
40% {
|
||||
right:10px;
|
||||
bottom:50px;
|
||||
}
|
||||
60 %{
|
||||
right:10px;
|
||||
bottom:-10px;
|
||||
|
||||
}
|
||||
100 %{
|
||||
right:10px;
|
||||
bottom:10px;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.rk-tip-out {
|
||||
right:-520px;
|
||||
bottom:-110px;
|
||||
animation: rko 1s ease;
|
||||
}
|
||||
|
||||
@keyframes rko {
|
||||
0% {
|
||||
bottom:30px;
|
||||
right:10px;
|
||||
}
|
||||
50% {
|
||||
bottom:-20px;
|
||||
right:10px;
|
||||
}
|
||||
100% {
|
||||
bottom:110px;
|
||||
right:-520px;
|
||||
}
|
||||
}
|
||||
80
Ruaka/tip.js
Normal file
80
Ruaka/tip.js
Normal file
@@ -0,0 +1,80 @@
|
||||
// 创建 rk 对象
|
||||
const rk = {
|
||||
activeTips: [], // 当前激活的提示框数组
|
||||
};
|
||||
|
||||
// 定义 rk.tip 函数
|
||||
rk.tip = function(a, b, c) {
|
||||
// 移除所有活动提示框
|
||||
this.removeAllTips();
|
||||
|
||||
// 创建新的提示框
|
||||
this.createTip(a, b, c);
|
||||
};
|
||||
|
||||
// 创建提示框的辅助函数
|
||||
rk.createTip = function(a, b, c) {
|
||||
// 创建提示框元素
|
||||
const tipElement = document.createElement('div');
|
||||
tipElement.style.width = '80%';
|
||||
tipElement.style.right = '10px';
|
||||
tipElement.style.maxWidth = '512px';
|
||||
tipElement.style.position = 'fixed';
|
||||
tipElement.style.zIndex = '1000000';
|
||||
tipElement.className = 'mdui-list-item mdui-ripple mdui-card rk-j-ro';
|
||||
|
||||
|
||||
|
||||
// 添加内容到提示框
|
||||
tipElement.innerHTML = `
|
||||
<i class="mdui-list-item-avatar mdui-icon material-icons mdui-color-blue mdui-text-color-white">fiber_manual_record</i>
|
||||
<div class="mdui-list-item-content">
|
||||
<div class="mdui-list-item-title">${a}</div>
|
||||
<div class="mdui-list-item-text">${b}</div>
|
||||
</div>`;
|
||||
|
||||
// 添加到文档主体和当前活动提示框数组中
|
||||
document.body.appendChild(tipElement);
|
||||
this.activeTips.push(tipElement); // 保存当前提示框
|
||||
|
||||
// 显示动画
|
||||
setTimeout(() => {
|
||||
tipElement.classList.add('rk-tip-in'); // 添加出现时的类
|
||||
}, 0); // 延迟以显示动画
|
||||
|
||||
// 计算显示时间,确保最短为2秒
|
||||
const showTime = Math.max(c * 1000 + 1000, 1000);
|
||||
|
||||
// 开始计时以移除提示框
|
||||
setTimeout(() => {
|
||||
this.removeTip(tipElement);
|
||||
}, showTime);
|
||||
};
|
||||
|
||||
// 定义移除单个提示框的辅助函数
|
||||
rk.removeTip = function(tipElement) {
|
||||
if (!tipElement) return;
|
||||
|
||||
// 立即添加 rk-tip-out 类以开始移除过程
|
||||
tipElement.classList.remove('rk-tip-in');
|
||||
tipElement.classList.add('rk-tip-out');
|
||||
|
||||
// 0.5秒后删除 DOM 结构
|
||||
setTimeout(() => {
|
||||
document.body.removeChild(tipElement);
|
||||
this.activeTips = this.activeTips.filter(tip => tip !== tipElement); // 从数组中移除
|
||||
}, 1000); // 动画持续时间
|
||||
};
|
||||
|
||||
// 定义移除所有提示框的函数
|
||||
rk.removeAllTips = function() {
|
||||
// 遍历并移除所有活动提示框
|
||||
this.activeTips.forEach(tipElement => {
|
||||
this.removeTip(tipElement);
|
||||
});
|
||||
};
|
||||
|
||||
// 定义 rk.tip.re 函数
|
||||
rk.tip.re = function() {
|
||||
this.removeAllTips();
|
||||
};
|
||||
80
Ruaka/tip.js.bak
Normal file
80
Ruaka/tip.js.bak
Normal file
@@ -0,0 +1,80 @@
|
||||
// 创建 rk 对象
|
||||
const rk = {
|
||||
activeTips: [], // 当前激活的提示框数组
|
||||
};
|
||||
|
||||
// 定义 rk.tip 函数
|
||||
rk.tip = function(a, b, c) {
|
||||
// 移除所有活动提示框
|
||||
this.removeAllTips();
|
||||
|
||||
// 创建新的提示框
|
||||
this.createTip(a, b, c);
|
||||
};
|
||||
|
||||
// 创建提示框的辅助函数
|
||||
rk.createTip = function(a, b, c) {
|
||||
// 创建提示框元素
|
||||
const tipElement = document.createElement('div');
|
||||
tipElement.style.width = '80%';
|
||||
tipElement.style.right = '10px';
|
||||
tipElement.style.maxWidth = '512px';
|
||||
tipElement.style.position = 'fixed';
|
||||
tipElement.style.zIndex = '10000';
|
||||
tipElement.className = 'mdui-list-item mdui-ripple mdui-card rk-j-ro';
|
||||
|
||||
|
||||
|
||||
// 添加内容到提示框
|
||||
tipElement.innerHTML = `
|
||||
<i class="mdui-list-item-avatar mdui-icon material-icons mdui-color-blue mdui-text-color-white">fiber_manual_record</i>
|
||||
<div class="mdui-list-item-content">
|
||||
<div class="mdui-list-item-title">${a}</div>
|
||||
<div class="mdui-list-item-text">${b}</div>
|
||||
</div>`;
|
||||
|
||||
// 添加到文档主体和当前活动提示框数组中
|
||||
document.body.appendChild(tipElement);
|
||||
this.activeTips.push(tipElement); // 保存当前提示框
|
||||
|
||||
// 显示动画
|
||||
setTimeout(() => {
|
||||
tipElement.classList.add('rk-tip-in'); // 添加出现时的类
|
||||
}, 0); // 延迟以显示动画
|
||||
|
||||
// 计算显示时间,确保最短为2秒
|
||||
const showTime = Math.max(c * 1000 + 1000, 1000);
|
||||
|
||||
// 开始计时以移除提示框
|
||||
setTimeout(() => {
|
||||
this.removeTip(tipElement);
|
||||
}, showTime);
|
||||
};
|
||||
|
||||
// 定义移除单个提示框的辅助函数
|
||||
rk.removeTip = function(tipElement) {
|
||||
if (!tipElement) return;
|
||||
|
||||
// 立即添加 rk-tip-out 类以开始移除过程
|
||||
tipElement.classList.remove('rk-tip-in');
|
||||
tipElement.classList.add('rk-tip-out');
|
||||
|
||||
// 0.5秒后删除 DOM 结构
|
||||
setTimeout(() => {
|
||||
document.body.removeChild(tipElement);
|
||||
this.activeTips = this.activeTips.filter(tip => tip !== tipElement); // 从数组中移除
|
||||
}, 1000); // 动画持续时间
|
||||
};
|
||||
|
||||
// 定义移除所有提示框的函数
|
||||
rk.removeAllTips = function() {
|
||||
// 遍历并移除所有活动提示框
|
||||
this.activeTips.forEach(tipElement => {
|
||||
this.removeTip(tipElement);
|
||||
});
|
||||
};
|
||||
|
||||
// 定义 rk.tip.re 函数
|
||||
rk.tip.re = function() {
|
||||
this.removeAllTips();
|
||||
};
|
||||
Reference in New Issue
Block a user