Переглянути джерело

made compatible with Opera

Gildas 7 роки тому
батько
коміт
87796d1109
2 змінених файлів з 9 додано та 2 видалено
  1. 2 1
      README
  2. 7 1
      extension/ui/scripts/bg/ui.js

+ 2 - 1
README

@@ -1,9 +1,10 @@
-SingleFile is an extension for Chrome, FireFox, and Edge that helps you to archive a complete page into a single HTML file.
+SingleFile is an extension for Chrome, FireFox, Opera, and Edge that helps you to archive a complete page into a single HTML file.
 
 Available on:
 
  - Firefox: https://addons.mozilla.org/en-US/firefox/addon/single-file
  - Chrome: https://chrome.google.com/extensions/detail/mpiodijhokgodhhofbcjdecpffjipkle
+ - Opera: https://addons.opera.com/fr/extensions/details/singlefile/
  - Edge: The extension is not on the store yet, you must install it manually
 
 SingleFile is free software: you can redistribute it and/or modify

+ 7 - 1
extension/ui/scripts/bg/ui.js

@@ -49,7 +49,13 @@ singlefile.ui = (() => {
 	});
 	browser.browserAction.onClicked.addListener(tab => {
 		if (isAllowedURL(tab.url)) {
-			browser.tabs.query({ currentWindow: true, highlighted: true }, tabs => tabs.forEach(processTab));
+			browser.tabs.query({ currentWindow: true, highlighted: true }, tabs => {
+				if (!tabs.length) {
+					browser.tabs.query({ currentWindow: true, active: true }, tabs => tabs.forEach(processTab));
+				} else {
+					tabs.forEach(processTab);
+				}
+			});
 		}
 	});
 	browser.tabs.onActivated.addListener(activeInfo => browser.tabs.get(activeInfo.tabId, tab => onActive(tab.id, isAllowedURL(tab.url))));