File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 1414 "64" : " icons/icon64.png" ,
1515 "128" : " icons/icon128.png"
1616 },
17+ "permissions" : [" activeTab" ],
1718 "action" : { "default_title" : " __MSG_prefix_ask__ Perplexity.ai" },
1819 "omnibox" : { "keyword" : " @perplexity" },
1920 "background" : { "service_worker" : " service-worker.js" },
Original file line number Diff line number Diff line change @@ -10,8 +10,12 @@ const perplexityURL = 'https://www.perplexity.ai'
1010} ) ( )
1111
1212// Launch Perplexity on toolbar icon click
13- chrome . action . onClicked . addListener ( ( ) => chrome . tabs . create ( { url : perplexityURL } ) )
13+ chrome . action . onClicked . addListener ( async ( ) => {
14+ const [ activeTab ] = await chrome . tabs . query ( { active : true , currentWindow : true } ) ,
15+ query = activeTab . url ? new URL ( activeTab . url ) . searchParams . get ( 'q' ) || 'hi' : 'hi'
16+ chrome . tabs . create ( { url : `${ perplexityURL } /search/new?q=${ query } ` } )
17+ } )
1418
1519// Query Perplexity on omnibox query submitted
1620chrome . omnibox . onInputEntered . addListener ( query =>
17- chrome . tabs . update ( { url : `${ perplexityURL } /search/new?q=${ decodeURIComponent ( query ) } ` } ) )
21+ chrome . tabs . update ( { url : `${ perplexityURL } /search/new?q=${ query } ` } ) )
You can’t perform that action at this time.
0 commit comments