From d30ac40772ec1b4706922afd8acab8448af39a9e Mon Sep 17 00:00:00 2001 From: Julien-Pierre Avérous Date: Thu, 13 Feb 2020 19:22:35 +0200 Subject: 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 Co-authored-by: Alexandre Alapetite Co-authored-by: Marien Fressinaud --- p/scripts/extra.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'p/scripts/extra.js') diff --git a/p/scripts/extra.js b/p/scripts/extra.js index 1fd8a19de..9ce0e74ce 100644 --- a/p/scripts/extra.js +++ b/p/scripts/extra.js @@ -1,8 +1,25 @@ // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0 "use strict"; -/* globals context, openNotification, xmlHttpRequestJson */ +/* globals context, openNotification, openPopupWithSource, xmlHttpRequestJson */ /* jshint esversion:6, strict:global */ +function fix_popup_preview_selector() { + const link = document.getElementById('popup-preview-selector'); + + if (!link) { + return; + } + + link.addEventListener('click', function (ev) { + const selector_entries = document.getElementById('path_entries').value; + const href = link.href.replace('selector-token', encodeURIComponent(selector_entries)); + + openPopupWithSource(href); + + ev.preventDefault(); + }); +} + // function poormanSalt() { //If crypto.getRandomValues is not available const base = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789/abcdefghijklmnopqrstuvwxyz'; @@ -176,6 +193,7 @@ function init_slider_observers() { slider.classList.add('active'); closer.classList.add('active'); context.ajax_loading = false; + fix_popup_preview_selector(); }; req.send(); return false; @@ -240,6 +258,7 @@ function init_extra() { init_select_observers(); init_slider_observers(); init_configuration_alert(); + fix_popup_preview_selector(); } if (document.readyState && document.readyState !== 'loading') { -- cgit v1.2.3