Gushiwen Auto Unfolding

Auto unfolding the fanyi and shangxi blocks for so.gushiwen.cn & remove Weixin QR-Code

  1. // ==UserScript==
  2. // @name Gushiwen Auto Unfolding
  3. // @name:zh-cn 古诗文网自动展开
  4. // @namespace http://tampermonkey.net/
  5. // @version 2023-12-16
  6. // @description Auto unfolding the fanyi and shangxi blocks for so.gushiwen.cn & remove Weixin QR-Code
  7. // @description:zh-cn 自动展开古诗文网注释/赏析,移除微信二维码
  8. // @author WntFlm
  9. // @match *://so.gushiwen.cn/*
  10. // @icon https://www.google.com/s2/favicons?sz=64&domain=gushiwen.cn
  11. // @grant none
  12. // @license GPLv3
  13. // @run-at document-end
  14. // ==/UserScript==
  15.  
  16. function fanyiShow(id, idjm) {
  17. document.getElementById('fanyi' + id).style.display = 'none';
  18. document.getElementById('fanyiquan' + id).style.display = 'block';
  19.  
  20. var xmlhttp;
  21. if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
  22. xmlhttp = new XMLHttpRequest();
  23. }
  24. else {// code for IE6, IE5
  25. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  26. }
  27. xmlhttp.onreadystatechange = function () {
  28. if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  29. document.getElementById("fanyiquan" + id).innerHTML = xmlhttp.responseText;
  30. //如果正在播放
  31. if (document.getElementById('fanyiPlay' + id).style.display == "block") {
  32. document.getElementById('speakerimgFanyiquan' + id).src = "https://ziyuan.guwendao.net/siteimg/speak-erOk.png";
  33. }
  34. }
  35. }
  36. xmlhttp.open("GET", "/nocdn/ajaxfanyi.aspx?id=" + idjm, false);
  37. xmlhttp.send();
  38. }
  39.  
  40. function shangxiShow(id, idjm) {
  41. document.getElementById('shangxi' + id).style.display = 'none';
  42. document.getElementById('shangxiquan' + id).style.display = 'block';
  43.  
  44. var xmlhttp;
  45. if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
  46. xmlhttp = new XMLHttpRequest();
  47. }
  48. else {// code for IE6, IE5
  49. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  50. }
  51. xmlhttp.onreadystatechange = function () {
  52. if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  53. document.getElementById("shangxiquan" + id).innerHTML = xmlhttp.responseText;
  54. //如果正在播放
  55. if (document.getElementById('shangxiPlay' + id).style.display == "block") {
  56. document.getElementById('speakerimgShangxiquan' + id).src = "https://ziyuan.guwendao.net/siteimg/speak-erOk.png";
  57. }
  58. }
  59. }
  60. xmlhttp.open("GET", "/nocdn/ajaxshangxi.aspx?id=" + idjm, false);
  61. xmlhttp.send();
  62. }
  63.  
  64. window.fanyiShow = fanyiShow;
  65. window.shangxiShow = shangxiShow;
  66.  
  67. (function() {
  68. 'use strict';
  69. // Remove Weixin QR-Code
  70. document.querySelector("#hide-center2").remove()
  71. // Auto Unfolding
  72. let fanyiOnClick = document.querySelector("[id^='fanyi'] > div > div:nth-child(1)").click();
  73. if (/fanyiShow\(\d+,'[A-Z0-9]+'\)/.exec(fanyiOnClick)) {
  74. eval(fanyiOnClick);
  75. } else {
  76. console.log("[ERROR] (Gushiwen Auto Unfolding) Can't find the unfolding function, try updating this script.");
  77. }
  78. let shangxiOnClick = document.querySelector("[id^='shangxi'] > div > div:nth-child(1)").click();
  79. if (/shangxiShow\(\d+,'[A-Z0-9]+'\)/.exec(shangxiOnClick)) {
  80. eval(shangxiOnClick);
  81. } else {
  82. console.log("[ERROR] (Gushiwen Auto Unfolding) Can't find the unfolding function, try updating this script.");
  83. }
  84. })();