Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions dist/chrome/js/api-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@ let _found_api;

if ('undefined' !== typeof browser && browser.windows && browser.commands && browser.action)
_found_api = browser;
else if ('undefined' !== typeof chrome && chrome.windows && chrome.commands && chrome.browserAction)
_found_api = chrome;
else
else if ('undefined' !== typeof chrome && chrome.windows && chrome.commands) {
if (chrome.action)
_found_api = chrome;
else if (chrome.browserAction) {
const wrapper = Object.create(chrome);
wrapper.action = chrome.browserAction;
_found_api = wrapper;
}
}

if (!_found_api)
throw new Error(`glypher/api-wrapper: ERROR: cannot detect a valid browser API!`);

export default _found_api;
4 changes: 3 additions & 1 deletion dist/chrome/js/background.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import api from './api-wrapper.js';

const windowOptions = {
url: '../pages/glyphs.html',
url: api.runtime && api.runtime.getURL
? api.runtime.getURL('pages/glyphs.html')
: '../pages/glyphs.html',
type: 'normal', // normal popup
state: 'maximized' // maximized fullscreen
};
Expand Down
4 changes: 2 additions & 2 deletions dist/chrome/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
}
},
"options_ui": {
"chrome_style": true,
"open_in_tab": false,
"page": "pages/options.html"
},
"background": {
"page": "pages/background.html"
"service_worker": "js/background.js",
"type": "module"
},
"permissions": [
"clipboardWrite"
Expand Down
14 changes: 11 additions & 3 deletions dist/firefox/js/api-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@ let _found_api;

if ('undefined' !== typeof browser && browser.windows && browser.commands && browser.action)
_found_api = browser;
else if ('undefined' !== typeof chrome && chrome.windows && chrome.commands && chrome.browserAction)
_found_api = chrome;
else
else if ('undefined' !== typeof chrome && chrome.windows && chrome.commands) {
if (chrome.action)
_found_api = chrome;
else if (chrome.browserAction) {
const wrapper = Object.create(chrome);
wrapper.action = chrome.browserAction;
_found_api = wrapper;
}
}

if (!_found_api)
throw new Error(`glypher/api-wrapper: ERROR: cannot detect a valid browser API!`);

export default _found_api;
4 changes: 3 additions & 1 deletion dist/firefox/js/background.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import api from './api-wrapper.js';

const windowOptions = {
url: '../pages/glyphs.html',
url: api.runtime && api.runtime.getURL
? api.runtime.getURL('pages/glyphs.html')
: '../pages/glyphs.html',
type: 'normal', // normal popup
state: 'maximized' // maximized fullscreen
};
Expand Down
3 changes: 2 additions & 1 deletion dist/firefox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"page": "pages/options.html"
},
"background": {
"page": "pages/background.html"
"service_worker": "js/background.js",
"type": "module"
},
"permissions": [
"clipboardWrite"
Expand Down
14 changes: 11 additions & 3 deletions js/api-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@ let _found_api;

if ('undefined' !== typeof browser && browser.windows && browser.commands && browser.action)
_found_api = browser;
else if ('undefined' !== typeof chrome && chrome.windows && chrome.commands && chrome.browserAction)
_found_api = chrome;
else
else if ('undefined' !== typeof chrome && chrome.windows && chrome.commands) {
if (chrome.action)
_found_api = chrome;
else if (chrome.browserAction) {
const wrapper = Object.create(chrome);
wrapper.action = chrome.browserAction;
_found_api = wrapper;
}
}

if (!_found_api)
throw new Error(`glypher/api-wrapper: ERROR: cannot detect a valid browser API!`);

export default _found_api;
4 changes: 3 additions & 1 deletion js/background.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import api from './api-wrapper.js';

const windowOptions = {
url: '../pages/glyphs.html',
url: api.runtime && api.runtime.getURL
? api.runtime.getURL('pages/glyphs.html')
: '../pages/glyphs.html',
type: 'normal', // normal popup
state: 'maximized' // maximized fullscreen
};
Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
}
},
"options_ui": {
"chrome_style": true,
"open_in_tab": false,
"page": "pages/options.html"
},
"background": {
"page": "pages/background.html"
"service_worker": "js/background.js",
"type": "module"
},
"permissions": [
"clipboardWrite"
Expand Down