Guest User

Untitled

a guest
Jul 15th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. function addpreviewevents(context) {
  2.  
  3. $("a[class^='ref|']", context).mouseenter(
  4. function(e){
  5. var ainfo = $(this).attr("class").split('|');
  6. var previewelement = $("<div></div>").addClass('reflinkpreview').attr({
  7. id: "preview" + $(this).attr("class"),
  8. style: "left:" + (e.pageX + 50) + "px;display:none"});
  9. if ( $('#postform [name=board]').val() == ainfo[1] && $('#reply' + ainfo[3]).length && (($('#thumb' + ainfo[3]).length && $('#thumb' + ainfo[3] + " img:first-child").attr("src").lastIndexOf("thumb") != -1) || !$('#thumb' + ainfo[3]).length)) {
  10. var isonpage = true;
  11. previewelement.html($("#reply" + ainfo[3]).parents("table").html());
  12. }
  13. else {
  14. $.get(ku_boardspath + '/ajax.php?act=read&board=' + ainfo[1] + '&thread=' + ainfo[2] + '&post=' + ainfo[3] + '&single',{},
  15. function (responseText, textStatus) {
  16. if(textStatus != "success") {
  17. alert('wut');
  18. }
  19. else {
  20. if (responseText) {
  21. previewelement.html(responseText).toggle("normal");
  22. }
  23. else {
  24. previewelement.html(_("something went wrong (blank response)")).toggle("normal");
  25. }
  26. }
  27. });
  28. }
  29. previewelement.insertBefore($(this));
  30. if(isonpage) previewelement.toggle("normal");
  31. }).mouseleave(
  32. function(e){
  33. var previewelement = ($("div [id='preview"+$(this).attr("class")+"']"));
  34. if (previewelement.length) {
  35. previewelement.remove();
  36. }
  37. }).click(
  38. function(e){
  39. var ainfo = $(this).attr("class").split('|');
  40. return highlight(ainfo[3], true);
  41. });
  42. }
Add Comment
Please, Sign In to add comment