Bangumi时光机

在Bangumi条目页使用,用于查看条目评分走势

安裝腳本?
作者推薦腳本

您可能也會喜歡 漫海拾贝

安裝腳本
  1. // ==UserScript==
  2. // @name Bangumi时光机
  3. // @namespace https://windrises.net
  4. // @version 0.61
  5. // @description 在Bangumi条目页使用,用于查看条目评分走势
  6. // @author windrises
  7. // @require http://code.jquery.com/jquery-1.8.3.min.js
  8. // @require http://code.highcharts.com/highcharts.js
  9. // @require http://code.highcharts.com/modules/exporting.js
  10. // @include /^(https?|http)://(bgm\.tv|bangumi\.tv|chii\.in)/(subject|ep).*/
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. $("#headerSubject").find("[class='navTabs clearit']").append("<li><a id='subject_review' href='javascript:void(0);'>评分走势</a></li>");
  15. var url = location.pathname;
  16. url = url.split("/");
  17. var id;
  18. var type = url[1];
  19. if (type == "subject") id = url[2];
  20. else {
  21. id = $("#subject_inner_info").find("[class='avatar']").attr("href");
  22. id = id.split("/")[2];
  23. }
  24. $("#subject_review").click(function(){
  25. var html = '<div id="columnInSubjectA" class="column">' +
  26. '<div id="score_chart" style="width:740px;height:420px"></div>' +
  27. '</div>' +
  28. '<div id="columnInSubjectB" class="column">' +
  29. '<div class="menu_inner">' +
  30. '<a href="/subject/' + id + '" class="l">/ 返回条目页面</a>' +
  31. '</div>' +
  32. '<div class="menu_inner">' +
  33. '<a href="https://windrises.net/bgmtools/review?id=' + id + '" class="l" target="_blank">/ 查看详情</a>' +
  34. '</div>' +
  35. '</div>' +
  36. '</div>';
  37. var error_html = '<h2>出错了</h2>' +
  38. '<p class="text">该条目暂时还未收录</p>';
  39. $("#wrapperNeue").find("[class='columns clearit']").html(html);
  40. $("#headerSubject").find("[class='focus']").removeClass("focus");
  41. $("#subject_review").addClass("focus");
  42. $.getJSON("https://windrises.net/bgmtools/review/chart/api?id=" + id, function(ret){
  43. if (ret.error){
  44. $("#columnInSubjectA").html(error_html);
  45. }else {
  46. show_chart(ret);
  47. }
  48. });
  49. });
  50. })();
  51.  
  52. function show_chart(data) {
  53. $('#score_chart').show();
  54. $('#score_chart').highcharts({
  55. chart: {
  56. zoomType: 'xy'
  57. },
  58. title: {
  59. text: data.name + ' 评分走势图'
  60. },
  61. subtitle: {
  62. text: ''
  63. },
  64. xAxis: [{
  65. categories: data.time,
  66. crosshair: true
  67. }],
  68. yAxis: [{ // Primary yAxis
  69. labels: {
  70. format: '{value}',
  71. style: {
  72. color: Highcharts.getOptions().colors[0]
  73. }
  74. },
  75. title: {
  76. text: '分数',
  77. style: {
  78. color: Highcharts.getOptions().colors[0]
  79. }
  80. }
  81. }, { // Secondary yAxis
  82. gridLineWidth: 0,
  83. title: {
  84. text: '名次',
  85. style: {
  86. color: Highcharts.getOptions().colors[1]
  87. }
  88. },
  89. labels: {
  90. format: '{value}',
  91. style: {
  92. color: Highcharts.getOptions().colors[1]
  93. }
  94. },
  95. opposite: true,
  96. reversed: true
  97. }, { // Tertiary yAxis
  98. gridLineWidth: 0,
  99. title: {
  100. text: '人数',
  101. style: {
  102. color: Highcharts.getOptions().colors[2]
  103. }
  104. },
  105. labels: {
  106. format: '{value}',
  107. style: {
  108. color: Highcharts.getOptions().colors[2]
  109. }
  110. },
  111. opposite: true
  112. }],
  113. tooltip: {
  114. shared: true
  115. },
  116. legend: {
  117. // layout: 'vertical',
  118. align: 'left',
  119. x: 20,
  120. verticalAlign: 'top',
  121. y: 5,
  122. floating: true,
  123. backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
  124. },
  125. series: [{
  126. name: '评分',
  127. type: 'spline',
  128. yAxis: 0,
  129. data: data.score,
  130. tooltip: {
  131. valueSuffix: ''
  132. }
  133. }, {
  134. name: '排名',
  135. type: 'spline',
  136. yAxis: 1,
  137. data: data.rank,
  138. marker: {
  139. enabled: false
  140. },
  141. // dashStyle: 'shortdot',
  142. tooltip: {
  143. valueSuffix: ''
  144. }
  145. }, {
  146. name: '标记人数',
  147. type: 'spline',
  148. yAxis: 2,
  149. data: data.people,
  150. tooltip: {
  151. valueSuffix: ''
  152. }
  153. }],
  154. credits: {
  155. text: 'windrises.net',
  156. href: 'https://windrises.net'
  157. }
  158. });
  159. }

QingJ © 2025

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