AC-论坛悬浮回复框

常用论坛的悬浮回复框,点击固定,再次点击缩回

目前为 2017-02-08 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name AC-论坛悬浮回复框
  3. // @description 常用论坛的悬浮回复框,点击固定,再次点击缩回
  4. // @namespace K
  5. // @include *
  6. // @version 1.3
  7. // @note 反馈地址 http://bbs.kafan.cn/thread-2076136-1-1.html
  8. // @icon https://coding.net/u/zb227/p/zbImg/git/raw/master/img0/icon.jpg
  9. // @run-at document-end
  10. // @grant none
  11. // ==/UserScript==
  12. function addStyle(css) {
  13. var style = document.createElement('style');
  14. style.type = 'text/css';
  15. var node = document.createTextNode(css);
  16. style.appendChild(node);
  17. document.head.appendChild(style);
  18. return style;
  19. }
  20. var frameNames = new Array(
  21. "div","DIV", "TD", "td", "h2", "form"
  22. );
  23. function isFrame(node){
  24. for(var index = 0; index < frameNames.length; index++){
  25. if(node.indexOf(frameNames[index]) == 0)
  26. return true;
  27. }
  28. return false;
  29. }
  30. function addBtn(nodeName){
  31. var node = document.querySelector(nodeName);
  32. if(node == null) return;
  33. node.setAttribute("expand", "0");
  34. var formNode = document.querySelector(nodeName+" form"); // "#f_pst form"
  35. if(formNode != null)
  36. formNode.setAttribute("onsubmit", formNode.getAttribute("onsubmit")+",this.click()");
  37. node.onclick = function expandView(sender){
  38. //console.log(node);
  39. //console.log(sender.target);
  40. //console.log(sender.target.localName);
  41. if(node.getAttribute("expand") == "0"){//未展开--->展开
  42. console.log("展开");
  43. node.setAttribute("expand", "1");
  44. node.style = "width:auto !important; height:auto !important; background:#fcfcfc; transition-delay:0.5s !important;";
  45. //addStyle("#anchor,#quickpost, #f_pst, #f_post, #fast_post_c, form[action=\"post.php?\"][method=\"post\"] > .t5{width:auto !important; height:auto !important; background:#fcfcfc; transition-delay:0.5s !important; }");
  46. }else{
  47. if(isFrame(sender.target.localName) == false){
  48. console.log("点击了"+sender.target.localName + ",不是边框类型");
  49. return;
  50. }
  51. console.log("收回");
  52. node.setAttribute("expand", "0");
  53. node.style = "width:30px !important; height:240px !important; background:#fcfcfc; transition-delay:0.3s !important;";
  54. //addStyle("#anchor,#quickpost, #f_pst, #f_post, #fast_post_c, form[action=\"post.php?\"][method=\"post\"] > .t5{width:18px !important; height:280px !important; background:#fcfcfc; transition-delay:0.3s !important; }");
  55. }
  56. };
  57. }
  58.  
  59. addStyle("#anchor,#quickpost, #f_post, #f_pst, #fast_post_c, form[action=\"post.php?\"][method=\"post\"] > .t5 {border:1px solid #2B5782 !important;position:fixed;bottom:-11px !important;z-index:99 !important;right:20px !important;height:240px !important;width:30px !important;overflow:hidden;transition-duration: 0.2s !important;transition-delay:0.3s !important;}");
  60. addStyle("#anchor:hover,#quickpost:hover, #f_pst:hover, #f_post:hover, #fast_post_c:hover, form[action=\"post.php?\"][method=\"post\"] > .t5:hover{width:auto !important; height:auto !important; background:#fcfcfc; transition-delay:0.5s !important; }");
  61. addStyle("#f_pst .p_pop,#f_pst .p_opt{position: absolute !important;bottom: 34% !important;top: auto !important;}");
  62. addBtn("#anchor");
  63. addBtn("#quickpost");
  64. addBtn("#f_pst");
  65. addBtn("#f_post");
  66. addBtn("#fast_post_c");
  67. addBtn("form[action=\"post.php?\"][method=\"post\"] > .t5");

QingJ © 2025

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