Greasy Fork is available in English.

Gendou.com - Sub-Forums Menu

Add new menu for easy navigating between sub-forums

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 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           Gendou.com - Sub-Forums Menu
// @namespace      http://loucypher.wordpress.com/
// @include        http://gendou.com/*
// @include        http://animesheep.com/*
// @description    Add new menu for easy navigating between sub-forums
// @version 0.0.1.20140630034959
// ==/UserScript==

(function() { 
  var ID = [8, 1, 11, 4, 10, 5, 7, 12, 15, 13, 2, 3, 14, 6];
  var topics = ["Help", "Anime", "Game", "Music", "Report Problems",
    "\u65e5\u672c\u8a9e", "Japan", "Introduce Yourself", "Philosophy",
    "Gendou City", "Physics", "Programming", "Waste of Time", "Other"]

  var XPath = "//div[@id='navPanel']/ul[@class='navHorizontal']" + 
              "/li/a[contains(@href, '/forum/search.php')]/parent::li";
  var forumMenu = document.evaluate(XPath, document, null, 9, null)
                          .singleNodeValue;
  if (!forumMenu) return;

  var forumLink = addLink("http://gendou.com/forum/", "Sub-Forums");
  var newMenu = insertMenu(forumMenu.nextSibling, forumLink);
  var newSubMenu = addSubMenu(newMenu);

  var link, menu;
  for (var i in ID) {
    link = addLink("http://gendou.com/forum/topic.php?top=" + ID[i], topics[i]);
    link.style.display = "block";
    if (location == link.href) {
      link.style.fontWeight = "bold";
      link.style.color = "white";
      link.title = "You are here!";
    }
    menu = addMenu(newSubMenu, link);
  }

  function insertMenu(aNode, aChild) {
    var mi = aNode.parentNode.insertBefore(document.createElement("li"),
                                           aNode);
    mi.appendChild(aChild);
    return mi;
  }

  function addSubMenu(aNode) {
    var mp = aNode.appendChild(document.createElement("ul"));
    mp.className = "navVertical";
    return mp;
  }

  function addMenu(aNode, aChild) {
    var mi = aNode.appendChild(document.createElement("li"));
    mi.appendChild(aChild);
    return mi;
  }

  function addLink(aURL, aText) {
    var lnk = document.createElement("a");
    lnk.href = aURL;
    lnk.textContent = aText;
    return lnk;
  }
})();