36rain-layout-plugin

改变36雨布局的脚本文件,持续更新中...

  1. // ==UserScript==
  2. // @name 36rain-layout-plugin
  3. // @name:zh-CN 36rain页面适配插件
  4. // @namespace http://36rain.com
  5. // @version 2.6.5
  6. // @description 改变36雨布局的脚本文件,持续更新中...
  7. // @description:zh-CN 改变36雨布局的脚本文件,持续更新中...
  8. // @match http://36rain.com/*
  9. // @match http://www.36rain.com/*
  10. // @match https://36rain.me/*
  11. // @match https://www.36rain.me/*
  12. // @match https://36rain.me/*
  13. // @match https://www.36rain.me/*
  14. // @run-at document-start
  15. // @license MIT
  16. // @grant GM_info
  17. // @grant GM_getValue
  18. // @grant GM_setValue
  19. // @grant GM_deleteValue
  20. // @grant GM_xmlhttpRequest
  21. // @grant GM_registerMenuCommand
  22. // @grant GM_openInTab
  23. // @grant GM_notification
  24. // @grant GM_addStyle
  25. // @grant GM_log
  26. // @grant GM_getResourceText
  27. // @grant GM_getResourceURL
  28. // @grant GM_listValues
  29. // @grant GM_addValueChangeListener
  30. // @grant GM_removeValueChangeListener
  31. // @grant GM_setClipboard
  32. // @grant GM_getTab
  33. // @grant GM_saveTab
  34. // @grant GM_getTabs
  35. // @grant GM_download
  36. // ==/UserScript==
  37.  
  38.  
  39.  
  40. /*
  41. Author: 无名布女
  42. Greasyfork: Put your Greasyfork profile page URL here.
  43. */
  44.  
  45.  
  46. (function() {
  47. 'use strict';
  48.  
  49. const customCSS = `
  50. body, html {
  51. font-size: 36px !important;
  52. line-height: 150% !important;
  53. }
  54. // green wallpaper
  55. // html {
  56. // background: url('https://p3.itc.cn/images01/20210429/56eba48f5cff49308fc61f3416d38307.jpeg') no-repeat center center fixed !important;
  57. // background-color: #E2EDCB !important;
  58. // background-size: cover !important;
  59. // }
  60. html {
  61. background: radial-gradient(#fffaee 15%, transparent 16%), linear-gradient(45deg, transparent 49%, #fffaee 49% 51%, transparent 51%), linear-gradient(-45deg, transparent 49%, #fffaee 49% 51%, transparent 51%);
  62. background-size: 6em 6em;
  63. background-color: #FCF5E3;
  64. opacity: 1
  65. }
  66. #header {
  67. width: 60%; /* By default (for laptop and larger), width is 60% */
  68. }
  69. #user-login {
  70. width: 100% !important;
  71. display: block !important;
  72. font-size: 36px !important;
  73. }
  74. /* For mobile and tablets */
  75. @media screen and (max-width: 1024px) {
  76. #header {
  77. width: 96%; /* On screens smaller than 1024px wide, width becomes 100% */
  78. }
  79. }
  80. body {
  81. background: none !important;
  82. }
  83. #main {
  84. width: 100% !important;
  85. }
  86. #header > div:nth-child(3) {
  87. background: rgba(0,0,0,0.1) !important;
  88. }
  89. #guide {
  90. padding-right: 0px !important;
  91. }
  92.  
  93. .guide li {
  94. margin: 10px 0px 10px 30px !important;
  95. float: right;
  96. }
  97. #wrapA {
  98. background: none !important;
  99. }
  100. #infobox {
  101. margin-top: 0px !important;
  102. padding-top: 40px !important;
  103. /* border-top: 1px dashed #ccc !important; */
  104. }
  105.  
  106. #mainNav {
  107. margin-bottom: 0 !important;
  108. padding-bottom: 40px !important;
  109. /* border-bottom: 1px dashed #ccc !important; */
  110. }
  111. .input {
  112. font-size: 36px !important;
  113. height: 60px !important;
  114. margin-bottom: 40px !important;
  115. }
  116. .user-infoWrap2, .user-infoWrap2 * {
  117. line-height: 100% !important;
  118. font-size: 24px !important;
  119. }
  120. .tr3 * {
  121. line-height: 150% !important;
  122. }
  123. .f10, .f10 * {
  124. font-size: 30px !important;
  125. }
  126. .tiptop, .tiptop * {
  127. font-size: 32px !important;
  128. line-height: 100% !important;
  129. margin-top: 20px !important;
  130. margin-bottom: 30px !important;
  131. border: 0px !important;
  132. }
  133. .listinline {
  134. display: none !important;
  135. }
  136. .t3 {
  137. margin-bottom: 20px !important;
  138. font-size: 40px !important;
  139. }
  140. .h {
  141. background: none !important;
  142. }
  143. #main > div.h2 {
  144. display: none !important;
  145. }
  146. .user-pic {
  147. margin-top: 10px !important;
  148. margin-bottom: 10px !important;
  149. margin-right: auto !important;
  150. margin-left: auto !important;
  151. }
  152. .pages {
  153. height: auto;
  154. line-height: 150% !important;
  155. width: 100% !important;
  156. margin-bottom: 40px;
  157. padding-top: 5px;
  158. padding-bottom: 5px;
  159. border: none !important;
  160. }
  161. .hthread {
  162. height: 36px !important;
  163. }
  164. .fl .threadlist {
  165. height: 100% !important;
  166. }
  167. .pages ul li {
  168. margin-right: 30px !important;
  169. }
  170. .pages ul .pagesone {
  171. background: none !important;
  172. border: none !important;
  173. }
  174. .pages input {
  175. font-size: 36px !important;
  176. height: auto !important;
  177. }
  178. .tpc_content, tpc_content * {
  179. border-top: 2px dashed #ccc !important;
  180. padding: 1em 0.5em 0.5em 0.5em !important;
  181. font-size: 40px !important;
  182. }
  183. .tr2, .tr2 * {
  184. height: auto;
  185. line-height: 150% !important;
  186. margin-bottom: 20px;
  187. background: rgba(252,250,242, 0.3) !important;
  188. }
  189. .f14 * {
  190. font-size: 40px !important;
  191. letter-spacing: normal !important;
  192. line-height: 200% !important;
  193. }
  194. .f14 h6, .f14 h6 * {
  195. font-size: inherit !important;
  196. }
  197. .f14 blockquote, .f14 blockquote3, .f14 blockquote2 {
  198. font-size: inherent !important;
  199. width: 100% !important;
  200. letter-spacing: normal !important;
  201. line-height: 200% !important;
  202. background: rgba(255, 255, 255, 0.2) !important;
  203. }
  204. .f10, .f10 * {
  205. font-size: 30px !important;
  206. }
  207. .h2, .h2 * {
  208. height: 40px !important;
  209. background: none !important;
  210. }
  211. .guide {
  212. line-height: 150% !important;
  213. }
  214. .btn {
  215. font-size: 30px !important;
  216. }
  217. #post-option span {
  218. width: 100% !important;
  219. }
  220. .tipad, .signature, .tipad *, .signature * {
  221. font-size: 32px !important;
  222. }
  223. // #breadcrumbs, #breadcrumbs * {
  224. // padding: 1em 3em 1em 7px !important;
  225. // margin-right: 0px !important;
  226. // background: none !important;
  227. // border: none !important;
  228. // }
  229. .f_one, .t_one, .r_one {
  230. background: none !important;
  231. }
  232. tr > td.f_one:nth-child(1), tr > td.f_one:nth-child(3) {
  233. display: none !important;
  234. }
  235. #footer {
  236. background: none !important;
  237. }
  238. #smiliebox {
  239. background: none !important;
  240. border: none !important;
  241. }
  242. #one-key {
  243. display: none !important;
  244. }
  245. #shortcutforum li {
  246. float: right !important;
  247. }
  248. tr.tr1 th.r_two {
  249. background: none !important;
  250. }
  251. #user_info {
  252. width: 70% !important;
  253. }
  254. // remove user info
  255. #user_info > div:nth-child(3) > div > div > div {
  256. display: none !important;
  257. }
  258. .gonggao {
  259. display: none !important;
  260. }
  261.  
  262. /// breadcrumbs
  263. #main > div.bdbA {
  264. height: auto !important;
  265. display: flex !important;
  266. align-items: center !important;
  267. padding: 0px !important;
  268. }
  269. #breadcrumbs {
  270. margin: 0px !important;
  271. display: flex !important;
  272. align-items: center !important;
  273. height: auto !important;
  274. overflow: visible !important;
  275. opacity: 0.8 !important;
  276. }
  277. #breadcrumbs .crumbs-item, #breadcrumbs .crumbs-item * {
  278. height: auto !important;
  279. overflow: visible !important;
  280. line-height: 150% !important;
  281. }
  282. #breadcrumbs > span.fr.gray3 {
  283. line-height: 150% !important;
  284. }
  285. #notice {
  286. padding: 0px !important;
  287. height: auto !important;
  288. display: flex !important;
  289. align-items: center !important;
  290. }
  291. #notice0, #notice0 * {
  292. height: auto !important;
  293. width: 100% !important;
  294. overflow-y: visible !important;
  295. line-height: 150% !important;
  296. }
  297. div.tiptop > div.fr {
  298. visibility: hidden;
  299. }
  300. #td_tpc > div.tiptop > div.fr > input, #td_tpc > div.tiptop > div.fr > a[title="只看樓主的所有帖子"] {
  301. visibility: visible !important;
  302. }
  303. div.tiptop > div.fr > input, div.tiptop > div.fr > a[title="只看該作者的所有回復"] {
  304. visibility: visible !important;
  305. }
  306. // re-arrange fast0reply box
  307. div .t5 {
  308. width: 100% !important;
  309. overflow: scroll !important;
  310. }
  311. #r_dig {
  312. display: none !important;
  313. }
  314. `;
  315.  
  316. // Function to replace img elements within specified anchors with text
  317. function replaceImageWithText(selector, newText) {
  318. var targetLinks = document.querySelectorAll(selector);
  319. targetLinks.forEach(function(anchor) {
  320. var img = anchor.querySelector('img');
  321. if (img) {
  322. img.remove(); // Remove the img element
  323. anchor.appendChild(document.createTextNode(newText)); // Add the text node
  324. }
  325. });
  326. }
  327. // function to replace img elements with font awesome icons
  328. function replaceImageWithIcon(selector, iconClass) {
  329. var targetLinks = document.querySelectorAll(selector);
  330. targetLinks.forEach(function(anchor) {
  331. var img = anchor.querySelector('img');
  332. if (img) {
  333. img.remove(); // Remove the img element
  334. var icon = document.createElement('i');
  335. icon.className = `${iconClass} fa-2x`; // Set the class name
  336. anchor.appendChild(icon); // Add the icon
  337. }
  338. });
  339. }
  340. // function to load progress bar
  341. function addProgressBar() {
  342. // add progress bar
  343. addScript('https://cdn.jsdelivr.net/npm/pace-js@1.2.4/pace.min.js');
  344. addStylesheet('https://cdn.jsdelivr.net/npm/pace-js@1.2.4/themes/silver/pace-theme-barber-shop.css');
  345. }
  346. // create and append links
  347. function createLink(div, url, text) {
  348. var link = document.createElement('a');
  349. link.href = url;
  350. link.target = "_blank";
  351. link.textContent = text;
  352. div.appendChild(link);
  353. }
  354.  
  355. // function to add new script to <head>
  356. function addScript(url) {
  357. var head = document.head;
  358. var script = document.createElement('script');
  359. script.src = url;
  360. head.appendChild(script);
  361. }
  362. // function to add new stylesheet to <head>
  363. function addStylesheet(url) {
  364. var head = document.head;
  365. var link = document.createElement('link');
  366. link.rel = 'stylesheet';
  367. link.href = url;
  368. head.appendChild(link);
  369. }
  370.  
  371. // function to center content
  372. function centerContent(element) {
  373. element.style.display = 'flex';
  374. element.style.justifyContent = 'center';
  375. element.style.alignItems = 'center';
  376. element.style.textAlign = 'center';
  377. }
  378.  
  379. function centerContentVertical(element) {
  380. element.style.display = 'flex';
  381. element.style.justifyContent = 'center';
  382. element.style.alignItems = 'center';
  383. element.style.flexDirection = 'column';
  384. element.style.height = '100%';
  385. }
  386.  
  387. // Function to apply styles to elements
  388. function applyStyles() {
  389. // replay reply and new post with f
  390. var ReplaySelectors = [
  391. '#main > div:nth-child(5) > span:nth-child(2) > a',
  392. '#main > div:nth-child(13) > span:nth-child(2) > a'
  393. ];
  394. ReplaySelectors.forEach(function(selector) {
  395. replaceImageWithIcon(selector, 'fas fa-reply');
  396. });
  397. var PostSelectors = [
  398. '#main > div:nth-child(5) > span:nth-child(1) > a',
  399. '#main > div:nth-child(13) > span:nth-child(1) > a',
  400. '#main > div:nth-child(9) > span.fr > a',
  401. '#main > div:nth-child(8) > span.fr > a',
  402. '#main > div:nth-child(14) > span.fr > a',
  403. ];
  404. PostSelectors.forEach(function(selector) {
  405. replaceImageWithIcon(selector, 'fas fa-file');
  406. });
  407.  
  408. var f10elements = document.querySelectorAll('.f10 *');
  409. f10elements.forEach(function(el) {
  410. el.style.setProperty('font-size', '30px', 'important');
  411. });
  412.  
  413. // remove fast reply title
  414. var h2elements = document.querySelectorAll('.h2, .h2 *');
  415. h2elements.forEach(function(el) {
  416. // el.style.setProperty('height', '36px', 'important');
  417. el.style.setProperty('background', 'none', 'important');
  418. });
  419.  
  420. var h1elements = document.querySelectorAll('.h1, .h1 *');
  421. h1elements.forEach(function(el) {
  422. el.style.setProperty('font-size', '42px', 'important');
  423. el.style.setProperty('letter-spacing', 'normal', 'important');
  424. el.style.setProperty('line-height', '150%', 'important');
  425. });
  426.  
  427. // Apply styles to user-infoWrap2 elements
  428. var userInfoElements = document.querySelectorAll('.user-infoWrap2, .user-infoWrap2 *');
  429. userInfoElements.forEach(function(el) {
  430. el.style.setProperty('font-size', '24px', 'important');
  431. el.style.setProperty('line-height', '150%', 'important');
  432. });
  433.  
  434. // rearrange user login element
  435. var userLogin = document.querySelector('#mainNav > div:nth-child(2)');
  436. if (userLogin) {
  437. userLogin.style.setProperty('bottom', 'auto', 'important');
  438. }
  439.  
  440. // Change width of the specified <td> element
  441. var tdToChangeWidth = document.querySelector('#main > form:nth-child(21) > div > table > tbody > tr:nth-child(3) > td:nth-child(2)');
  442. if (tdToChangeWidth) {
  443. tdToChangeWidth.style.setProperty('width', '100%', 'important'); // Change width to 70%
  444. } else {
  445. console.error("Target TD element to change width was not found.");
  446. }
  447.  
  448. // Remove all <img> elements inside <th> elements
  449. var thElements = document.querySelectorAll('.tr3 th');
  450. thElements.forEach(function(th) {
  451. var imgElement = th.querySelector('img');
  452. if (imgElement) {
  453. console.log("IMG element found and will be removed:", imgElement.outerHTML);
  454. imgElement.style.setProperty('display', 'none', 'important');
  455. console.log("IMG element removed.");
  456. }
  457. });
  458.  
  459. // Change the margin of the specified element
  460. var divToChangeMargin = document.querySelector('#main > form:nth-child(5) > div > div:nth-child(4) > div:nth-child(1)');
  461. if (divToChangeMargin) {
  462. divToChangeMargin.style.setProperty('margin', '20px', 'important'); // Change margin to desired value
  463. console.log("Changed margin of the element.");
  464. } else {
  465. console.error("Target element to change margin was not found.");
  466. }
  467.  
  468. // Change the width of the specified element
  469. var divToChangeWidth = document.querySelector('#main > form:nth-child(5) > div > div:nth-child(4) > div:nth-child(1) > div');
  470. if (divToChangeWidth) {
  471. divToChangeWidth.style.setProperty('width', '100%', 'important'); // Change margin to desired value
  472. console.log("Changed margin of the element.");
  473. } else {
  474. console.error("Target element to change margin was not found.");
  475. }
  476.  
  477. // Change the width of the specified element
  478. var divToChangeWidthInput = document.querySelector('#main > form:nth-child(5) > div > div:nth-child(4) > div:nth-child(1) > div > input');
  479. if (divToChangeWidthInput) {
  480. divToChangeWidthInput.style.setProperty('width', '75%', 'important'); // Change margin to desired value
  481. divToChangeWidthInput.style.setProperty('float', 'right', 'important'); // Change margin to desired value
  482. console.log("Changed margin of the element.");
  483. } else {
  484. console.error("Target element to change margin was not found.");
  485. }
  486.  
  487. var spanToChangeFloat = document.querySelector('#main > form:nth-child(5) > div > div:nth-child(4) > div:nth-child(1) > div > span.fr.gray');
  488. if (spanToChangeFloat) {
  489. spanToChangeFloat.style.setProperty('float', 'left', 'important'); // Change margin to desired value
  490. console.log("Changed margin of the element.");
  491. } else {
  492. console.error("Target element to change margin was not found.");
  493. }
  494.  
  495. // Combine styles for #editor-tab and #editor-tool
  496. var editorElements = ['#editor-tab', '#editor-tool',
  497. '#editor-button > div:nth-child(3) > div'];
  498. editorElements.forEach(function(selector) {
  499. var element = document.querySelector(selector);
  500. if (element) {
  501. element.style.setProperty('font-size', '16px', 'important');
  502. // element.style.setProperty('height', '150%', 'important');
  503. } else {
  504. console.error(`Element with selector ${selector} was not found.`);
  505. }
  506. });
  507. var editorFooterElements = ['#main > form:nth-child(5) > div > table:nth-child(9) > tbody > tr:nth-child(2) > th > div > div', '#post-option > div > div'];
  508. editorFooterElements.forEach(function(selector) {
  509. var element = document.querySelector(selector);
  510. if (element) {
  511. element.style.setProperty('margin-left', '0px', 'important');
  512. } else {
  513. console.error(`Element with selector ${selector} was not found.`);
  514. }
  515. });
  516.  
  517. var inputElements = document.querySelectorAll('textarea, input, select');
  518. inputElements.forEach(function(input) {
  519. if (input) {
  520. input.style.setProperty('font', '30px Arial', 'important');
  521. }
  522. });
  523.  
  524. var ChangePtypeWidth = document.querySelector('#main > form:nth-child(5) > div > div:nth-child(4) > div:nth-child(1) > div > span.fr.gray > select');
  525. if (ChangePtypeWidth) {
  526. ChangePtypeWidth.style.setProperty('width', 'auto', 'important');
  527. }
  528.  
  529. // Change width of <td> elements with width 25% to 33%, under .tr3 class
  530. var tdElements = document.querySelectorAll('.tr3 td[width="25%"]');
  531. tdElements.forEach(function(td) {
  532. td.style.setProperty('width', '33%', 'important'); // Change width to 33%
  533. var col2 = td.querySelector('table > tbody > tr > td:nth-child(2)');
  534. if (col2) {
  535. col2.style.setProperty('border', '0px', 'important');
  536. col2.style.setProperty('background', 'none', 'important');
  537. }
  538. var col1 = td.querySelector('table > tbody > tr > td:nth-child(1)');
  539. if (col1) {
  540. col1.style.setProperty('display', 'none', 'important');
  541. }
  542. });
  543. // remove the last column in headline
  544. var headlineElements = ['#main > div.t > table > tbody > tr.tr3.tac.h > td[width="25%"]:nth-child(4)',
  545. '#main > div.t > table > tbody > tr:nth-child(2) > td[width="25%"]:nth-child(4)'
  546. ];
  547. headlineElements.forEach(function(selector) {
  548. var element = document.querySelector(selector);
  549. if (element) {
  550. element.style.setProperty('display', 'none', 'important');
  551. }
  552. });
  553.  
  554. // var ItoRemove = document.querySelectorAll('#breadcrumbs .crumbs-item i');
  555. // ItoRemove.forEach(function(i) {
  556. // i.style.setProperty('display', 'none', 'important');
  557. // });
  558.  
  559. // Tr to be removed
  560. var trToRemove = ['#cate_info > tr:nth-child(1)', '#cate_info > tr:nth-child(2)',
  561. '#cate_info > tr:nth-child(3)', '#cate_info > tr:nth-child(4)'
  562. ];
  563. trToRemove.forEach(function(selector) {
  564. var element = document.querySelector(selector);
  565. if (element) {
  566. element.style.setProperty('display', 'none', 'important');
  567. }
  568. });
  569.  
  570. // change height of #ajaxtable > tbody:nth-child(1) > tr > th
  571. var thHeight = document.querySelectorAll('#ajaxtable > tbody > tr > th');
  572. thHeight.forEach(function(th) {
  573. th.style.setProperty('font-size', '24px', 'important');
  574. });
  575.  
  576. }
  577.  
  578. // Create and append style element
  579. var style = document.createElement('style');
  580. style.textContent = customCSS;
  581. document.head.appendChild(style);
  582.  
  583. // add font awesome
  584. addStylesheet('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css');
  585. // add progress bar
  586. addProgressBar();
  587.  
  588. // Apply styles immediately
  589. applyStyles();
  590.  
  591. // Apply styles to dynamically loaded content
  592. var observer = new MutationObserver(function(mutations) {
  593. applyStyles();
  594. });
  595. observer.observe(document.body, { childList: true, subtree: true });
  596. observer.disconnect();
  597.  
  598. // just in case some contents are not loaded
  599. document.addEventListener('DOMContentLoaded', function() {
  600. applyStyles();
  601. });
  602.  
  603. // Force a repaint
  604. document.body.style.display='none';
  605. document.body.offsetHeight;
  606. document.body.style.display='';
  607.  
  608. })();