-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: 0.3.34 some new features have been added
- Loading branch information
Showing
9 changed files
with
1,272 additions
and
759 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
- 修复:频繁触发接口的问题 | ||
- 新增:快捷阅读下一个帖子 | ||
- 新增:屏蔽视频自动播放 | ||
- 新增:禁用选中分享功能 | ||
- 优化:修改了部分代码逻辑 |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<template> | ||
<div class="item"> | ||
<div class="tit">{{ sort }}. 禁用视频自动播放</div> | ||
<input | ||
type="checkbox" | ||
:checked="modelValue" | ||
@change="$emit('update:modelValue', $event.target.checked)" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: ["modelValue", "sort"], | ||
emits: ["update:modelValue"], | ||
created() { | ||
if (this.modelValue) { | ||
setInterval(() => { | ||
$(".cooked iframe, .cooked video").each(function () { | ||
const $element = $(this); | ||
let src = $element.attr("src"); | ||
// 检查 src 是否存在 | ||
if (src) { | ||
// 检查是否已有 autoplay=false | ||
if (!src.includes("autoplay=false")) { | ||
// 检查是否已有 autoplay 参数 | ||
if (src.includes("autoplay=")) { | ||
// 如果存在,替换为 autoplay=false | ||
src = src.replace(/autoplay=[^&]*/, "autoplay=false"); | ||
} else { | ||
// 如果不存在,添加 autoplay=false | ||
const separator = src.includes("?") ? "&" : "?"; | ||
src += `${separator}autoplay=false`; | ||
} | ||
// 更新 src 属性 | ||
$element.attr("src", src); | ||
} | ||
} | ||
}); | ||
}, 1000); | ||
} | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<template> | ||
<div class="item"> | ||
<div class="tit">{{ sort }}. 开启快速打开下一个帖子(快捷键:双击 <kbd>→</kbd>)</div> | ||
<input | ||
type="checkbox" | ||
:checked="modelValue" | ||
@change="$emit('update:modelValue', $event.target.checked)" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: ["modelValue", "sort"], | ||
emits: ["update:modelValue"], | ||
methods: { | ||
messageToast(message) { | ||
const messageElement = $(`<div class="messageToast-text">${message}</div>`); | ||
$("#messageToast").append(messageElement); | ||
setTimeout(() => { | ||
messageElement.remove(); | ||
}, 3000); | ||
}, | ||
async init() { | ||
const id = $(".post-stream .topic-post:last-child") | ||
.find("article") | ||
.attr("data-topic-id"); | ||
let currentId = parseInt(id) + 1; | ||
const maxAttempts = 10; | ||
const checkPageExists = async (idToCheck) => { | ||
const newUrl = `/t/topic/${idToCheck}`; | ||
try { | ||
const response = await fetch(newUrl); | ||
if (response.ok) { | ||
this.messageToast("正在跳转下一个帖子!"); | ||
window.location.href = newUrl; | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} catch (error) { | ||
console.error("请求出错:", error); | ||
this.messageToast("请求出错,请稍后再试。"); | ||
return false; | ||
} | ||
}; | ||
for (let attempts = 0; attempts < maxAttempts; attempts++) { | ||
const exists = await checkPageExists(currentId); | ||
if (exists) { | ||
break; | ||
} | ||
currentId++; | ||
} | ||
if (currentId === parseInt(id) + 1 + maxAttempts) { | ||
this.messageToast("已是最新帖子!"); | ||
} | ||
}, | ||
}, | ||
created() { | ||
if (this.modelValue) { | ||
let lastKeyTime = 0; // 上一次按键的时间 | ||
const doubleClickTime = 300; // 双击的时间间隔(毫秒) | ||
document.addEventListener("keydown", (event) => { | ||
// 检查是否按下右箭头键 | ||
if (event.key === "ArrowRight") { | ||
const currentTime = Date.now(); | ||
// 检查时间间隔 | ||
if (currentTime - lastKeyTime <= doubleClickTime) { | ||
this.init(); | ||
} | ||
// 更新上一次按键的时间 | ||
lastKeyTime = currentTime; | ||
} | ||
}); | ||
} | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<template> | ||
<div class="item"> | ||
<div class="tit">{{ sort }}. 禁用选中文字分享功能</div> | ||
<input | ||
type="checkbox" | ||
:checked="modelValue" | ||
@change="$emit('update:modelValue', $event.target.checked)" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: ["modelValue", "sort"], | ||
emits: ["update:modelValue"], | ||
created() { | ||
if (this.modelValue) { | ||
$("head").append(`<style> | ||
.quote-button .quote-sharing{display:none!important} | ||
</style>`); | ||
} | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
## 0.3.33 | ||
|
||
- 新增:快捷阅读下一个帖子 | ||
- 新增:屏蔽视频自动播放 | ||
- 新增:禁用选中分享功能 | ||
- 优化:修改了部分代码逻辑 | ||
|
||
## 0.3.32 | ||
|
||
- 修复:频繁触发接口的问题 | ||
|