File tree 5 files changed +64
-3
lines changed
5 files changed +64
-3
lines changed Original file line number Diff line number Diff line change 6
6
< div class ="glgl-main-box ">
7
7
< div class ="glgl-popup-page-button " id ="add-vertical-line "> 添加纵向辅助线</ div >
8
8
< div class ="glgl-popup-page-button " id ="add-horizontal-line "> 添加横向辅助线</ div >
9
- < i style ="padding-top: 40px; color: gray; "> 更多功能开发中...</ i >
9
+ < div class ="glgl-popup-page-button-warning " id ="remove-all-lines "> 清空全部辅助线</ div >
10
+ < i style ="padding-top: 26px; color: gray; "> 更多功能开发中...</ i >
10
11
</ div >
11
12
</ body >
12
13
42
43
background-color : # e1e1e1 ;
43
44
cursor : pointer;
44
45
}
46
+
47
+ .glgl-popup-page-button-warning {
48
+ width : 100% ;
49
+ height : 30px ;
50
+
51
+ background-color : # fdfdfd ;
52
+
53
+ border-radius : 5px ;
54
+ font-size : 1.2em ;
55
+
56
+ margin-bottom : 10px ;
57
+
58
+ display : flex;
59
+ justify-content : center;
60
+ align-items : center;
61
+ }
62
+
63
+ .glgl-popup-page-button-warning : hover {
64
+ background-color : # FF9090 ;
65
+ cursor : pointer;
66
+ }
45
67
</ style >
46
68
</ html >
Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ function addHorizontalLine() {
2
2
const bodyDom = document . body
3
3
const horizontalLineBgId = `gagl-horizontal-line-bg`
4
4
const horizontalLineId = `gagl-horizontal-line`
5
-
5
+ const gaglLineBgClass = `gagl-line-bg`
6
+
6
7
let mouseIsDown = false
7
8
8
9
const horizontalLineBgMouseOverEvent = ( ) => {
@@ -29,6 +30,7 @@ function addHorizontalLine() {
29
30
const horizontalLineBg = document . createElement ( 'div' )
30
31
31
32
horizontalLineBg . id = horizontalLineBgId
33
+ horizontalLineBg . className = gaglLineBgClass
32
34
33
35
horizontalLineBg . style . width = '100vw'
34
36
horizontalLineBg . style . height = '16px'
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ function addVerticalLine() {
2
2
const bodyDom = document . body
3
3
const verticalLineBgId = `gagl-vertical-line-bg`
4
4
const verticalLineId = `gagl-vertical-line`
5
+ const gaglLineBgClass = `gagl-line-bg`
5
6
6
7
let mouseIsDown = false
7
8
@@ -29,6 +30,7 @@ function addVerticalLine() {
29
30
const verticalLineBg = document . createElement ( 'div' )
30
31
31
32
verticalLineBg . id = verticalLineBgId
33
+ verticalLineBg . className = gaglLineBgClass
32
34
33
35
verticalLineBg . style . width = '16px'
34
36
verticalLineBg . style . height = '100vh'
Original file line number Diff line number Diff line change
1
+ async function removeAllLines ( ) {
2
+ const gaglLineBgClass = `gagl-line-bg`
3
+ const lineDoms = await document . getElementsByClassName ( gaglLineBgClass )
4
+ if ( lineDoms && lineDoms . length > 0 ) {
5
+ const lineDOmsArray = [ ]
6
+ for ( let i = 0 ; i < lineDoms . length ; i ++ ) {
7
+ lineDOmsArray . push ( lineDoms [ i ] )
8
+ }
9
+ if ( lineDOmsArray && lineDOmsArray . length > 0 ) {
10
+ for ( let j = 0 ; j < lineDOmsArray . length ; j ++ ) {
11
+ lineDOmsArray [ j ] . remove ( )
12
+ }
13
+ }
14
+ }
15
+ }
16
+
17
+ removeAllLines ( )
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ const getCurrentTab = async () => {
7
7
8
8
const getCurrentTabId = async ( ) => {
9
9
const currentTab = await getCurrentTab ( )
10
- console . log ( 'currentTab' , currentTab )
11
10
if ( currentTab && currentTab . id ) {
12
11
return currentTab . id
13
12
} else {
@@ -47,3 +46,22 @@ if (addHorizontalLineButton) {
47
46
addHorizontalLineButton . addEventListener ( 'click' , addHorizontalLineOnYourPage )
48
47
}
49
48
49
+
50
+ const removeAllLines = ( ) => {
51
+ getCurrentTabId ( ) . then ( currentTabId => {
52
+ chrome . scripting . executeScript ( {
53
+ target : { tabId : currentTabId } ,
54
+ files : [ "script/actions/removeAllLines.js" ] ,
55
+ } )
56
+ . then ( ( ) => console . log ( "removeAllLines script injected" ) ) ;
57
+ } )
58
+ }
59
+
60
+ const removeAllLinesButton = document . getElementById ( 'remove-all-lines' )
61
+ if ( removeAllLinesButton ) {
62
+ removeAllLinesButton . addEventListener ( 'click' , removeAllLines )
63
+ }
64
+
65
+
66
+
67
+
You can’t perform that action at this time.
0 commit comments