diff options
| author | 2020-02-13 19:22:35 +0200 | |
|---|---|---|
| committer | 2020-02-13 18:22:35 +0100 | |
| commit | d30ac40772ec1b4706922afd8acab8448af39a9e (patch) | |
| tree | 6b7cec8455a542875959a09f7bdcc7a2af285fa1 /p/scripts/extra.js | |
| parent | 4ddd1821bb0fc1186937551d59100294b8833727 (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/extra.js')
| -rw-r--r-- | p/scripts/extra.js | 21 |
1 files changed, 20 insertions, 1 deletions
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(); + }); +} + //<crypto form (Web login)> 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') { |
