Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pause 了 10 分钟,10 分钟之后还能正常刷 douyin,必须新开一个 douyin 页面才会被拦截,有办法解决吗? #3

Closed
douseful opened this issue Apr 29, 2024 · 1 comment

Comments

@douseful
Copy link

已经把 douyin 添加到正则且能正常拦截
本人浏览器是 Edge 设备 Mac 插件版本 2.2.3

@ygweric
Copy link
Owner

ygweric commented Apr 30, 2024

目前是监听OnUpdatedChangeInfoType事件,也就是新开tab的事件内容,文档在这里 https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/onUpdated

When the user navigates to a new URL in a tab, this typically generates several onUpdated events as various properties of the tabs.Tab object are updated. This includes the url, but also potentially the title and favIconUrl properties. The status property will cycle through "loading" and "complete".

解决方法:插件开启,或者暂停时间到了以后,有个setTimoutOut方法,来iterate所有的tab,检测url匹配后关闭。

var tabs = await chrome.tabs.query({});
tabs.forEach(function (tab) {
  // do whatever you want with the tab
});

我个人认为这个需求比较小众吧,没必要监听当前页面,暂停(放松)过后,关闭抖音就行,开始工作,自动关闭不是太友好,万一再看关键内容呢,也意义不大。以后有相似需求我会加上。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants