Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/app/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ pxer.util.getIDfromURL = function (key = 'id', url = document.URL) {
if (result) return result;

// read id from url
const matchResult = url.match(/\d{4,}/);
const matchResult = url.match(/\d+/);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里有个考虑是,URL里面有可能有别的数字。页码。改成+后会不会把页码识别成id?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该要梳理一下现在新版p站各个页面的url和参数了, 有空我整理一下先看看


return matchResult ? matchResult[0] : null;
};
Expand All @@ -237,4 +237,4 @@ pxer.util.fetchPixivApi = async function (url) {
).body;
};

Object.assign(window, pxer.util);
Object.assign(window, pxer.util);