i_jemin

Archive

← 아카이브로

유니티 현재 포럼 검색하기 (파이어폭스)

유니티 포럼에서 검색 페이지로 이동하면, 다음과 같이 검색할 포럼으로 전체 포럼이 항상 선택된다.

파이어폭스에서 GreaseMonkey 플러그인을 설치하고 다음 스크립트를 활성화한다. 이후 포럼의 검색 버튼을 누르면 URL에 따라 현재 포럼이 검색 대상으로 자동 선택된다.

UnityForumBoardSearchHelper.js

// ==UserScript==
// @name     Unity Forum Search : AutoSelect current board item inside Search select list (based on referrer url)
// @namespace   https://unitycoder.com
// @version  1
// @include  https://forum.unity.com/search/?type=post
// @grant    none
// ==/UserScript==
// more info https://unitycoder.com/blog/2021/05/26/unity-forums-auto-select-current-subforum-in-search-greasemonkey-script/

// get referring board url
if (document.referrer==null) return;

// cleanup ref
var ref = document.referrer;
ref = ref.replace("https://forum.unity.com/forums/","");

// find board name from url
var dotPos = ref.indexOf('.');
if (dotPos==-1) return;
ref = ref.substring(0,dotPos);

// get selection box that contains forum boards
var sel = document.getElementById("ctrl_nodes");

// loop to find match in the select items and url board name
for (var i = 0;i<sel.options.length;i++)
{
  var item = sel.options[i].text.trim();
  if (item.toLowerCase() == ref.toLowerCase())
  {
    sel.selectedIndex = i;
    break;
  }
}

https://gist.github.com/unitycoder/061b00201170399404a285175b2137dc

출처 : https://unitycoder.com/blog/2021/05/26/unity-forums-auto-select-current-subforum-in-search-greasemonkey-script/