Skip to content

Commit

Permalink
⚡️ perf: 优化了部分代码
Browse files Browse the repository at this point in the history
  • Loading branch information
dlzmoe committed Sep 15, 2024
1 parent 9466de1 commit 13ab1d1
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 24 deletions.
19 changes: 13 additions & 6 deletions dist/linuxdo-scripts.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,19 @@
emits: ["update:modelValue"],
methods: {
init() {
$(".topic-body .reply-to-tab[aria-expanded='false']").each(function() {
if (!$(this).data("clicked")) {
$(this).click();
$(this).data("clicked", true);
const tabs = $(".reply-to-tab");
let index = 0;
const clickNext = () => {
if (index >= tabs.length) return;
const tab = $(tabs[index]);
if (!tab.data("clicked")) {
tab.click();
tab.data("clicked", true);
}
});
index++;
setTimeout(clickNext, 1e3);
};
clickNext();
}
},
created() {
Expand Down Expand Up @@ -4199,7 +4206,7 @@ ${topic_contentdata}`;
webdavUsername: "",
webdavPassword: ""
},
themes: 0
themes: 6
},
showautoread: false,
showlookop: false,
Expand Down
19 changes: 13 additions & 6 deletions linuxdo-scripts.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,19 @@
emits: ["update:modelValue"],
methods: {
init() {
$(".topic-body .reply-to-tab[aria-expanded='false']").each(function() {
if (!$(this).data("clicked")) {
$(this).click();
$(this).data("clicked", true);
const tabs = $(".reply-to-tab");
let index = 0;
const clickNext = () => {
if (index >= tabs.length) return;
const tab = $(tabs[index]);
if (!tab.data("clicked")) {
tab.click();
tab.data("clicked", true);
}
});
index++;
setTimeout(clickNext, 1e3);
};
clickNext();
}
},
created() {
Expand Down Expand Up @@ -4199,7 +4206,7 @@ ${topic_contentdata}`;
webdavUsername: "",
webdavPassword: ""
},
themes: 0
themes: 6
},
showautoread: false,
showlookop: false,
Expand Down
2 changes: 1 addition & 1 deletion src/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ export default {
webdavUsername: "",
webdavPassword: "",
},
themes: 0,
themes: 6,
},
showautoread: false,
Expand Down
24 changes: 13 additions & 11 deletions src/components/BasicSettings/MenuAutoexpandreply1.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,26 @@ export default {
emits: ["update:modelValue"],
methods: {
init() {
// 遍历所有 aria-expanded 为 false 的按钮
$(".topic-body .reply-to-tab[aria-expanded='false']").each(function () {
// 检查按钮是否已经被点击过
if (!$(this).data("clicked")) {
// 点击按钮
$(this).click();
const tabs = $(".reply-to-tab");
let index = 0;
// 设置标识为已点击
$(this).data("clicked", true);
const clickNext = () => {
if (index >= tabs.length) return;
const tab = $(tabs[index]);
if (!tab.data("clicked")) {
tab.click();
tab.data("clicked", true);
}
});
index++;
setTimeout(clickNext, 1000);
};
clickNext();
},
},
created() {
if (this.modelValue) {
setInterval(() => {
// 检查是否存在按钮
if ($(".topic-body .reply-to-tab").length > 0) {
this.init();
}
Expand Down

0 comments on commit 13ab1d1

Please sign in to comment.