inherit
249680
0
Jul 13, 2023 9:40:46 GMT -8
nicklarry
3
October 2017
nicklarry
|
Post by nicklarry on Jul 12, 2023 9:41:28 GMT -8
Hey guys!
Would it be possible to have a plugin to enable the like system per thread instead of a global option? For example, a thread for posting video clips makes sense to have a like system whereas in other threads a like system may hinder the dialogue as many users will opt for a simple like instead of a proper reply. No to mention some users may feel ratioed if during an argument they have few likes compared to the ones they may argue with and that would also be something that may hinder further dialogue not to mention the ratioed users would probably feel bad and we don't want that.
Dunno if this request is feasible, just something to consider if anybody's willing to give it a try.
Cheers!
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,017
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Jul 12, 2023 15:22:29 GMT -8
A bulletproof solution would require Proboards to add the feature from the backend themself. A JavaScript or CSS code installed on the forum operates only within the user's browser, so it can be manipulated or overridden by anyone who is using the browser at that time if they have the proper knowledge. A plugin is simply an additional layer around a JavaScript, HTML, and/or CSS code that makes it easier to configure and use the code but is still just a code at heart. It is also important to point out that no codes will affect mobile users since they are served their own smaller footprint pages that leave out many things, such as codes. A code to target specific threads would need to store data in order to remember (e.g., plugin keys, local storage), and those would become susceptible to attacks in addition to the otherwise well-known attack vectors. With that caveat out of the way, it sounds like you could employ a drop-in javascript code that would disable the like system in any board header/footer to which you add it. Such a code would be easier and less prone to being circumvented since it would not have that many moving parts. Give the following code a test install in a board header/footer where you do not want likes See below for an updated plugin version that addresses search results pages not handled by the drop-in script<script>/* Disable likes (Install in board or category header)*/ pb.data('proboards.post') && $( ()=>{ const no_likes_msg = "Likes have been disabled in this area. Please consider creating a reply to let your thoughts be heard"; function nolikes(){ //Kill UI $('.item.post[id^="post-"]').each((i,e)=>{ $('.likes,.likes-button',e).hide() .off('click'). on('click', v=>{ v.preventDefault();v.stopImmediatePropagation(); pb.window.alert(no_likes_msg) }).remove() }); } //Kill AJAX $(document).on('ajaxSend', ( event, request, settings )=>{ if(proboards.route("post_like") == settings.url || proboards.route('likes_of_post') === settings.url){ pb.window.alert(no_likes_msg); request.abort(); } }) nolikes(); pb.events.on('afterSearch', nolikes); });
</script>Edit:
Plugin:(help guide:Downloading and Importing Plugins )
Updates:- v0.0.2 (7/13/2023, 9:49 PM) - Added a global component to the plugin to disable likes on posts that are not displayed in a board such as in a search result page. This closes a loophole and makes the plugin more functional than the script posted above.
- v0.0.1 (7/12/2023, 7:37 PM) - Original Release
|
|
inherit
249680
0
Jul 13, 2023 9:40:46 GMT -8
nicklarry
3
October 2017
nicklarry
|
Post by nicklarry on Jul 13, 2023 9:40:46 GMT -8
Many thx, I will try it and report back
|
|