diff --git a/background.js b/background.js index 753fa2d..08d6d5a 100644 --- a/background.js +++ b/background.js @@ -69,7 +69,11 @@ browser.webRequest.onHeadersReceived.addListener( 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')); 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 }); }); + }); } browser.runtime.onMessage.addListener(handleMessage); diff --git a/manifest.json b/manifest.json index db7fbbb..8332797 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "RSSPreview", - "version": "3.21", + "version": "3.30", "author": "Aurelien David", "homepage_url": "https://github.com/aureliendavid/rsspreview", @@ -48,6 +48,9 @@ "browser_specific_settings": { "gecko": { "id": "{7799824a-30fe-4c67-8b3e-7094ea203c94}" + }, + "gecko_android": { + "strict_min_version": "113.0" } }, diff --git a/popup/popup.html b/popup/popup.html index 2a18da7..758b358 100644 --- a/popup/popup.html +++ b/popup/popup.html @@ -4,7 +4,20 @@ + diff --git a/popup/popup.js b/popup/popup.js index 4207a08..09c6b2b 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -3,6 +3,13 @@ var options = { newTab: true, }; +var android = false; + +browser.runtime.getPlatformInfo().then((info) => { + android = info.os == "android" +}); + + function onOptions(opts) { options = opts; } @@ -35,6 +42,15 @@ document.addEventListener("DOMContentLoaded", function(event) { a.innerText = feeds[feed_url]; li.appendChild(a); + + browser.runtime.getPlatformInfo().then((info) => { + android = info.os == "android" + + if (android) + li.classList.add("android-feed-btn"); + }); + + feedList.appendChild(li); } } @@ -51,11 +67,18 @@ document.addEventListener("DOMContentLoaded", function(event) { let url = elem.getAttribute("data-href"); if (url) { - if (options.newTab) - browser.tabs.create({url: url, openerTabId: tabId}); + if (options.newTab) { + var params = { url: url } ; + if (!android) { + params.openerTabId = tabId ; + } + browser.tabs.create(params); + } else browser.tabs.update({url: url}).then(onUpdated, onError); } + if (android) + window.close(); }); diff --git a/preview.css b/preview.css index 06453e5..5baad65 100644 --- a/preview.css +++ b/preview.css @@ -169,3 +169,90 @@ img { padding-left: 5px; 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; +} */ diff --git a/settings/options.js b/settings/options.js index 3b8cb88..3b99414 100644 --- a/settings/options.js +++ b/settings/options.js @@ -1,4 +1,10 @@ +var android = false; + +browser.runtime.getPlatformInfo().then((info) => { + android = info.os == "android" +}); + function saveOptions(e) { e.preventDefault(); @@ -25,6 +31,10 @@ function saveOptions(e) { function restoreOptions() { + browser.runtime.getPlatformInfo().then((info) => { + android = info.os == "android" + + function onResult(result) { document.querySelector("#doThumb").checked = result.doThumb; document.querySelector("#doMaxWidth").checked = result.doMaxWidth; @@ -54,14 +64,16 @@ function restoreOptions() { preventPreview: false, fullPreview: false, doAuthor: false, - orangeIcon: false, + orangeIcon: android, enableCss: false, bypassCSP: false, customCss: null, - newTab: true + newTab: !android }); getting.then(onResult, onError); + }); + }