☰

F95 Side Menu Upgrade

Improves side menu.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        F95 Side Menu Upgrade
// @namespace   1330126-edexal
// @match       *://f95zone.to/*
// @grant       none
// @icon        https://external-content.duckduckgo.com/ip3/f95zone.to.ico
// @license     Unlicense
// @version     1.0.0
// @author      Edexal
// @description Improves side menu.
// @homepageURL https://sleazyfork.org/en/scripts/546346-f95-mobile-upgrade
// @supportURL  https://github.com/Edexaal/scripts/issues
// @require     https://cdn.jsdelivr.net/gh/Edexaal/scripts@2f4f36215375a30485901a0374cb58a78412ddf3/_lib/utility.js
// @require     https://cdn.jsdelivr.net/gh/Edexaal/scripts@2f4f36215375a30485901a0374cb58a78412ddf3/_lib/css.js
// ==/UserScript==
(() => {
  const BOOKMARK_LABEL = 'Bookmarks';
  Edexal.addCSS(`
  .uix_sidebarNav a.p-navEl-link:not(.mdi):not(.fa)[data-nav-id="${BOOKMARK_LABEL}"]::before {
    content: "\\f02e";
  }
  .uix_sidebarNav ul li a[data-nav-id="${BOOKMARK_LABEL}"] {
    color: ${EdexalCSS.secTxtColor} !important;
  }`);
  const EL = {sideMenu: '.uix_sidebarNav ul'};
  
  function createSideMenuBM(latestUpdateList) {
    const bookmarkList = latestUpdateList.cloneNode(true);
    const a = bookmarkList.querySelector('a');
    a.href = `${location.origin}/watched/threads?tab=bookmarks`;
    a.dataset.navId = BOOKMARK_LABEL;
    const span = a.querySelector('span');
    span.textContent = BOOKMARK_LABEL;
    return bookmarkList;
  }
  
  function upgradeSideMenu() {
    const sideMenu = Edexal.$(EL.sideMenu);
    if (!sideMenu) return;
    const latestUpdate = sideMenu.querySelector('li a[data-nav-id="LatestUpdates"]');
    if (!latestUpdate) return;
    const latestUpdateList = latestUpdate.parentElement.parentElement.parentElement;
    const bookmarkList = createSideMenuBM(latestUpdateList);
    sideMenu.prepend(latestUpdateList);
    sideMenu.prepend(bookmarkList);
  }
  
  upgradeSideMenu();
})();