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

v3.30: run on firefox for android nightly

This commit is contained in:
Aurelien David 2024-05-03 14:15:37 +02:00
parent b9f80de6ac
commit 257dcbdfab
6 changed files with 149 additions and 6 deletions

View File

@ -69,7 +69,11 @@ browser.webRequest.onHeadersReceived.addListener(
function handleMessage(request, sender, sendResponse) { function handleMessage(request, sender, sendResponse) {
browser.storage.sync.get({orangeIcon: false}).then(function(options){
browser.runtime.getPlatformInfo().then((info) => {
let android = info.os == "android"
browser.storage.sync.get({orangeIcon: android}).then(function(options){
let popup = new URL(browser.runtime.getURL('popup/popup.html')); let popup = new URL(browser.runtime.getURL('popup/popup.html'));
popup.searchParams.set('tabId', sender.tab.id.toString()); popup.searchParams.set('tabId', sender.tab.id.toString());
@ -88,6 +92,7 @@ function handleMessage(request, sender, sendResponse) {
//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); browser.runtime.onMessage.addListener(handleMessage);

View File

@ -2,7 +2,7 @@
"manifest_version": 2, "manifest_version": 2,
"name": "RSSPreview", "name": "RSSPreview",
"version": "3.21", "version": "3.30",
"author": "Aurelien David", "author": "Aurelien David",
"homepage_url": "https://github.com/aureliendavid/rsspreview", "homepage_url": "https://github.com/aureliendavid/rsspreview",
@ -48,6 +48,9 @@
"browser_specific_settings": { "browser_specific_settings": {
"gecko": { "gecko": {
"id": "{7799824a-30fe-4c67-8b3e-7094ea203c94}" "id": "{7799824a-30fe-4c67-8b3e-7094ea203c94}"
},
"gecko_android": {
"strict_min_version": "113.0"
} }
}, },

View File

@ -4,7 +4,20 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<script src="popup.js"></script> <script src="popup.js"></script>
<style>
.android-feed-btn {
font-size: 40px;
margin-top: 10px;
padding-top:30px;
padding-bottom: 30px;
background-color: rgba(0, 0, 0, 0.06);
border-block: 1px solid rgba(0, 0, 0, 0.1);
}
.android-feed-btn:hover:active {
background-color: rgba(0, 0, 0, 0.1);
}
</style>
</head> </head>
<body> <body>

View File

@ -3,6 +3,13 @@ var options = {
newTab: true, newTab: true,
}; };
var android = false;
browser.runtime.getPlatformInfo().then((info) => {
android = info.os == "android"
});
function onOptions(opts) { function onOptions(opts) {
options = opts; options = opts;
} }
@ -35,6 +42,15 @@ document.addEventListener("DOMContentLoaded", function(event) {
a.innerText = feeds[feed_url]; a.innerText = feeds[feed_url];
li.appendChild(a); li.appendChild(a);
browser.runtime.getPlatformInfo().then((info) => {
android = info.os == "android"
if (android)
li.classList.add("android-feed-btn");
});
feedList.appendChild(li); feedList.appendChild(li);
} }
} }
@ -51,11 +67,18 @@ document.addEventListener("DOMContentLoaded", function(event) {
let url = elem.getAttribute("data-href"); let url = elem.getAttribute("data-href");
if (url) { if (url) {
if (options.newTab) if (options.newTab) {
browser.tabs.create({url: url, openerTabId: tabId}); var params = { url: url } ;
if (!android) {
params.openerTabId = tabId ;
}
browser.tabs.create(params);
}
else else
browser.tabs.update({url: url}).then(onUpdated, onError); browser.tabs.update({url: url}).then(onUpdated, onError);
} }
if (android)
window.close();
}); });

View File

@ -169,3 +169,90 @@ img {
padding-left: 5px; padding-left: 5px;
padding-top: 3px; padding-top: 3px;
} }
/**
* browser style classes not present on android and might be deprecated at some point
* (here as reference for now)
*/
/*
.panel-section {
display: flex;
flex-direction: row;
}
.panel-section-separator {
background-color: rgba(0, 0, 0, 0.15);
min-height: 1px;
}
.panel-section-header {
border-bottom: 1px solid rgba(0, 0, 0, 0.15);
padding: 16px;
}
.panel-section-header > .icon-section-header {
background-position: center center;
background-repeat: no-repeat;
height: 32px;
margin-right: 16px;
position: relative;
width: 32px;
}
.panel-section-header > .text-section-header {
align-self: center;
font-size: 1.385em;
font-weight: lighter;
}
.panel-section-list {
flex-direction: column;
padding: 4px 0;
}
.panel-list-item {
align-items: center;
display: flex;
flex-direction: row;
height: 24px;
padding: 0 16px;
}
.panel-list-item:not(.disabled):hover {
background-color: rgba(0, 0, 0, 0.06);
border-block: 1px solid rgba(0, 0, 0, 0.1);
}
.panel-list-item:not(.disabled):hover:active {
background-color: rgba(0, 0, 0, 0.1);
}
.panel-list-item.disabled {
color: #999;
}
.panel-list-item > .icon {
flex-grow: 0;
flex-shrink: 0;
}
.panel-list-item > .text {
flex-grow: 10;
}
.panel-list-item > .text-shortcut {
color: #808080;
font-family: "Lucida Grande", caption;
font-size: .847em;
justify-content: flex-end;
}
.panel-section-list .panel-section-separator {
margin: 4px 0;
} */

View File

@ -1,4 +1,10 @@
var android = false;
browser.runtime.getPlatformInfo().then((info) => {
android = info.os == "android"
});
function saveOptions(e) { function saveOptions(e) {
e.preventDefault(); e.preventDefault();
@ -25,6 +31,10 @@ function saveOptions(e) {
function restoreOptions() { function restoreOptions() {
browser.runtime.getPlatformInfo().then((info) => {
android = info.os == "android"
function onResult(result) { function onResult(result) {
document.querySelector("#doThumb").checked = result.doThumb; document.querySelector("#doThumb").checked = result.doThumb;
document.querySelector("#doMaxWidth").checked = result.doMaxWidth; document.querySelector("#doMaxWidth").checked = result.doMaxWidth;
@ -54,14 +64,16 @@ function restoreOptions() {
preventPreview: false, preventPreview: false,
fullPreview: false, fullPreview: false,
doAuthor: false, doAuthor: false,
orangeIcon: false, orangeIcon: android,
enableCss: false, enableCss: false,
bypassCSP: false, bypassCSP: false,
customCss: null, customCss: null,
newTab: true newTab: !android
}); });
getting.then(onResult, onError); getting.then(onResult, onError);
});
} }