File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,24 @@ window.addEventListener('DOMContentLoaded', () => {
2727  for  ( const  dependency  of  [ 'chrome' ,  'node' ,  'electron' ] )  { 
2828    replaceText ( `${ dependency }  -version` ,  process . versions [ dependency ] ) 
2929  } 
30+ 
31+   const  items  =  document . getElementsByTagName ( 'a' ) 
32+   for  ( const  e  of  items )  { 
33+     if  ( e . href  ===  'https://github.com/LinuxSuRen/api-testing' )  { 
34+         const  openButton  =  document . createElement ( 'button' ) ; 
35+         openButton . style  =  'margin-left: 10px; margin-bottom: 5px;' ; 
36+         openButton . innerText  =  'Open in Browser' ; 
37+         openButton . onclick  =  ( )  =>  { 
38+             ipcRenderer . invoke ( 'getHomePage' ) . then ( ( homePage )  =>  { 
39+               if  ( homePage )  { 
40+                 ipcRenderer . invoke ( 'openWithExternalBrowser' ,  homePage ) ; 
41+               } 
42+             } ) 
43+         } ; 
44+         e . parentNode . insertBefore ( openButton ,  e . nextSibling ) ; 
45+         return 
46+     } 
47+   } ; 
3048} ) 
3149
3250contextBridge . exposeInMainWorld ( 'electronAPI' ,  { 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments