Advertisement
Guest User

Untitled

a guest
Feb 24th, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function viewPostStage2(link, postNumber, post) {
  2.     post.onmouseout = function(event) {
  3.         var next = post;
  4.         while (!!next) {
  5.             var list = traverseChildren(next);
  6.             var e = event.toElement || event.relatedTarget;
  7.             if (list.indexOf(e) >= 0)
  8.                 return;
  9.             next = next.nextPostPreview;
  10.         }
  11.         post.style.display = "none";
  12.         if (post.previousPostPreview)
  13.             post.previousPostPreview.onmouseout(event);
  14.     };
  15.     post.onmouseover = function(event) {
  16.         post.mustHide = false;
  17.     };
  18.     post.style.position = "absolute";
  19.     var doc = document.documentElement;
  20.     var linkCenter = link.left + (link.right - link.left) / 2;
  21.     if (linkCenter < 0.6 * doc.clientWidth) {
  22.         post.style.maxWidth = doc.clientWidth - linkCenter + "px";
  23.         post.style.left = linkCenter + "px";
  24.     } else {
  25.         post.style.maxWidth = linkCenter + "px";
  26.         post.style.left = linkCenter - post.scrollWidth + "px";
  27.     }
  28.     post.style.top = (doc.clientHeight - link.bottom >= post.scrollHeight)
  29.         ? (doc.scrollTop + link.bottom - 4 + "px")
  30.         : (doc.scrollTop + link.top - post.scrollHeight - 4 + "px");
  31.     post.style.zIndex = 9999;
  32.     /*var offs = cumulativeOffset(link);
  33.     post.style.left = (offs.left + link.offsetWidth + 20) + "px";
  34.     post.style.top = (offs.top - 40) + "px";*/
  35.     if (!postPreviews[postNumber])
  36.         postPreviews[postNumber] = post;
  37.     else
  38.         post.style.display = "";
  39.     post.previousPostPreview = lastPostPreview;
  40.     if (!!lastPostPreview)
  41.         lastPostPreview.nextPostPreview = post;
  42.     lastPostPreview = post;
  43.     post.mustHide = true;
  44.     if (!!lastPostPreviewTimer)
  45.         clearTimeout(lastPostPreviewTimer);
  46.     document.body.appendChild(post);
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement