File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 6
6
// @license MIT
7
7
// @description A floating table of content widget
8
8
// @description :zh-CN 在页面右侧展示一个浮动的文章大纲目录
9
- // @version 1.4.2
9
+ // @version 1.4.3
10
10
// @match *://www.jianshu.com/p/*
11
11
// @match *://cdn2.jianshu.io/p/*
12
12
// @match *://zhuanlan.zhihu.com/p/*
@@ -381,7 +381,7 @@ a.toc-link {
381
381
382
382
const cachedPosition = POSITION_STORAGE . get ( options . siteName )
383
383
if ( ! isEmpty ( cachedPosition ) ) {
384
- this . element . style . top = `${ cachedPosition . top } px`
384
+ this . element . style . top = `${ Math . max ( 0 , cachedPosition . top ) } px`
385
385
this . element . style . right = `${ cachedPosition . right } px`
386
386
} else if ( options . hasOwnProperty ( 'initialTop' ) ) {
387
387
this . element . style . top = `${ options . initialTop } px`
@@ -458,7 +458,7 @@ a.toc-link {
458
458
const deltaY = e . pageY - dragState . startMouseY
459
459
// 要换算为 right 数字
460
460
const newRight = dragState . startElementDisToRight - deltaX
461
- const newTop = dragState . startPositionY + deltaY
461
+ const newTop = Math . max ( 0 , dragState . startPositionY + deltaY )
462
462
Object . assign ( dragState , {
463
463
curTop : newTop ,
464
464
curRight : newRight ,
You can’t perform that action at this time.
0 commit comments