Manages Firefox reader mode

In Reader mode Firefox has a special syntax for the URL of the current page. The URL is encoded and begins with "about:reader?url=" which can't be added to scuttle of course.
This commit is contained in:
FrenchHope 2017-07-14 17:34:31 +02:00 committed by GitHub
parent c83ca5472d
commit b7969d172c

View File

@ -14,7 +14,15 @@ function shareURL(){
var tab = tabs[0];
var url = instance + "/bookmarks.php?action=add&address=" + encodeURIComponent(tab.url) + "&title=" + tabs[0].title;
// manages Mozilla Firefox reader mode
var rawUrl = tab.url;
var partToRemove = partToRemove = "about:reader?url=";
if(rawUrl.includes(partToRemove)) {
rawUrl = rawUrl.substring(partToRemove.length);
rawUrl = decodeURIComponent(rawUrl);
}
var url = instance + "/bookmarks.php?action=add&address=" + encodeURIComponent(rawUrl) + "&title=" + tabs[0].title;
widthInt = Number(windowWidth);
heightInt = Number(windowHeight);