aboutsummaryrefslogtreecommitdiff
path: root/p/scripts/main.js
diff options
context:
space:
mode:
authorGravatar Julien-Pierre Avérous <github@sourcemac.com> 2020-02-13 19:22:35 +0200
committerGravatar GitHub <noreply@github.com> 2020-02-13 18:22:35 +0100
commitd30ac40772ec1b4706922afd8acab8448af39a9e (patch)
tree6b7cec8455a542875959a09f7bdcc7a2af285fa1 /p/scripts/main.js
parent4ddd1821bb0fc1186937551d59100294b8833727 (diff)
Enhance content path feature (#2778)
- Add a maintenance section to be able to clear cache and force reload a feed. - Add an icon next to path field to show a pop-up with the result of the content path. Co-authored-by: Frans de Jonge <fransdejonge@gmail.com> Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr> Co-authored-by: Marien Fressinaud <dev@marienfressinaud.fr>
Diffstat (limited to 'p/scripts/main.js')
-rw-r--r--p/scripts/main.js67
1 files changed, 67 insertions, 0 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js
index 9ebc4c247..6b4b0a6b2 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -1215,6 +1215,72 @@ function init_notifications() {
}
// </notification>
+// <popup>
+let popup = null,
+ popup_iframe_container = null,
+ popup_iframe = null,
+ popup_txt = null,
+ popup_working = false;
+
+function openPopupWithMessage(msg) {
+ if (popup_working === true) {
+ return false;
+ }
+
+ popup_working = true;
+
+ popup_txt.innerHTML = msg;
+
+ popup_txt.style.display = 'table-row';
+ popup.style.display = 'block';
+}
+
+function openPopupWithSource(source) {
+ if (popup_working === true) {
+ return false;
+ }
+
+ popup_working = true;
+
+ popup_iframe.src = source;
+
+ popup_iframe_container.style.display = 'table-row';
+ popup.style.display = 'block';
+}
+
+function closePopup() {
+ popup.style.display = 'none';
+ popup_iframe_container.style.display = 'none';
+ popup_txt.style.display = 'none';
+
+ popup_iframe.src = 'about:blank';
+
+ popup_working = false;
+}
+
+function init_popup() {
+ //Fetch elements.
+ popup = document.getElementById('popup');
+
+ popup_iframe_container = document.getElementById('popup-iframe-container');
+ popup_iframe = document.getElementById('popup-iframe');
+
+ popup_txt = document.getElementById('popup-txt');
+
+ //Configure close button.
+ document.getElementById('popup-close').addEventListener('click', function (ev) {
+ closePopup();
+ });
+
+ //Configure close-on-click.
+ window.addEventListener('click', function (ev) {
+ if (ev.target == popup) {
+ closePopup();
+ }
+ });
+}
+// </popup>
+
// <notifs html5>
var notifs_html5_permission = 'denied';
@@ -1483,6 +1549,7 @@ function init_beforeDOM() {
function init_afterDOM() {
init_notifications();
+ init_popup();
init_confirm_action();
const stream = document.getElementById('stream');
if (stream) {