E-H MiniMenu

Simplifies the navigation menu.

目前為 2019-04-10 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        E-H MiniMenu
// @description Simplifies the navigation menu.
// @author      Hen Tie
// @homepage    https://hen-tie.tumblr.com/
// @namespace   https://greasyfork.org/en/users/8336
// @include    	/https:\/\/(.*\.)?(ex|e-)hentai\.org.*/
// @require     https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js
// @icon        https://i.imgur.com/pMMVGRx.png
// @version     2.0
// ==/UserScript==

/*════════════════════════════════╦═══════════════════════════════════╗
║          CONFIGURATION          ║          ALL NAV ITEMS            ║
╠═════════════════════════════════╬═══════════════════════════════════╣
║ "var = miniMenuItems" is a list ║ Bounties    Favorites    Forums   ║
║ of the nav items you want to    ║ Front Page  HentaiVerse  My Home  ║
║ have moved under the menu.      ║ My Tags     My Uploads   News     ║
║ Case sensitive.                 ║ Popular     Settings     Toplists ║
║                                 ║ Torrents    Watched      Wiki     ║
╚═════════════════════════════════╩══════════════════════════════════*/
var miniMenuItems = ['Torrents', 'News', 'Forums', 'Wiki', 'HentaiVerse'];
/*═══════════════════════════════════════════════════════════════════*/

var oldNav = $('#nb');
oldNav.prepend('<ul class="nav-menu"><li class="nav-menu-item"><a href="https://e-hentai.org/">Menu</a><ul class="nav-submenu"></ul></li></ul>');
miniMenuItems.forEach(function(i) {
	var item = oldNav.find('a:contains("'+i+'")');
	item.parent().remove();
	item.appendTo('.nav-submenu').wrap('<li class="nav-submenu-item"></li>');
});

$(`<style type="text/css" data-jqstyle="ehMiniMenu">
/* old nav */
#nb:hover {
	max-height: unset;
}
#nb {
	overflow: visible;
	max-height: unset;
	justify-content: center;
}
/* old nav items */
#nb>div {
	padding: 0 10px;
	background: none;
}
/* nav item aliases */
.nav-menu-item .nbw1 {
	display: inline;
}
/* menu */
.nav-menu {
	display: inline;
	padding: 0 10px 0 0;
	text-align: left;
	white-space: nowrap;
	margin: 0;
}
.nav-menu-item {
	display: inline-block;
	position: relative;
	z-index: 999;
    background-image: url(https://ehgt.org/g/mr.gif);
    background-repeat: no-repeat;
    background-position: left center;
    padding-left: 7px;
}
/* submenu */
.nav-submenu {
	display: none;
	padding: .5em;
	background: #f2efde;
	border: 2px solid #b5a3a4;
	border-radius: 3px;
	transform: translateX(-50%);
	left: 50%;
	position: absolute;
}
.nav-submenu-item {
	display: block;
	line-height: 1.3;
}
/* hover */
.nav-submenu-item:hover {
	background-color: none;
}
.nav-menu-item:hover .nav-submenu {
	display: block;
}
.nav-submenu::before {
	content: "";
	display: block;
	position: absolute;
	top: -5px;
	left: -8px;
	width: 100%;
	height: 100%;
	z-index: -1;
	padding: 8px;
}
</style>`).appendTo('head');

if (window.location.href.indexOf("exhentai") > -1) {
	$('.nav-menu-item a').prop('href','https://exhentai.org/');
	$('style[data-jqstyle="ehMiniMenu"]').append(
		'/* exhentai only */\n'+
		'.nav-submenu {\n'+
		'  background: #34353b;\n'+
		'  border: 2px solid #8d8d8d;\n'+
		'}');
}