diff --git a/public/src/client/topic/threadTools.js b/public/src/client/topic/threadTools.js index 3325b76ac0..ca85564873 100644 --- a/public/src/client/topic/threadTools.js +++ b/public/src/client/topic/threadTools.js @@ -10,7 +10,8 @@ define('forum/topic/threadTools', [ 'hooks', 'bootbox', 'alerts', -], function (components, translator, handleBack, posts, api, hooks, bootbox, alerts) { + 'bootstrap', +], function (components, translator, handleBack, posts, api, hooks, bootbox, alerts, bootstrap) { const ThreadTools = {}; ThreadTools.init = function (tid, topicContainer) { @@ -365,11 +366,12 @@ define('forum/topic/threadTools', [ unfollow: '[[topic:not-watching]]', ignore: '[[topic:ignoring]]', }; - // TODO: doesnt work on bs5 + translator.translate(titles[state], function (translatedTitle) { - $('[component="topic/watch"]') - .attr('title', translatedTitle) - .tooltip(); + const tooltip = bootstrap.Tooltip.getInstance('[component="topic/watch"]'); + if (tooltip) { + tooltip.setContent({ '.tooltip-inner': translatedTitle }); + } }); let menu = components.get('topic/following/menu'); diff --git a/public/src/client/topic/votes.js b/public/src/client/topic/votes.js index dcc225bd89..8109d18a0e 100644 --- a/public/src/client/topic/votes.js +++ b/public/src/client/topic/votes.js @@ -2,8 +2,8 @@ define('forum/topic/votes', [ - 'components', 'translator', 'api', 'hooks', 'bootbox', 'alerts', -], function (components, translator, api, hooks, bootbox, alerts) { + 'components', 'translator', 'api', 'hooks', 'bootbox', 'alerts', 'bootstrap', +], function (components, translator, api, hooks, bootbox, alerts, bootstrap) { const Votes = {}; Votes.addVoteHandler = function () { @@ -32,7 +32,13 @@ define('forum/topic/votes', [ function createTooltip(el, data) { function doCreateTooltip(title) { - el.attr('title', title).tooltip('fixTitle').tooltip('show'); + const tooltip = bootstrap.Tooltip.getInstance(el); + if (tooltip) { + tooltip.setContent({ '.tooltip-inner': title }); + } else { + el.attr('title', title); + (new bootstrap.Tooltip(el)).show(); + } el.parent().find('.tooltip').css('display', ''); } let usernames = data.usernames