1
0
mirror of https://github.com/aureliendavid/rsspreview.git synced 2025-08-22 11:18:37 +00:00

fix default options for android

This commit is contained in:
Aurelien David 2024-05-03 14:40:05 +02:00
parent 257dcbdfab
commit 5307b43846
2 changed files with 16 additions and 23 deletions

View File

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "RSSPreview",
"version": "3.30",
"version": "3.31",
"author": "Aurelien David",
"homepage_url": "https://github.com/aureliendavid/rsspreview",

View File

@ -1,8 +1,4 @@
var options = {
newTab: true,
};
var android = false;
browser.runtime.getPlatformInfo().then((info) => {
@ -10,16 +6,6 @@ browser.runtime.getPlatformInfo().then((info) => {
});
function onOptions(opts) {
options = opts;
}
function onError(error) {
console.log(`Error on get options: ${error}`);
}
browser.storage.sync.get(options).then(onOptions, onError);
document.addEventListener("DOMContentLoaded", function(event) {
@ -30,6 +16,9 @@ document.addEventListener("DOMContentLoaded", function(event) {
const tabId = +url.searchParams.get('tabId');
const feeds = JSON.parse(url.searchParams.get('feeds'));
browser.runtime.getPlatformInfo().then((info) => {
android = info.os == "android";
for (feed_url in feeds) {
if (feeds.hasOwnProperty(feed_url)) {
@ -43,18 +32,18 @@ document.addEventListener("DOMContentLoaded", function(event) {
li.appendChild(a);
browser.runtime.getPlatformInfo().then((info) => {
android = info.os == "android"
if (android)
li.classList.add("android-feed-btn");
});
if (android)
li.classList.add("android-feed-btn");
feedList.appendChild(li);
}
}
browser.storage.sync.get({newTab: !android}).then(function(options) {
document.querySelectorAll(".panel-list-item").forEach( (elem) => {
function onUpdated(tab) {
@ -82,6 +71,10 @@ document.addEventListener("DOMContentLoaded", function(event) {
});
});
}); // end forall
}); // end options
}); // and getplatform
});