seer007100
本帖最后由 seer007100 于 2021-3-8 23:00 编辑

當我剛使用論壇新版介面是,我第一件發現的事就是帖子在寬螢幕裝置上太小了。假如你有同樣的困擾,可以使用這個我開發的 UserScript 來令帖子的寬度設定成與導航列相同。

螢幕截圖




下載

你可以到 Greasy Fork 下載:點我前往

原始碼

  1. // ==UserScript==
  2. // @name               MCBBS New Layout: Forum Post Width Improvement
  3. // @description        Widen the post width in the new MCBBS layout, thus improve the user experience of wide-screen device users.
  4. // @name:zh-TW         MCBBS 新版介面帖子寬度修正
  5. // @description:zh-TW  修正 MCBBS 新版介面中帖子的寬度,以使寬螢幕的用戶能夠獲得更佳的使用體驗。
  6. // @license            AGPL-3.0-or-later
  7. // @author             Jason Kwok
  8. // @namespace          https://jasonhk.dev/
  9. // @version            0.1.2
  10. // @match              http*://www.mcbbs.net/*
  11. // @run-at             document-end
  12. // @grant              none
  13. // @updateURL          https://greasyfork.org/scripts/422875/code/422875.meta.js
  14. // @downloadURL        https://greasyfork.org/scripts/422875/code/422875.user.js
  15. // @supportURL         https://greasyfork.org/scripts/422875/feedback
  16. // ==/UserScript==

  17. /* global cookiepre */

  18. if (!isMobileVersion() && isNewLayoutEnabled())
  19. {
  20.     const main = document.querySelector(".p-body-main");
  21.     if ((main instanceof HTMLElement) && (main.querySelector("#postlist") !== null))
  22.     {
  23.         main.style.maxWidth = "100%";
  24.     }
  25. }

  26. function getCookies()
  27. {
  28.     return new Map(document.cookie.split("; ").map((pair) => (pair.includes("=") ? pair.split("=") : ["", pair])));
  29. }

  30. function isNewLayoutEnabled()
  31. {
  32.     if (typeof cookiepre !== "string") { return false; }
  33.     return (getCookies().get(`${ cookiepre }use_newTemplate`) === "1");
  34. }

  35. function isMobileVersion()
  36. {
  37.     return Array.prototype.some.call(document.documentElement.classList, (className) => className.startsWith("pixel-ratio-"));
  38. }
复制代码

seer007100
@AzureZeng 技術性作品使用回覆可見應該沒有違規吧?


Wudji
建议参考mcbbs extender发到软件版去

ig_111y
哇哦   这就是dalao吗

seer007100
Wudji 发表于 2021-3-8 22:57
建议参考mcbbs extender发到软件版去

現在可能太簡單了,假如之後功能再多一點也許會發佈到軟件版。

第一页 上一页 下一页 最后一页