Skip to content

Commit 773202d

Browse files
committed
2.3 Bug Fixed
1 parent 9193e3a commit 773202d

4 files changed

Lines changed: 19 additions & 20 deletions

File tree

#README/README-ja.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22
<img src="https://github.com/SynRGB/Pixiv-QuickBookmark/raw/main/%23README/icon/256.png" width="20%"/>
3-
<h1>Pixiv-クイックブックマーク <code>v2.2</code></h1>
3+
<h1>Pixiv-クイックブックマーク <code>v2.3</code></h1>
44
<p>
55
<a href='https://github.com/SynRGB/Pixiv-QuickBookmark'><img src="https://img.shields.io/badge/-GitHub-3A3A3A?style=flat&amp;logo=GitHub&amp;logoColor=white" referrerpolicy="no-referrer" alt="GitHub"></a>
66
<a href='https://greasyfork.org/zh-CN/scripts/453417-pixiv-quickbookmark'><img src="https://img.shields.io/badge/-GreasyFork-670000?style=flat&amp;logo=tampermonkey&amp;logoColor=white" referrerpolicy="no-referrer" alt="GreasyFork"></a>

#README/README-zh.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22
<img src="https://github.com/SynRGB/Pixiv-QuickBookmark/raw/main/%23README/icon/256.png" width="20%"/>
3-
<h1>Pixiv-快捷收藏 <code>v2.2</code></h1>
3+
<h1>Pixiv-快捷收藏 <code>v2.3</code></h1>
44
<p>
55
<a href='https://github.com/SynRGB/Pixiv-QuickBookmark'><img src="https://img.shields.io/badge/-GitHub-3A3A3A?style=flat&amp;logo=GitHub&amp;logoColor=white" referrerpolicy="no-referrer" alt="GitHub"></a>
66
<a href='https://greasyfork.org/zh-CN/scripts/453417-pixiv-quickbookmark'><img src="https://img.shields.io/badge/-GreasyFork-670000?style=flat&amp;logo=tampermonkey&amp;logoColor=white" referrerpolicy="no-referrer" alt="GreasyFork"></a>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22
<img src="https://github.com/SynRGB/Pixiv-QuickBookmark/raw/main/%23README/icon/256.png" width="20%"/>
3-
<h1>Pixiv-QuickBookmark <code>v2.2</code></h1>
3+
<h1>Pixiv-QuickBookmark <code>v2.3</code></h1>
44
<p>
55
<a href='https://github.com/SynRGB/Pixiv-QuickBookmark'><img src="https://img.shields.io/badge/-GitHub-3A3A3A?style=flat&amp;logo=GitHub&amp;logoColor=white" referrerpolicy="no-referrer" alt="GitHub"></a>
66
<a href='https://greasyfork.org/en/scripts/453417-pixiv-quickbookmark'><img src="https://img.shields.io/badge/-GreasyFork-670000?style=flat&amp;logo=tampermonkey&amp;logoColor=white" referrerpolicy="no-referrer" alt="GreasyFork"></a>

main.js

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @name:zh-CN Pixiv-快捷收藏
44
// @name:ja Pixiv-クイックブックマーク
55
// @namespace https://github.com/TitanRGB
6-
// @version 2.2
6+
// @version 2.3
77
// @description When press the main area of the image, it will add the bookmark instead of jump to the image page. And add a button to jump to the image page.
88
// @description:zh-CN 点击图片主区域,会直接收藏图片,而不是跳转到图片页面。并额外添加一个按钮用于跳转到图片页面。
99
// @description:ja 画像のメインエリアを押すと、ブックマークが追加され、画像ページにジャンプしなくなります。 さらに、画像ページにジャンプするためのボタンを追加します。
@@ -86,22 +86,21 @@ window.onload = function () {
8686
}
8787
}
8888
run();
89-
}
90-
91-
// if DOM changed, re-run the script
92-
let MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
93-
let observer = new MutationObserver(function (mutations) {
94-
mutations.forEach(function () {
95-
// 通过增加时间间隔来避免无限回调
96-
if (new Date().getTime() - last_run_time > 20) {
97-
main();
98-
// console.log('Pixiv-QuickBookmark: DOM changed');
99-
}
89+
// if DOM changed, re-run the script
90+
let MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
91+
let observer = new MutationObserver(function (mutations) {
92+
mutations.forEach(function () {
93+
// 通过增加时间间隔来避免无限回调
94+
if (new Date().getTime() - last_run_time > 100) {
95+
main();
96+
// console.log('Pixiv-QuickBookmark: DOM changed');
97+
}
98+
});
99+
});
100+
observer.observe(document.body, {
101+
childList: true,
102+
subtree: true
100103
});
101-
});
102-
observer.observe(document.querySelector("div[id='root']"), {
103-
childList: true,
104-
subtree: true
105-
});
104+
}
106105

107106
console.log("JS script Pixiv-QuickBookmark (Pixiv-快捷收藏) loaded. See more details at https://github.com/SynRGB/Pixiv-QuickBookmark");

0 commit comments

Comments
 (0)