KissAnime Video at the Top (and always visible)

Move video to the top of the page. Keep video visible when scrolling down to see comments. Auto show comments.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         KissAnime Video at the Top (and always visible)
// @namespace    superschwul
// @version      5.0
// @description  Move video to the top of the page. Keep video visible when scrolling down to see comments. Auto show comments.
// @homepageURL  https://greasyfork.org/en/scripts/39294-kissanime-video-at-the-top-and-always-visible
// @author       Superschwul
// @match        http://kissanime.ru/Anime/*
// @match        https://kissanime.ru/Anime/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var body = document.getElementsByTagName('body')[0];
    var navContainer = document.getElementsByClassName('barContent')[0];
    if(navContainer == null) {
        throw '';
    }
    var nav = navContainer.children[0].children[0];
    var videoContainer = document.createElement('div');
    var video = document.getElementById('centerDivVideo');

    nav.id = 'episodeNav';
    videoContainer.id = 'videoContainer';
    body.insertBefore(videoContainer, body.firstChild);
    videoContainer.appendChild(video);
    body.insertBefore(nav, body.firstChild);

    var style = document.createElement('style');
    style.innerHTML = `
        body {
            width: 100vw;
            overflow-x: hidden;
        }
        #episodeNav {
            height: 30px;
        }
        #videoContainer {
            height: 70vh;
            margin-bottom: 20px;
        }
        #centerDivVideo {
            width: auto !important;
            height: auto !important;
            display: block !important;
            z-index: 90;
        }
        #divContentVideo {
            width: auto !important;
            height: auto !important;
        }
        #divContentVideo iframe,
        #divContentVideo #my_video_1 {
            width: 700px !important;
            height: 70vh !important;
            display: block;
            margin: 0 auto;
        }
        #divComments {
            width: 46vw !important;
            margin: 0 0 0 2vw !important;
        }
        #divComments > div:first-child {
            width: 94% !important;
        }

        body.fixed #centerDivVideo {
            position: fixed !important;
            right: 2vw;
            top: 2vw;
            width: 46vw !important;
        }
        body.fixed #divContentVideo {
            width: 100% !important;
            height: 76vh !important;
        }
        body.fixed #divMyVideo {
            height: 100%;
        }
        body.fixed #divContentVideo iframe ,
        body.fixed #divContentVideo #my_video_1 {
            width: 100% !important;
            height: 100% !important;
        }
    `;
    document.getElementsByTagName('head')[0].appendChild(style);

    var runOnScroll = function(ev) {
        document.body.className = '';
        if(window.pageYOffset > 380) {
            document.body.className = 'fixed';
        }
    };
    window.addEventListener('scroll', runOnScroll);

    document.getElementById('btnShowComments').click();

})();