Better Unity Forums

Fixes a lot of the issues people have with the new forum style

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name        Better Unity Forums
// @namespace   BUF
// @description Fixes a lot of the issues people have with the new forum style
// @include     https://community.unity.com/*
// @version     1.3
// @grant       GM_addStyle
// @run-at      document-end
// ==/UserScript==

const d = ((typeof unsafeWindow === "object") ? unsafeWindow : window).document;

function xpath(doc, query) {
  return doc.evaluate(query, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
}

function replacement(){
  var avatars = xpath(d,"//div[contains(@class,'author')]//a[contains(@class,'UserAvatar')]/img[contains(@src,'/38x38/') or contains(@src,'avatar-display-size/message/')]");

	for(var i=0;i<avatars.snapshotLength;i++){
		avatars.snapshotItem(i).src = avatars.snapshotItem(i).src.replace('/38x38/','/96x96/');
		avatars.snapshotItem(i).src = avatars.snapshotItem(i).src.replace('avatar-display-size/message/','avatar-display-size/profile/');
	}
	
	var leftcols = xpath(d,"//div[contains(@class,'lia-quilt-layout-two-column-message')]/div[contains(@class,'lia-quilt-row-main')]/div[contains(@class,'lia-quilt-column-04')]");
	for(var i=0;i<leftcols.snapshotLength;i++){
		leftcols.snapshotItem(i).className = leftcols.snapshotItem(i).className.replace('column-04','column-03');
	}
	
	var rightcols = xpath(d,"//div[contains(@class,'lia-quilt-layout-two-column-message')]/div[contains(@class,'lia-quilt-row-main')]/div[contains(@class,'lia-quilt-column-18')]");
	for(var i=0;i<rightcols.snapshotLength;i++){
		rightcols.snapshotItem(i).className = rightcols.snapshotItem(i).className.replace('column-18','column-21');
	}
	GM_addStyle(".fancy-select ul li { list-style: none !important; display: none !important;}");
	GM_addStyle(".lia-quilt-layout-two-column-message > .lia-quilt-row-footer > .lia-quilt-column-right { width: 100% !important;}");
	GM_addStyle(".lia-message-body-content li {font-size : 14px !important;}");
	GM_addStyle(".lia-quilt-layout-two-column-message > .lia-quilt-row-main > div {margin-bottom: 15px !important;}");
	GM_addStyle(".lia-message-body-content > pre { font-size: medium !important;}");
	GM_addStyle(".lia-quilt-row-header { padding: 15px 40px 0px 40px !important;}");
	GM_addStyle(".lia-message-author-username {display:block !important} .lia-message-author-avatar .UserAvatar > img {min-width:96px !important; height: 96px !important; border-radius: 2px !important;}");
}

replacement();