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