Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted March 9Mar 9 I would like to suggest to have the "Mark all content as read"-Button back in the unread content activity stream. From a context point of view I would think this would be a good place as well.I haven't found a template hook where I could add it myself. Is there any?
March 9Mar 9 Author Thank you. Did the trick. Is it possible to use language strings in this JavaScript?<script type="text/javascript"> document.addEventListener("DOMContentLoaded", function () { let newLink = document.createElement("a"); newLink.href = ipsSettings.baseURL + 'markallread/?csrfKey=' + ipsSettings.csrfKey; newLink.innerText = "Mark Site Read"; newLink.setAttribute( 'class', 'ipsButton ipsButton--inherit'); let newIcon = document.createElement("i"); newIcon.classList.add("fa", "fa-solid", "fa-eye"); newLink.prepend(newIcon); let optionsButton = document.querySelector('#elStreamOptions'); let parentDiv = optionsButton.parentNode; parentDiv.insertBefore(newLink, optionsButton); }); </script>
March 9Mar 9 There are some language strings available in JS loaded directly from the language pack, it depends on what you need exactly.If the string is not there you won't be able to add it because I believe the language strings you can add in ACP will only work as "normal" strings and not for JS.
March 9Mar 9 Author Well, I would need the "Mark all content as read". 😄Sorry, I'm very new to IPS modding. I think v5 is much more approachable as v4 was. But I still don't have an idea where to look for the specific things. Edited March 9Mar 9 by Hatsu
March 9Mar 9 There's no JS lang for "Mark all content as read". There is one to confirm if the user wants to mark as read, but that's not what you want:'markAsReadConfirm' => "Are you sure you want to mark all content in the community as read?",
March 9Mar 9 There isn’t a hook point at the bottom so the only option is to use that workaround provided by Matt, but there’s no language bit or confirmation box.I use it at the top:And also in mobile:Both with confirmation box and ajaxed.It’s a free app. Edited March 9Mar 9 by Adriano Faria
March 9Mar 9 Author Thank you for your advices. I now changed and put the JavaScript in the Theme itself. In ACP under Themes -> Theme Designer - CSS/JSlet optionsButton = document.querySelector('#elStreamOptions'); if (optionsButton) { document.addEventListener("DOMContentLoaded", function () { let newLink = document.createElement("a"); newLink.href = ipsSettings.baseURL + 'markallread/?csrfKey=' + ipsSettings.csrfKey; newLink.innerText = "Mark Site Read"; newLink.setAttribute( 'class', 'ipsButton ipsButton--inherit'); newLink.setAttribute( 'data-action', 'markSiteRead'); newLink.setAttribute( 'data-controller', 'core.front.core.markRead'); newLink.setAttribute( 'data-menuitem', 'mark_site_read'); let newIcon = document.createElement("i"); newIcon.classList.add("fa", "fa-solid", "fa-eye"); newLink.prepend(newIcon); let parentDiv = optionsButton.parentNode; parentDiv.insertBefore(newLink, optionsButton); }); }I will try your app tomorrow. It's kinda late here today. ☺️