[nodebb-plugin-cards] Show cards when hovering over user links!
-
You are reading my mind bro :). I was thinking about this too.
-
Another one I noticed is you can open a tooltip and ajaxify to another page and the tooltip will stay on the screen, maybe createCard function can destroy the previous one before creating a new one which. And should destroy them on ajaxify.start probably.
-
@baris that seems like a good way. Doing that now
https://github.com/Schamper/nodebb-plugin-mentions-cards/commit/cd215d07167907bc0b847f2f3fbfef0b56dbf097
That should do it. -
@baris https://github.com/Schamper/nodebb-plugin-mentions-cards/commit/cae3f7be28be3d9436cef1f95de6228ca1a5ca00
@julian are you on about the followers link or because it hides under the header? -
Hmm, another thing that can happen is if you mouse over multiple users quickly it will send of multiple $.api() calls and you might end up with multiple tooltips. This might work better.
function createCard(target, url) { var api = '/api' + url; $.get(api, function(result) { .... if (target !== currentCard) { if (currentCard) { destroyCard(currentCard); } target.popover({ html: true, content: html, placement: 'top', trigger: 'manual', container: 'body' }).popover('show'); currentCard = target; } ... }); }
Totally not tested :), Idea is to not doing anything if the target already has a tooltip and to destroy the previous one if there is no current card or its a different one.
-
@tedr56 That should be fixed with https://github.com/Schamper/nodebb-plugin-mentions-cards/commit/cd215d07167907bc0b847f2f3fbfef0b56dbf097, but I'm holding off on publishing another update, incase more bugs are found If there won't be any other reports by tonight I'll publish that fix.
-
Gonna implement this nao! LOL
-
Okay so, I have it installed and it works but I hover over anyones name, avatar, etc. it doesn't remove the popover from the dom so its a bunch of cards everywhere.
Card city...
EDIT: I fixed it by changing;
$('.container').off(events, selector).on(events, selector, function(e){
to what I have it all wrapped in which is._ob
Actually I can just put
body
and it works just fine too. -
Noticed a bug when you hover over the card and leave it on hover and backspace it doesn't remove itself.