This is exactly what I was looking for, thank you so much Lin!

On Tuesday, August 11, 2020 at 11:38:39 PM UTC+9 Lin Onetwo wrote:

> Hi
>
> This is a known error mentioned in the issue 
> https://github.com/tobibeer/tw5-preview/issues/1
>
> We proposed a fix in the issue and there is a PR for it 
> https://github.com/tobibeer/tw5-preview/pull/3
>
> Lin Onetwo
>
> kebi <[email protected]> 于2020年8月11日周二 下午9:36写道:
>
>> Hello guys, today I installed the following plugin to my tiddlywiki file:
>> - http://tobibeer.github.io/tw5-plugins/#preview
>>
>> Whenever I hover a link it shows me a popun with the preview of the 
>> tiddler and works as expected.
>>
> The problem is that when I stop hovering a link it continues to show me 
>> the popup until I left-click.
>>
>> Does anybody know what lines to add/change in order to hide the popup 
>> once the hovering is over?
>>
>> Here's the current javascript code:
>>
>> /*\
>>> title: $:/plugins/tobibeer/preview/link.js
>>> type: application/javascript
>>> module-type: startup
>>>
>>> Enhances the link widget for on-hover previews
>>>
>>> @preserve
>>> \*/
>>> (function() {
>>>     var e, t = require("$:/core/modules/widgets/link.js").link,
>>>         i = t.prototype.render,
>>>         o = t.prototype.handleClickEvent;
>>>     t.prototype.render = function() {
>>>         i.apply(this, arguments);
>>>         var t = this,
>>>             o = this.wiki,
>>>             p = this.domNodes[0],
>>>             r = o.getTiddler(t.to),
>>>             n = "$:/plugins/tobibeer/preview/defaults/",
>>>             u = "$:/temp/tobibeer/preview-",
>>>             l = $tw.utils.parseKeyDescriptorTB(o.getTextReference(n + 
>>> "keys", "").toUpperCase()),
>>>             s = o.getTextReference(n + "delay").toUpperCase(),
>>>             a = function(e) {
>>>                 var i = $tw.popup.popupInfo(e),
>>>                     p = i.popupLevel;
>>>                 return o.getTextReference(u + p) && o.getTextReference(u 
>>> + p + "-tiddler") === t.to ? null : i
>>>             },
>>>             f = function() {
>>>                 var i, r = a(p);
>>>                 if (r) {
>>>                     i = r.popupLevel;
>>>                     clearTimeout(t.previewTimeout);
>>>                     $tw.popup.cancel(i);
>>>                     i++;
>>>                     o.setText(u + i + "-tiddler", "text", null, t.to);
>>>                     if ($tw.popup.findPopup(u + i) === -1) {
>>>                         setTimeout(function() {
>>>                             $tw.popup.triggerPopup({
>>>                                 domNode: p,
>>>                                 title: u + i,
>>>                                 wiki: o
>>>                             });
>>>                             e = 0
>>>                         }, 50)
>>>                     }
>>>                 }
>>>             },
>>>             d = function() {
>>>                 var e, i, r = 1,
>>>                     u = o.getTextReference(n + "not", "");
>>>                 if (u) {
>>>                     $tw.utils.each(u.split(" "), function(e) {
>>>                         var t = p;
>>>                         while (t && r) {
>>>                             if ($tw.utils.hasClass(t, e)) {
>>>                                 r = 0;
>>>                                 return false
>>>                             }
>>>                             t = t.parentNode
>>>                         }
>>>                     })
>>>                 }
>>>                 if (r) {
>>>                     i = o.getTextReference(n + "exclude", "");
>>>                     e = i ? o.filterTiddlers(i) : [];
>>>                     if (e.indexOf(t.to) >= 0) {
>>>                         r = 0
>>>                     }
>>>                 }
>>>                 return r
>>>             };
>>>         s = s !== undefined ? parseInt(s) : null;
>>>         if (s !== null && isNaN(s)) {
>>>             s = 0
>>>         }
>>>         if (r) {
>>>             $tw.utils.addClass(p, "tc-popup-handle");
>>>             $tw.utils.addClass(p, "tc-popup-absolute");
>>>             ["mouseover", "mouseout"].forEach(function(i) {
>>>                 p.addEventListener(i, function(o) {
>>>                     var p = o || window.event;
>>>                     if (i === "mouseover") {
>>>                         if (d()) {
>>>                             if (!p.keyCode) {
>>>                                 p.keyCode = 0
>>>                             }
>>>                             if ($tw.utils.checkKeyDescriptorTB(p, l)) {
>>>                                 if (!e) {
>>>                                     e = 1;
>>>                                     f()
>>>                                 }
>>>                             } else if (s !== null) {
>>>                                 e = 0;
>>>                                 t.previewTimeout = setTimeout(f, s)
>>>                             }
>>>                         }
>>>                     } else {
>>>                         e = 0;
>>>                         clearTimeout(t.previewTimeout)
>>>                     }
>>>                 })
>>>             })
>>>         }
>>>     };
>>>     t.prototype.handleClickEvent = function() {
>>>         o.apply(this, arguments);
>>>         clearTimeout(this.previewTimeout);
>>>         $tw.popup.cancel(Math.max(0, 
>>> $tw.popup.popupInfo(this.domNodes[0]).popupLevel))
>>>     }
>>> })();
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "TiddlyWiki" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/tiddlywiki/1360bf91-b66a-4903-8aad-b7d9c8b22849o%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/tiddlywiki/1360bf91-b66a-4903-8aad-b7d9c8b22849o%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/8ad48253-593e-4ca2-8cd8-4d1b03b94391n%40googlegroups.com.

Reply via email to