diff options
| author | 2024-07-01 01:13:54 +0200 | |
|---|---|---|
| committer | 2024-07-01 01:13:54 +0200 | |
| commit | 7aa3d9f87309620b54dc9ff5f726dc22d1e6ea0c (patch) | |
| tree | 86f019bd5faa286feda5e3825610108cba62a479 /p/scripts | |
| parent | de477e15eca72d9e4d9dd99c0c694dc52500d4d5 (diff) | |
New: Sharing articles from the article title line (#6395)
* enable option
* Update entry_header.phtml
* frss.css
* fix print sharing
* Light refactoring
* fix
---------
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'p/scripts')
| -rw-r--r-- | p/scripts/main.js | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js index 2bc0f5337..5690eb532 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -402,6 +402,13 @@ function mark_favorite(div) { const freshrssOpenArticleEvent = document.createEvent('Event'); freshrssOpenArticleEvent.initEvent('freshrss:openArticle', true, true); +function loadLazyImages(rootElement) { + rootElement.querySelectorAll('img[data-original], iframe[data-original]').forEach(function (el) { + el.src = el.getAttribute('data-original'); + el.removeAttribute('data-original'); + }); +} + function toggleContent(new_active, old_active, skipping) { // If skipping, move current without activating or marking as read if (!new_active) { @@ -409,10 +416,7 @@ function toggleContent(new_active, old_active, skipping) { } if (context.does_lazyload && !skipping) { - new_active.querySelectorAll('img[data-original], iframe[data-original]').forEach(function (el) { - el.src = el.getAttribute('data-original'); - el.removeAttribute('data-original'); - }); + loadLazyImages(new_active); } if (old_active !== new_active) { @@ -1101,7 +1105,16 @@ function init_stream(stream) { for (let i = 0; i < document.styleSheets.length; i++) { tmp_window.document.writeln('<link href="' + document.styleSheets[i].href + '" rel="stylesheet" type="text/css" />'); } - tmp_window.document.writeln(el.closest('.flux_content').querySelector('.content').innerHTML); + const flux_content = el.closest('.flux_content'); + let content_el = null; + if (flux_content) { + content_el = el.closest('.flux_content').querySelector('.content'); + } + if (content_el === null) { + content_el = el.closest('.flux').querySelector('.flux_content .content'); + } + loadLazyImages(content_el); + tmp_window.document.writeln(content_el.innerHTML); tmp_window.document.close(); tmp_window.focus(); tmp_window.print(); |
