1
0
mirror of https://github.com/aureliendavid/rsspreview.git synced 2025-08-22 19:28:39 +00:00

use option to use color icon in url bar (#33)

This commit is contained in:
Aurelien David 2020-01-26 14:07:00 +01:00
parent 39d49f5e09
commit d1c0af7b55
5 changed files with 20 additions and 6 deletions

View File

@ -49,14 +49,24 @@ browser.webRequest.onHeadersReceived.addListener(
function handleMessage(request, sender, sendResponse) {
browser.storage.sync.get({orangeIcon: false}).then(function(options){
let popup = new URL(browser.runtime.getURL('popup/popup.html'));
popup.searchParams.set('feeds', JSON.stringify(request));
let popup = new URL(browser.runtime.getURL('popup/popup.html'));
popup.searchParams.set('feeds', JSON.stringify(request));
browser.pageAction.setPopup( {tabId: sender.tab.id, popup: popup.toString() });
browser.pageAction.show(sender.tab.id);
if (options.orangeIcon) {
browser.pageAction.setIcon({tabId: sender.tab.id, path: {
"19": "icons/rss-19.png",
"38": "icons/rss-38.png"
}
});
}
browser.pageAction.setPopup( {tabId: sender.tab.id, popup: popup.toString() });
browser.pageAction.show(sender.tab.id);
//sendResponse({response: "Response from background script to tab " + sender.tab.url , id: sender.tab.id });
//sendResponse({response: "Response from background script to tab " + sender.tab.url , id: sender.tab.id });
});
}
browser.runtime.onMessage.addListener(handleMessage);

BIN
icons/rss-19.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

BIN
icons/rss-38.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 821 B

View File

@ -15,6 +15,8 @@
<hr />
<label class="setting browser-style"><input type="checkbox" id="doAuthor" class="validate" > Display entry author</label>
<hr />
<label class="setting browser-style"><input type="checkbox" id="orangeIcon" class="validate" > Use color icon in address bar</label>
<hr />
<label class="setting browser-style"><input type="checkbox" id="doThumb" class="validate" > Display media:thumbnail images</label>

View File

@ -10,6 +10,7 @@ function saveOptions(e) {
preventPreview: document.querySelector("#preventPreview").checked,
fullPreview: document.querySelector("#fullPreview").checked,
doAuthor: document.querySelector("#doAuthor").checked,
orangeIcon: document.querySelector("#orangeIcon").checked,
enableCss: document.querySelector("#enableCss").checked,
customCss: document.querySelector("#customCss").value
});
@ -27,6 +28,7 @@ function restoreOptions() {
document.querySelector("#preventPreview").checked = result.preventPreview;
document.querySelector("#fullPreview").checked = result.fullPreview;
document.querySelector("#doAuthor").checked = result.doAuthor;
document.querySelector("#orangeIcon").checked = result.orangeIcon;
document.querySelector("#enableCss").checked = result.enableCss;
document.querySelector("#customCss").value = result.customCss;
}
@ -43,6 +45,7 @@ function restoreOptions() {
preventPreview: false,
fullPreview: false,
doAuthor: false,
orangeIcon: false,
enableCss: false,
customCss: null
});
@ -57,4 +60,3 @@ document.addEventListener("DOMContentLoaded", restoreOptions);
document.querySelectorAll('.validate').forEach((elem) => {
elem.addEventListener('change', saveOptions);
});