diff options
| author | 2022-04-19 23:33:27 +0200 | |
|---|---|---|
| committer | 2022-04-19 23:33:27 +0200 | |
| commit | 20e0b848b177e7cfd6554eb831489a51dd03964a (patch) | |
| tree | c2ec494f1bfc41c68cb06ed1be5ae5add016b605 /p/scripts | |
| parent | d350a545139699f77fa844446dbf1371b3acb9c4 (diff) | |
Fix navigator.share insertRule (#4321)
#fix https://github.com/FreshRSS/FreshRSS/pull/4271#discussion_r834288556
Moved to after `DOMContentLoaded`
Diffstat (limited to 'p/scripts')
| -rw-r--r-- | p/scripts/main.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js index 65a0afdbb..67c41f07a 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -736,6 +736,15 @@ function init_posts() { }; onScroll(); } + + if (!navigator.share && document.styleSheets.length > 0) { + // https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share + // do not show the menu entry if browser does not support navigator.share + document.styleSheets[0].insertRule( + 'button.as-link[data-type="web-sharing-api"] {display: none !important;}', + document.styleSheets[0].cssRules.length + ); + } } function rememberOpenCategory(category_id, isOpen) { @@ -1078,15 +1087,6 @@ function init_stream(stream) { } }; - if (!navigator.share) { - // https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share - // do not show the menu entry if browser does not support navigator.share - document.styleSheets[0].insertRule( - 'button.as-link[data-type="web-sharing-api"] {display: none !important;}', - document.styleSheets[0].cssRules.length - ); - } - stream.onmouseup = function (ev) { // Mouseup enables us to catch middle click, and control+click in IE/Edge if (ev.altKey || ev.metaKey || ev.shiftKey) { return; |
