@@ -3,16 +3,15 @@ chrome.tabs.query({ active: true, currentWindow: true }).then(([tab]) => {
33 {
44 target : { tabId : tab . id } ,
55 func : ( ) => {
6- return { isPDF : document . contentType === " application/pdf" } ;
6+ return { isPDF : document . contentType === ' application/pdf' } ;
77 } ,
88 } ,
99 ( tab ) => {
10- preferencesHeader . textContent =
11- chrome . i18n . getMessage ( "preferencesHeader" ) ;
12- autoOpenLabel . textContent = chrome . i18n . getMessage ( "autoOpenLabel" ) ;
10+ preferencesHeader . textContent = chrome . i18n . getMessage ( 'preferencesHeader' ) ;
11+ autoOpenLabel . textContent = chrome . i18n . getMessage ( 'autoOpenLabel' ) ;
1312
1413 if ( ! tab ) {
15- openEditorButton . textContent = chrome . i18n . getMessage ( " openEditor" ) ;
14+ openEditorButton . textContent = chrome . i18n . getMessage ( ' openEditor' ) ;
1615 return ;
1716 }
1817
@@ -23,8 +22,8 @@ chrome.tabs.query({ active: true, currentWindow: true }).then(([tab]) => {
2322 ] = tab ;
2423
2524 openEditorButton . textContent = isPDF
26- ? chrome . i18n . getMessage ( " editWithSimplePDF" )
27- : chrome . i18n . getMessage ( " openEditor" ) ;
25+ ? chrome . i18n . getMessage ( ' editWithSimplePDF' )
26+ : chrome . i18n . getMessage ( ' openEditor' ) ;
2827 } ,
2928 ) ;
3029} ) ;
@@ -33,7 +32,7 @@ async function handleOpenEditor() {
3332 const openEditor = ( ) => {
3433 const currentURL = document . location . href ;
3534
36- const isPDF = document . contentType === " application/pdf" ;
35+ const isPDF = document . contentType === ' application/pdf' ;
3736
3837 const href = isPDF ? currentURL : null ;
3938
@@ -49,7 +48,7 @@ async function handleOpenEditor() {
4948 await chrome . scripting . executeScript (
5049 {
5150 target : { tabId : tab . id } ,
52- files : [ " ./node_modules/@simplepdf/web-embed-pdf/dist/index.js" ] ,
51+ files : [ ' ./node_modules/@simplepdf/web-embed-pdf/dist/index.js' ] ,
5352 } ,
5453 ( ) => {
5554 if ( chrome . runtime . lastError ) {
@@ -64,7 +63,7 @@ async function handleOpenEditor() {
6463 }
6564
6665 window . simplePDF . setConfig ( {
67- companyIdentifier : " chrome" ,
66+ companyIdentifier : ' chrome' ,
6867 } ) ;
6968 } ,
7069 } ) ;
@@ -78,25 +77,22 @@ async function handleOpenEditor() {
7877
7978 window . close ( ) ;
8079 } catch ( e ) {
81- chrome . tabs . create ( { url : "https://simplePDF.com/editor" , active : false } ) ;
82- openEditorButton . style . display = "none" ;
83- errorDetails . textContent = chrome . i18n . getMessage (
84- "unableToOpenInCurrentTab" ,
85- ) ;
86- errorMessage . textContent = chrome . i18n . getMessage ( "openedInOtherTab" ) ;
80+ chrome . tabs . create ( { url : 'https://simplePDF.com/editor' , active : false } ) ;
81+ openEditorButton . style . display = 'none' ;
82+ errorDetails . textContent = chrome . i18n . getMessage ( 'unableToOpenInCurrentTab' ) ;
83+ errorMessage . textContent = chrome . i18n . getMessage ( 'openedInOtherTab' ) ;
8784
88- await fetch ( " https://chrome.simplePDF.com/graphql" , {
89- method : " POST" ,
85+ await fetch ( ' https://chrome.simplePDF.com/graphql' , {
86+ method : ' POST' ,
9087 headers : {
91- " Content-Type" : " application/json" ,
88+ ' Content-Type' : ' application/json' ,
9289 } ,
9390 body : JSON . stringify ( {
94- query :
95- "mutation Track($input: TrackEventInput!) { track(input: $input) }" ,
91+ query : 'mutation Track($input: TrackEventInput!) { track(input: $input) }' ,
9692 variables : {
9793 input : {
98- type : " ERROR" ,
99- name : " Chrome extension error" ,
94+ type : ' ERROR' ,
95+ name : ' Chrome extension error' ,
10096 data : JSON . stringify ( { name : e . name , message : e . message } ) ,
10197 } ,
10298 } ,
@@ -105,10 +101,9 @@ async function handleOpenEditor() {
105101 }
106102}
107103
108- document . addEventListener ( "DOMContentLoaded" , ( ) => {
109- chrome . storage . local . get ( "userPreferences" , ( { userPreferences } ) => {
110- const isAutoOpenedDefined =
111- userPreferences && typeof userPreferences . autoOpen !== "undefined" ;
104+ document . addEventListener ( 'DOMContentLoaded' , ( ) => {
105+ chrome . storage . local . get ( 'userPreferences' , ( { userPreferences } ) => {
106+ const isAutoOpenedDefined = userPreferences && typeof userPreferences . autoOpen !== 'undefined' ;
112107
113108 if ( isAutoOpenedDefined ) {
114109 autoOpenRadio . checked = userPreferences . autoOpen ;
@@ -119,7 +114,7 @@ document.addEventListener("DOMContentLoaded", () => {
119114 } ) ;
120115
121116 setTimeout ( ( ) => {
122- toggle . classList . add ( " withTransition" ) ;
117+ toggle . classList . add ( ' withTransition' ) ;
123118 } , 200 ) ;
124119} ) ;
125120
@@ -130,5 +125,5 @@ const handleChangeAutoOpenPreferences = (e) => {
130125 chrome . storage . local . set ( { userPreferences : preferences } ) ;
131126} ;
132127
133- openEditorButton . addEventListener ( " click" , handleOpenEditor ) ;
134- autoOpenRadio . addEventListener ( " change" , handleChangeAutoOpenPreferences ) ;
128+ openEditorButton . addEventListener ( ' click' , handleOpenEditor ) ;
129+ autoOpenRadio . addEventListener ( ' change' , handleChangeAutoOpenPreferences ) ;
0 commit comments