How can creare new button in topic button
-
Easiest is some js in the custom header. (Although, if you are making a lot of changes, you really should be using a custom theme.)
<script> $(window).on('action:ajaxify.contentLoaded', function(){ $('[component="thread/sort"]').after(' <button class="btn btn-default yourbutton" type="button">Do Something</button>'); $('.yourbutton').click(function(){ // Do whatever you want. }); }); </script>
(The leading space in the after() is intentional)
-
Althought i think it could be a cleaner approach, if you want the new button as part of plugin functionality you can take a look at nodebb-plugin-ignore-users there i put an icon instead of a button, inserted with client javascript, as @yariplus alreafy suggested, taking in consideration what page is rendered.
You can see if that approach fits for your purpose on the client.js file of the mentioned plugin. I'm sure there would be better examples on official plugins but can't remember one right now that you can take a look at.
Copyright © 2024 NodeBB | Contributors