@@ -5,63 +5,64 @@ import { t, domParse, querySelector, querySelectorAll, useStyle } from 'helper';
55
66import type { EhContext } from './helper' ;
77
8- const addQuickFavorite = (
9- favoriteButton : HTMLElement ,
10- root : HTMLElement ,
11- apiUrl : string ,
12- height : number ,
13- top = 0 ,
14- ) => {
15- useStyle ( `
16- .comidread-favorites {
17- position: absolute;
18- z-index: 75;
19- left: 0;
8+ const style = `
9+ .comidread-favorites {
10+ position: absolute;
11+ z-index: 75;
12+ left: 0;
2013
21- overflow: auto;
22- align-content: center;
14+ overflow: auto;
15+ align-content: center;
2316
24- box-sizing: border-box;
25- width: 100%;
26- padding-left: 0.6em;
17+ box-sizing: border-box;
18+ width: 100%;
19+ padding-left: 0.6em;
2720
28- border: none;
29- border-radius: 0;
30- }
21+ border: none;
22+ border-radius: 0;
23+ }
3124
32- .comidread-favorites-item {
33- cursor: pointer;
25+ .comidread-favorites-item {
26+ cursor: pointer;
3427
35- display: flex;
36- align-items: center;
28+ display: flex;
29+ align-items: center;
3730
38- width: 100%;
39- margin: 1em 0;
31+ width: 100%;
32+ margin: 1em 0;
4033
41- text-align: left;
42- overflow-wrap: anywhere;
43- }
34+ text-align: left;
35+ overflow-wrap: anywhere;
36+ }
4437
45- .comidread-favorites-item > input {
46- pointer-events: none;
47- margin: 0 0.5em 0 0;
48- }
38+ .comidread-favorites-item > input {
39+ pointer-events: none;
40+ margin: 0 0.5em 0 0;
41+ }
4942
50- .comidread-favorites-item > div {
51- flex-shrink: 0;
43+ .comidread-favorites-item > div {
44+ flex-shrink: 0;
5245
53- width: 15px;
54- height: 15px;
55- margin: 0 0.5em 0 0;
46+ width: 15px;
47+ height: 15px;
48+ margin: 0 0.5em 0 0;
5649
57- background-image: url("https://ehgt.org/g/fav.png");
58- background-repeat: no-repeat;
59- }
50+ background-image: url("https://ehgt.org/g/fav.png");
51+ background-repeat: no-repeat;
52+ }
6053
61- .gl1t > .comidread-favorites {
62- padding: 1em 1.5em;
63- }
64- ` ) ;
54+ .gl1t > .comidread-favorites {
55+ padding: 1em 1.5em;
56+ }
57+ ` ;
58+
59+ const addQuickFavorite = (
60+ favoriteButton : HTMLElement ,
61+ root : HTMLElement ,
62+ apiUrl : string ,
63+ height : number ,
64+ top = 0 ,
65+ ) => {
6566 root . style . position = 'relative' ;
6667
6768 const [ show , setShow ] = createSignal ( false ) ;
@@ -189,6 +190,7 @@ const addQuickFavorite = (
189190export const quickFavorite = ( context : EhContext ) => {
190191 switch ( context . type ) {
191192 case 'gallery' : {
193+ useStyle ( style ) ;
192194 const button = querySelector ( '#gdf' ) ! ;
193195 const root = querySelector ( '#gd3' ) ! ;
194196 const height = ( button . firstElementChild as HTMLElement ) . offsetTop ;
@@ -197,6 +199,7 @@ export const quickFavorite = (context: EhContext) => {
197199 }
198200
199201 case 't' : {
202+ useStyle ( style ) ;
200203 for ( const item of querySelectorAll ( '.gl1t' ) ) {
201204 const button = item . querySelector < HTMLElement > ( '[id^=posted_]' ) ! ;
202205 const top =
@@ -212,6 +215,7 @@ export const quickFavorite = (context: EhContext) => {
212215 }
213216
214217 case 'e' : {
218+ useStyle ( style ) ;
215219 for ( const item of querySelectorAll ( '.gl1e' ) ) {
216220 const button =
217221 item . nextElementSibling ! . querySelector < HTMLElement > ( '[id^=posted_]' ) ! ;
0 commit comments