Jump to content

Featured Replies

Posted

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?

You can find a possible solution here:

  • 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>

buttons.png

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.

  • 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 by Hatsu

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?",

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:

Screenshot1.png.d1169924c33ad591d2eac5d3

And also in mobile:

IMG_7100.jpeg

Both with confirmation box and ajaxed.

It’s a free app.

Edited by Adriano Faria

  • Author

Thank you for your advices. I now changed and put the JavaScript in the Theme itself. In ACP under Themes -> Theme Designer - CSS/JS

let 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. ☺️

Recently Browsing 0

  • No registered users viewing this page.