煎蛋侠

为煎蛋jandan.net提供左右方向键快捷翻页、鼠标悬停显示大图、屏蔽指定用户发言等功能

目前为 2016-12-11 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name 煎蛋侠
  3. // @name:en JiandanHero
  4. // @name:zh-TW 煎蛋俠
  5. // @namespace hoothin
  6. // @version 0.1
  7. // @description 为煎蛋jandan.net提供左右方向键快捷翻页、鼠标悬停显示大图、屏蔽指定用户发言等功能
  8. // @description:en Tools for jiandan
  9. // @description:zh-TW 為煎蛋jandan.net提供左右方向鍵快捷翻頁、鼠標懸停顯示大圖、屏蔽指定用戶發言等功能
  10. // @author hoothin
  11. // @match http*://jandan.net/*
  12. // @grant GM_setValue
  13. // @grant GM_getValue
  14. // @grant GM_deleteValue
  15. // ==/UserScript==
  16.  
  17. (function() {
  18. 'use strict';
  19. document.addEventListener("keydown", function(e) {
  20. if(/INPUT|TEXTAREA/.test(document.activeElement.tagName))return;
  21. switch(e.keyCode){
  22. case 37://←
  23. var next=document.querySelector("span#nav_next>a");
  24. if(next)next.click();
  25. break;
  26. case 39://→
  27. var pre=document.querySelector("span#nav_prev>a");
  28. if(pre)pre.click();
  29. break;
  30. }
  31. });
  32. var authors=document.querySelectorAll("div.author"),i;
  33. for(i=0;i<authors.length;i++){
  34. let author=authors[i];
  35. let authorId=author.querySelector("strong").title.replace(/防伪码:/,"");
  36. let changeBtn=document.createElement("a");
  37. changeBtn.href="javascript:void(0);";
  38. changeBtn.id="changeBtn";
  39. changeBtn.style.display="none";
  40. author.insertBefore(changeBtn,author.querySelector("br"));
  41. if(GM_getValue("jandanDis_"+authorId)){
  42. author.nextSibling.nextSibling.style.display="none";
  43. changeBtn.innerHTML="显";
  44. }else{
  45. changeBtn.innerHTML="隐";
  46. }
  47. author.onmouseover=function(){
  48. changeBtn.style.display="block";
  49. };
  50. author.onmouseout=function(){
  51. changeBtn.style.display="none";
  52. };
  53. changeBtn.onclick=function(){
  54. var author_s,j,shown;
  55. if(author.nextSibling.nextSibling.style.display=="none"){
  56. shown=false;
  57. GM_deleteValue("jandanDis_"+authorId);
  58. }else{
  59. shown=true;
  60. GM_setValue("jandanDis_"+authorId,true);
  61. }
  62. for(j=0;j<authors.length;j++){
  63. author_s=authors[j];
  64. if(author_s.querySelector("strong").title.replace(/防伪码:/,"")==authorId){
  65. author_s.nextSibling.nextSibling.style.display=shown?"none":"block";
  66. author_s.querySelector("#changeBtn").innerHTML=shown?"显":"隐";
  67. }
  68. }
  69. };
  70. }
  71. var imgs=document.querySelectorAll("img");
  72. var bigImg=document.createElement("img");
  73. bigImg.style.cssText="pointer-events: none;position:fixed;z-index:999";
  74. for(i=0;i<imgs.length;i++){
  75. let img=imgs[i];
  76. img.onmouseover=function(e){
  77. bigImg.src=img.src.replace(/\/s\/custom\//,"/s/medium/").replace(/\.sinaimg\.cn\/mw600/,".sinaimg.cn/large");
  78. document.body.appendChild(bigImg);
  79. };
  80. img.onmouseout=function(e){
  81. document.body.removeChild(bigImg);
  82. };
  83. img.onmousemove=function(e){
  84. var top=e.clientY;
  85. if(!bigImg.src || bigImg.src===""){
  86. bigImg.src=img.src.replace(/\/s\/custom\//,"/s/medium/").replace(/\.sinaimg\.cn\/mw600/,".sinaimg.cn/large");
  87. document.body.appendChild(bigImg);
  88. }
  89. if(bigImg.height>document.documentElement.clientHeight){
  90. bigImg.height=document.documentElement.clientHeight;
  91. }else if(bigImg.height<document.documentElement.clientHeight){
  92. bigImg.removeAttribute("height");
  93. }
  94. if(top+bigImg.height>document.documentElement.clientHeight){
  95. top=document.documentElement.clientHeight-bigImg.height;
  96. }
  97. bigImg.style.left=e.clientX+10+"px";
  98. bigImg.style.top=top+"px";
  99. };
  100. }
  101. })();

QingJ © 2025

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