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

@ -13,8 +13,16 @@ function shareURL(){
gettingHeight.then(onGotHeight, onError); gettingHeight.then(onGotHeight, onError);
var tab = tabs[0]; 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); widthInt = Number(windowWidth);
heightInt = Number(windowHeight); heightInt = Number(windowHeight);