|
@@ -221,9 +221,9 @@ function updateEntriesStatus(entryIDs, status, callback) {
|
|
|
request.withBody({entry_ids: entryIDs, status: status});
|
|
request.withBody({entry_ids: entryIDs, status: status});
|
|
|
request.withCallback((resp) => {
|
|
request.withCallback((resp) => {
|
|
|
resp.json().then(count => {
|
|
resp.json().then(count => {
|
|
|
- if (callback) {
|
|
|
|
|
- callback(resp);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (callback) {
|
|
|
|
|
+ callback(resp);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if (status === "read") {
|
|
if (status === "read") {
|
|
|
decrementUnreadCounter(count);
|
|
decrementUnreadCounter(count);
|
|
@@ -336,7 +336,7 @@ function handleFetchOriginalContent() {
|
|
|
response.json().then((data) => {
|
|
response.json().then((data) => {
|
|
|
if (data.hasOwnProperty("content") && data.hasOwnProperty("reading_time")) {
|
|
if (data.hasOwnProperty("content") && data.hasOwnProperty("reading_time")) {
|
|
|
document.querySelector(".entry-content").innerHTML = data.content;
|
|
document.querySelector(".entry-content").innerHTML = data.content;
|
|
|
- document.querySelector(".entry-reading-time").innerHTML = data.reading_time;
|
|
|
|
|
|
|
+ document.querySelector(".entry-reading-time").innerHTML = data.reading_time;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -557,7 +557,7 @@ function handleConfirmationMessage(linkElement, callback) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
linkElement.style.display = "none";
|
|
linkElement.style.display = "none";
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
let containerElement = linkElement.parentNode;
|
|
let containerElement = linkElement.parentNode;
|
|
|
let questionElement = document.createElement("span");
|
|
let questionElement = document.createElement("span");
|
|
|
|
|
|
|
@@ -638,3 +638,43 @@ function handlePlayerProgressionSave(playerElement) {
|
|
|
request.execute();
|
|
request.execute();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * handle new share entires and already shared entries
|
|
|
|
|
+ */
|
|
|
|
|
+function handleShare() {
|
|
|
|
|
+ let link = document.querySelector('a[data-share-status]');
|
|
|
|
|
+ let title = document.querySelector("body > main > section > header > h1 > a");
|
|
|
|
|
+ if (link.dataset.shareStatus === "shared") {
|
|
|
|
|
+ checkShareAPI(title, link.href);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (link.dataset.shareStatus === "share") {
|
|
|
|
|
+ let request = new RequestBuilder(link.href);
|
|
|
|
|
+ request.withCallback((r) => {
|
|
|
|
|
+ checkShareAPI(title, r.url);
|
|
|
|
|
+ });
|
|
|
|
|
+ request.withHttpMethod("GET");
|
|
|
|
|
+ request.execute();
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+* wrapper for Web Share API
|
|
|
|
|
+*/
|
|
|
|
|
+function checkShareAPI(title, url) {
|
|
|
|
|
+ if (!navigator.canShare) {
|
|
|
|
|
+ console.error("Your browser doesn't support the Web Share API.");
|
|
|
|
|
+ window.location = url;
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ navigator.share({
|
|
|
|
|
+ title: title,
|
|
|
|
|
+ url: url
|
|
|
|
|
+ });
|
|
|
|
|
+ window.location.reload();
|
|
|
|
|
+ } catch (err) {
|
|
|
|
|
+ console.error(err);
|
|
|
|
|
+ window.location.reload();
|
|
|
|
|
+ }
|
|
|
|
|
+}
|