File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " clean-csdn" ,
33 "displayName" : " Clean CSDN Blog" ,
4- "version" : " 1.0.3 " ,
4+ "version" : " 1.0.4 " ,
55 "author" : " Peter Xu" ,
66 "description" : " Just make csdn blog as clean as it should be" ,
77 "type" : " module" ,
Original file line number Diff line number Diff line change @@ -3,3 +3,24 @@ console.log('background is running')
33chrome . runtime . onMessage . addListener ( ( request ) => {
44 chrome . tabs . reload ( request . id )
55} )
6+
7+ chrome . tabs . onUpdated . addListener ( ( tabId , changeInfo , tab ) => {
8+ if ( changeInfo . status === 'complete' ) {
9+ let url = new URL ( tab . url ! )
10+ let domain = url . hostname
11+
12+ if ( domain === 'blog.csdn.net' ) {
13+ // 启用弹出页
14+ chrome . action . setPopup ( {
15+ tabId : tabId ,
16+ popup : 'popup.html' , // 指定你的弹出页面
17+ } )
18+ } else {
19+ // 禁用弹出页,可以设置为空字符串或不设置popup属性
20+ chrome . action . setPopup ( {
21+ tabId : tabId ,
22+ popup : '' , // 禁用弹出页面
23+ } )
24+ }
25+ }
26+ } )
You can’t perform that action at this time.
0 commit comments