File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed
Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -83,9 +83,20 @@ export class Trope {
8383 }
8484
8585 private extractTitle ( document : Document ) {
86- const titleElement = document . querySelector ( ".entry-title a" ) ;
87- if ( titleElement ?. textContent ) {
88- return titleElement . textContent . trim ( ) ;
86+ const titleElement = document . querySelector (
87+ ".wrap-entry-breadcrumb strong"
88+ ) ;
89+ const text = titleElement
90+ ? Array . prototype . filter
91+ . call (
92+ titleElement ?. childNodes ,
93+ ( child ) => child . nodeType === Node . TEXT_NODE
94+ )
95+ . map ( ( child ) => child . textContent )
96+ . join ( "" )
97+ : null ;
98+ if ( text ) {
99+ return text . trim ( ) ;
89100 }
90101 throw new LaconicError ( "NO_TITLE" ) ;
91102 }
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import { defineContentScript } from "wxt/sandbox";
88
99const INITIAL_CONTENT = "Loading..." ;
1010const HOVER_SELECTOR =
11- ".twikilink, .subpage-link[title='The Laconic page']:not(.curr-subpage)" ;
11+ ".twikilink, .subpage-link[title='The Laconic page']:not(.curr-subpage), .section-links a " ;
1212
1313export default defineContentScript ( {
1414 matches : [ "*://tvtropes.org/*" ] ,
You can’t perform that action at this time.
0 commit comments