jpdb-reviews-ui-tweak

Light rework of the JPDB review page

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name        jpdb-reviews-ui-tweak
// @version     0.0.1
// @match       *://jpdb.io/review*
// @run-at      document-start
// @description Light rework of the JPDB review page
// @license GPLv2
// @namespace https://greasyfork.org/users/888266
// ==/UserScript==

let doc = window.document;

function fixNavbar() {
    // Remove every navigation menu except the "Learn (n)"
    doc
        .querySelectorAll(".menu .nav-item:not(:first-child)")
        .forEach(element => element.remove());

    // Remove the button used to toggle the navigation menu on or off
    doc
        .querySelectorAll(".menu-icon")
        .forEach(element => element.remove());

    // Change the navigation menu maxHeight in order to be always visible
    let parent = doc
        .querySelectorAll(".menu")
        .item(0);
    parent.style.maxHeight = "30px";
    parent.style.transition = "off";

    // Tweak the navigation menu entry, removing the link and changing the message
    let entry = doc
        .querySelectorAll(".menu .nav-item")
        .item(0);

    entry.outerHTML = entry.outerHTML
        .replace(/<a/g, '<div')
        .replace(/<\/a>/g, '</div>')
        .replace("Learn", "Items left");
}

doc.addEventListener('DOMContentLoaded', () => {
    fixNavbar();
});