Question about reworking the nodebb-plugin-charts plugin.
-
I'm trying to rework the nodebb-plugin-charts plugin.
The essence of the algorithm is that one string is replaced by another.
When replacing the original string with
<div><div id="' + idChart + '" style="height:300px; width:500px;"></div>
<script class="code" type="text/javascript">$(document).ready(function(){$.jqplot("' + idChart + '", '+datas+', '+untypedOptions+');});</script></div>'the <script></script> part is cut off
It seems that the plugin is very simple, but knowledge of nodebb is required
On the other hand, it would be very interesting to see how to add such a third-party library to the plugin
Can someone look at these errors?
https://github.com/svandecappelle/nodebb-plugin-charts -
@Kitten That plugin is 10 years old, and highly unlikely to work with the latest version of NodeBB. The last commit from svandecappelle was 10 years ago, and there's a high probability that specific plugin has been abandoned.
-
Yes. It is abandoned. The source code needs some tweaking. It would be interesting to know how to properly connect such a library to the plugin. The plugin itself looks simple. It won't be difficult for a specialist to fix it. You need to know the details.
-
You need to move the script tag to a separate js file, take a look at the quickstart plugin and how it includes client side js files. What you need to do is call $.jqplot in a client side js file instead of embedding it into each post.
-
@baris In the plugin.json file I added the following lines:
"scripts": [
"static/lib/main1.js"
],In the main1.js file I added the following functions:
- $(document).ready(function () {
- $(window).on('action:ajaxify.end', function(data) {
and they are not called.
What could be the problem?