[nodebb-plugin-ns-spoiler] NS Spoiler
-
A new version of the package nodebb-plugin-ns-spoiler (5.0.1) is available.
Plugin updated to work with the latest changes (
NodeBB 1.8.x
). Also, the plugin should work better with a more complex post structure (multi-list, etc.)@Sam-Nguyen images should work well in v5.
-
@nicolas said in [nodebb-plugin-ns-spoiler] NS Spoiler:
A new version of the package nodebb-plugin-ns-spoiler (5.0.1) is available.
Plugin updated to work with the latest changes (
NodeBB 1.8.x
). Also, the plugin should work better with a more complex post structure (multi-list, etc.)@Sam-Nguyen images should work well in v5.
Thank you for this update, everything works fine at 1.9.0
-
@nicolas said in [nodebb-plugin-ns-spoiler] NS Spoiler:
A new version of the package nodebb-plugin-ns-spoiler (5.0.1) is available.
@Sam-Nguyen images should work well in v5.Hi @nicolas There is still 4.1.0 in my ACP. I installed NodeBB v1.9.3 a week ago.
-
Version 6.0.0
Summary: no new features, compatibility update only.
- Changed compatibility to work with NodeBB 1.11.x
-
Version 7.0.0
Summary: no new features, compatibility update only.
- Changed compatibility to work with NodeBB 1.12.x
-
This plugin isn't working anymore on my forum since a couple of months.
I'm on version 8.0.0 of the plugin, Nodebb version 1.19.1
The problem is that the spoilered text isn't loading when pressing on the spoiler header.
When turning on the JavaScript debugger, I get an
Error has occurred, error: [[error:no-privileges]]
in
spoiler.js:50
.The relevant JavaScript function that triggers the error is this one:
function toggle($button) { var $spoiler = $button.parents(elements.MAIN), $content = $spoiler.find(elements.CONTENT), open = $spoiler.attr('data-open') === 'true', postId = parseInt($spoiler.attr('data-pid')), index = parseInt($spoiler.attr('data-index')), icon = $button.find('i'); $spoiler.attr('data-open', !open); if (!open) { icon.removeClass(classes.OPEN_EYE).addClass(classes.CLOSE_EYE); } else { icon.removeClass(classes.CLOSE_EYE).addClass(classes.OPEN_EYE); } // Check if content is empty if ($content.html().length === 0) { socket.emit( 'plugins.ns-spoiler.getSpoilerContent', {index: index, postId: postId}, function (error, content) { if (error) { return console.error('Error has occurred, error: %s', error.message); } $content.html(content); } ); } }
The
socket.emit
call always yields the "no privilege" error.Any ideas?
-
@Klaus6 said in [nodebb-plugin-ns-spoiler] NS Spoiler:
Is there really no way to get a working spoiler plugin for the current version of NodeBB? All alternatives seem to be even more outdated than this one.
Do you think you can switch to this one?
https://github.com/prosas82/nodebb-plugin-btn-spoilers#readme
this one works with 1.19.1 , I can confirm.
-
Thanks for the suggestion @crazycells ! That plugin works indeed (I used this version which seems to be more up to date). The only problem my users have with that plugin is that the spoiler content is displayed in the post preview. Any suggestions on how to block spoiler content in post previews?
-
@crazycells On the main page with the listing of the posts, there is a preview that reveals the spoiler content.
For instance, I put a spoiler with the text "Spoiler content" into a post, and on the post listing page the text is revealed.
-
@Klaus6 said in [nodebb-plugin-ns-spoiler] NS Spoiler:
@crazycells On the main page with the listing of the posts, there is a preview that reveals the spoiler content.
For instance, I put a spoiler with the text "Spoiler content" into a post, and on the post listing page the text is revealed.
Yes, you are right. I do not know the exact reason, but probably it is plugin related. I believe markdown is working on the last post previews because some of the other text functions work; so I assume the plugin is not made to apply there...
This is not a direct solution, but in our case, this shows differently because we customized our last posts to show the title first... It makes more sense from our perspective that the title is shown in the last post. Therefore "spoiler" does not have enough lines to reveal the content. In case you think you can use this, here is how to achieve this:
To change the last post previews in categories page, use customize plugin to edit this file:
partials/categories/lastpost.tpl
change line 12-14
from:<div class="post-content"> {../content} </div>
to:
<div class="post-content"> <div class="title"> <a href="{config.relative_path}/topic/{../topic.slug}<!-- IF ../index -->/{../index}<!-- ENDIF ../index -->">{../topic.title}</a> </div> {../content} </div>
-
Thanks a ton, that looks interesting.
I wonder, though: Shouldn't it be possible to just strip the spoiler content in the preview? That is, filter the content and remove the spoiler content for the preview? I don't know how NodeBB is programmed - maybe the template language supports some kind of transformation/filtering?