aboutsummaryrefslogtreecommitdiff
path: root/p/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'p/scripts')
-rw-r--r--p/scripts/api.js62
-rw-r--r--p/scripts/main.js12
2 files changed, 71 insertions, 3 deletions
diff --git a/p/scripts/api.js b/p/scripts/api.js
new file mode 100644
index 000000000..841b16a6a
--- /dev/null
+++ b/p/scripts/api.js
@@ -0,0 +1,62 @@
+"use strict";
+/* jshint esversion:6, strict:global */
+
+function check(url, next) {
+ if (!url || !next) {
+ return;
+ }
+ const req = new XMLHttpRequest();
+ req.open('GET', url, true);
+ req.setRequestHeader('Authorization', 'GoogleLogin auth=test/1');
+ req.onerror = function (e) {
+ next('FAIL: HTTP ' + e);
+ };
+ req.onload = function () {
+ if (this.status == 200) {
+ next(this.response);
+ } else {
+ next('FAIL: HTTP error ' + this.status + ' ' + this.statusText);
+ }
+ };
+ req.send();
+}
+
+const jsonVars = JSON.parse(document.getElementById('jsonVars').innerHTML);
+
+check(jsonVars.greader + '/check/compatibility', function next(result1) {
+ const greaderOutput = document.getElementById('greaderOutput');
+ if (result1 === 'PASS') {
+ greaderOutput.innerHTML = '✔️ ' + result1;
+ } else {
+ check(jsonVars.greader + '/check%2Fcompatibility', function next(result2) {
+ if (result2 === 'PASS') {
+ greaderOutput.innerHTML = '⚠️ WARN: no <code>%2F</code> support, so some clients will not work!';
+ } else {
+ check('./greader.php/check/compatibility', function next(result3) {
+ if (result3 === 'PASS') {
+ greaderOutput.innerHTML = '⚠️ WARN: Probable invalid base URL in ./data/config.php';
+ } else {
+ greaderOutput.innerHTML = '❌ ' + result1;
+ }
+ });
+ }
+ });
+ }
+ });
+
+check(jsonVars.fever + '?api', function next(result1) {
+ const feverOutput = document.getElementById('feverOutput');
+ try {
+ JSON.parse(result1);
+ feverOutput.innerHTML = '✔️ PASS';
+ } catch (ex) {
+ check('./fever.php?api', function next(result2) {
+ try {
+ JSON.parse(result2);
+ feverOutput.innerHTML = '⚠️ WARN: Probable invalid base URL in ./data/config.php';
+ } catch (ex) {
+ feverOutput.innerHTML = '❌ ' + result1;
+ }
+ });
+ }
+ });
diff --git a/p/scripts/main.js b/p/scripts/main.js
index 4ba329dc1..6cab2e55a 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -237,6 +237,9 @@ function mark_favorite(active) {
});
}
+var freshrssOpenArticleEvent = document.createEvent('Event');
+freshrssOpenArticleEvent.initEvent('freshrss:openArticle', true, true);
+
function toggleContent(new_active, old_active, skipping) {
// If skipping, move current without activating or marking as read
if (new_active.length === 0) {
@@ -299,8 +302,11 @@ function toggleContent(new_active, old_active, skipping) {
}
}
- if (context.auto_mark_article && new_active.hasClass('active') && !skipping) {
- mark_read(new_active, true);
+ if (new_active.hasClass('active') && !skipping) {
+ if (context.auto_mark_article) {
+ mark_read(new_active, true);
+ }
+ new_active[0].dispatchEvent(freshrssOpenArticleEvent);
}
}
@@ -543,7 +549,7 @@ function init_column_categories() {
}
});
$(this).parent().next(".tree-folder-items").slideToggle(300, function () {
- //Workaround for Gecko bug in Firefox 64-65(+?):
+ //Workaround for Gecko bug 1514498 in Firefox 64
var sidebar = document.getElementById('sidebar');
if (sidebar && sidebar.scrollHeight > sidebar.clientHeight && //if needs scrollbar
sidebar.scrollWidth >= sidebar.offsetWidth) { //but no scrollbar