KAT Headers Unified

Unifies and improves the headers of both the community and torrent sections of the site. (and makes community pages full width)

目前為 2018-08-21 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         KAT Headers Unified
// @namespace    NotNeo
// @version      0.2
// @description  Unifies and improves the headers of both the community and torrent sections of the site. (and makes community pages full width)
// @author       NotNeo
// @match        https://katcr.co/show/community/*
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// @grant        none
// ==/UserScript==

var headerShrunkByDefault = "remember"; //yes,no,remember

addGlobalStyle(`
	#wrapper {
		max-width: 100% !important;
	}

	#header {
		padding-left: 5px;
		position: fixed;
		width: 100%;
		z-index: 100;
	}

	#content_section {
		padding-top: 65px;
	}

	#header div.frame {
		padding-right: 5px;
	}

	#top_section > .forumtitle {
		margin-right: -55px;
	}

	#top_section {
		min-height: 0px;
	}

	#header > .frame > div:last-of-type, #header > .frame > br.clear {
		display: none;
	}

	#menu_nav > li > ul {
		position: fixed;
		border: solid #333 2px;
		width: -moz-min-content;
		width: -webkit-min-content;
	}

	#search_form  .input_text {
		max-width: calc(100% - 1350px) !important;
		min-width: 200px;
	}
`);

function addGlobalStyle(css) {
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) { return; }
    style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = css;
    head.appendChild(style);
}

function CalcContentPad() {
    if($("#upshrink").attr("src").split("images/")[1] == "upshrink.png")
        $("#content_section").prop("style", "padding-top: 165px;");
    else
        $("#content_section").prop("style", "padding-top: 65px;");
}

$("#siteslogan").detach().appendTo('#upper_section');
$("#main_menu").parent().detach().appendTo("#top_section");

if(headerShrunkByDefault != "remember") { //if header shrink is "remember", let the site handle it...
    var imgSrc = $("#upshrink").attr("src").split("images/")[1]; //...else get current state
    if((headerShrunkByDefault == "yes" && imgSrc == "upshrink.png") || (headerShrunkByDefault == "no" && imgSrc == "upshrink2.png")) //...and if the state is wrong...
        $("#upshrink").click(); //...change it
}

CalcContentPad();
$("#upshrink").click(CalcContentPad);