NarrowBlog_PushupComment

小説家になろう感想・活動報告のコメントフォームをコメントの上に押し上げる

  1. // ==UserScript==
  2. // @name NarrowBlog_PushupComment
  3. // @namespace phodra
  4. // @description 小説家になろう感想・活動報告のコメントフォームをコメントの上に押し上げる
  5. // @version 1.3
  6. // @include http://mypage.syosetu.com/mypageblog/view/userid/*
  7. // @include http://novelcom.syosetu.com/impression/list/ncode/*
  8. // @include https://mypage.syosetu.com/mypageblog/view/userid/*
  9. // @include https://novelcom.syosetu.com/impression/list/ncode/*
  10. // ==/UserScript==
  11.  
  12. /* // AutoPagerize互換用SITEINFO
  13. {
  14. url: "^http://mypage\\.syosetu\\.com/mypage",
  15. nextLink: "//a[@title='next page' or ../@class='blogcomment_r'] | id('my_blog_l')/a[not(//a[../@class='blogcomment_r'])]",
  16. pageElement: "//div[@class='bloglist'] | id('novellist novelpointlist novelreviewlist')/ul | id('favuser')//li | id('blogbg blog_comment_input')[not(//a[../@class='blogcomment_l'])] | id('blog_comment')",
  17. exampleUrl: "",
  18. },
  19. */
  20.  
  21. (function (){
  22. if( location.href.indexOf("blog")>0){
  23. // 活動報告
  24. const input = "blog_comment_input";
  25. const inspos = "blog_comment";
  26. var PushUp = function( elm, pos){
  27. // 活動報告
  28. var parent = document.getElementById("main");
  29. if( elm == null ){
  30. // コメントフォームをコメント一覧の上に持っていく
  31. elm = document.getElementById(input);
  32. }
  33. if( pos == null ){
  34. // 通常ならコメントの前、コメントがない場合本文の後
  35. pos = document.getElementById(inspos);
  36. }
  37.  
  38. if( elm && pos ){
  39. parent.insertBefore( elm, pos);
  40. parent.insertBefore( document.createElement("br"), pos);
  41. }
  42. };
  43. PushUp();
  44.  
  45. var nodes = {};
  46. document.addEventListener(
  47. 'AutoPagerize_DOMNodeInserted',
  48. function(e){
  49. var node = e.input;
  50. nodes[node.id] = node;
  51. }, false
  52. );
  53. document.addEventListener(
  54. 'GM_AutoPagerizeNextPageLoaded',
  55. function(e){
  56. if( nodes[inspos] && nodes[input] ){
  57. PushUp( nodes[input], nodes[inspos] );
  58. nodes={};
  59. }
  60. }, false
  61. );
  62. }else{
  63. // 小説感想ページ
  64. var comment = "#hyoukalan";
  65. var $comment = $(comment);
  66.  
  67. // 移動
  68. var $pos = $("h1:eq(0)");
  69. $pos.before($comment);
  70. $pos.before($("<hr>"));
  71. // 横幅いっぱいにする
  72. $("textarea," + comment).css(
  73. {
  74. 'box-sizing': 'border-box',
  75. 'width': '100%'
  76. }
  77. );
  78.  
  79. // "▽感想を書く"を消去
  80. $(".input").hide();
  81. }
  82. })();

QingJ © 2025

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