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:
parent
39d49f5e09
commit
d1c0af7b55
@ -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
BIN
icons/rss-19.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 397 B |
BIN
icons/rss-38.png
Normal file
BIN
icons/rss-38.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 821 B |
@ -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>
|
||||
|
||||
|
@ -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);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user