Reddit WebPreview

Webpage Preview like hoverzoom

  1. // ==UserScript==
  2. // @name Reddit WebPreview
  3. // @version 7.19.14
  4. // @description Webpage Preview like hoverzoom
  5. // @match *://www.reddit.com*/*
  6. // @copyright 2014+, Hans Strausl
  7. // @namespace https://gf.qytechs.cn/users/3445
  8. // ==/UserScript==
  9. var RWP_DEBUG = false;
  10. var things, link, i, x, w, h, page, timeout = null;
  11.  
  12. function init(){
  13. setTimeout(function(){
  14. G("Reddit WebPreview Started");
  15. things = document.getElementsByClassName("thing link");
  16. for (i = 0; i < things.length; i++){
  17. link = things[i].getElementsByClassName("title may-blank")[0];
  18. link.onmouseover = function(e){
  19. if (!(this.className.search("hoverZoomLink") > -1)){
  20. G(link);
  21. prvw(this, e.pageX);
  22. }
  23. };
  24. }
  25. }, 500);
  26. }
  27.  
  28. window.onload = init();
  29.  
  30. function prvw(link, mouseX){
  31. timeout = setTimeout(function(){
  32. w = screen.width;
  33. h = screen.height - 200;
  34. x = (w / 2) - 150;
  35. G(w + " x " + h + " : " + x + " : " + (mouseX - 25));
  36. page = window.open(link.href,"","height=" + h + ",width=" + x + ",left=" + (mouseX - 25) + ",top=50");
  37. }, 500);
  38. link.onmouseout = function(e){
  39. clearTimeout(timeout);
  40. if (typeof page !== "undefined"){
  41. page.close();
  42. }
  43. };
  44. window.onbeforeunload = function(e){
  45. if (typeof page !== "undefined"){
  46. page.close();
  47. }
  48. }
  49. }
  50.  
  51. function G(data){
  52. if (RWP_DEBUG === true){
  53. console.log(data);
  54. }
  55. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址