Archived
1
0

fix hover

This commit is contained in:
Jeff 2018-05-16 19:50:02 -04:00
parent 9ebc76e4e8
commit 5ea16f369a

View File

@ -219,6 +219,9 @@ onready(function() {
ajax.send();
};
var elems = document.getElementsByClassName("backlink");
var inj = function(elem)
{
var showhover = function(parent, url, id)
{
fetchpost(url, function(post) {
@ -244,28 +247,27 @@ onready(function() {
if(hover) hover.remove();
};
var elems = document.getElementsByClassName("backlink");
for(var idx = 0; idx < elems.length; idx ++)
{
var elem = elems[idx];
var parent = elem.parentNode.parentNode.id;
var wrapper = document.createElement("div");
elem.parentNode.insertBefore(wrapper, elem);
var el = elem.cloneNode(true);
elem.remove();
elem = el;
var h = elem.href.split("#")[1];
var parts = el.href.split("#");
wrapper.appendChild(el);
var id = "hover_"+h;
elem.onpointerenter = function() {
showhover(wrapper, elem.href, id);
var id = "hover_"+parts[1]+"_"+parent;
console.log(id);
el.onpointerenter = function() {
showhover(wrapper, el.href, id);
};
elem.onpointerleave = function()
el.onpointerleave = function()
{
hidehover(wrapper, id);
};
}
for (var idx = 0 ; idx < elems.length ; idx++) inj(elems[idx]);
});
// rewrite all images to add inline expand