@baris It is good? https://github.com/NodeBB/NodeBB/issues/10096
Joi
Posts
-
Problem displaying new internal link content -
Problem displaying new internal link contentIn version NODEBB 18.6 (latest) a feature has been added that hovers over an internal link within the forum
A panel with the contents of the post is displayed
The problem is that if you put a link to another NODEBB site, it looks for the post number in the current forum, and displays incorrect content.
example (Hover over the link to see):
https://try.nodebb.org/topic/2/creating-tables-in-nodebb/1
Hovering over the link, he tries to display:
https://community.nodebb.org/topic/2/test
@baris -
Broken script starting from version 18.3I was told the problem is in:
topicElem.find
I do not understand this, I just want the code to work again ...
Thank you! -
Broken script starting from version 18.3I have a script for previewing topics from a recent or unread topic page.
As of version 1.18.3 of NodeBB, the script does not work.
Can you help?
This is the script:(function() { 'use strict'; function onhover() { /* globals require, $, socket, app */ var self = $(this); if (!self.data('preview-loaded')) { socket.emit('topics.loadMore', { tid: self.data('my-tid'), after: 0, count: 1, direction: 1 }, (e, d) => { self.data('preview-loaded', 1); require('translator').translate(e ? '<span style="color:red;">error: </span>' + e.message : d.mainPost.content, (d) => { if (app.user.uid === 0) { d = d.replace(/\|\|.*\|\|/g,'<a href="https://domain.com/login">You must be logged in to view this link.</a>'); } else { d = d.replace(/\|\|/g,''); } $('#preview-' + self.data('my-tid')).children().html(d.replace(/\|\|/g,'')); }); } ); } $('#preview-' + self.data('my-tid')).stop(true).delay(500).fadeIn(); } function onunhover() { $('#preview-' + $(this).data('my-tid')).stop(true).fadeOut(); } $(window).on('action:topics.loaded', (event, data) => { for (let topic of data.topics) { let topicElem = $('[data-tid="' + topic.tid + '"]'); createPreview(topicElem); } }); function addTopicTools() { let topicelems = $('[component="category/topic"]'); topicelems.each((i, elem) => { createPreview($(elem)); }); } function createPreview(topicElem) { let tid = parseInt(topicElem.attr('data-tid')); if (!$('#preview-' + tid).length) { topicElem.find('.content').append('<div class="post-preview" id="preview-' + tid + '"><div class="wrap-post-preview">טוען...</div></div>'); topicElem.find('.post-preview').hover(function(){$(this).stop(true).fadeIn();},function(){$(this).delay(600).fadeOut();}); topicElem.find('[itemprop="url"]').data('my-tid', tid).hover( onhover, onunhover ); } } $(window).on('action:ajaxify.end', addTopicTools); })();
(The script also exchanges for guests each link to a login page, to encourage registration)
@baris