Anime intro skip

Press 'L' to skip the intro when it starts. You can press the minus/dash key on the number row of your keyboard to change settings. Keycodes can be found at keycode.info . Based off of https://greasyfork.org/en/scripts/30776-kissanime-skip-videos-90-seconds-skip-intro

目前為 2018-07-24 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name Anime intro skip
// @description Press 'L' to skip the intro when it starts. You can press the minus/dash key on the number row of your keyboard to change settings. Keycodes can be found at keycode.info . Based off of https://greasyfork.org/en/scripts/30776-kissanime-skip-videos-90-seconds-skip-intro
// @namespace http://tampermonkey.net/
// @grant GM_setValue
// @grant GM_getValue
// @require https://greasyfork.org/scripts/370520-super-gm-set-and-get/code/Super%20GM%20set%20and%20get.js?version=614650
// @require http://code.jquery.com/jquery-1.7.1.min.js
// @include *rapidvideo.com*
// @include *mp4upload.com*
// @include *streamango.com*
// @include *vidstreaming.io*
// @include *kissanime.ru/Anime/*
// @version 1.0.0
// ==/UserScript==
$(document).ready(function(){
    let time = GM_SuperValue.get("skipTime", 85); // 1:25 just in case you're a little bit farther away from your keyboard :)
    let key = GM_SuperValue.get("keyCode", 76); // Key used to skip time
    let setkey = GM_SuperValue.get("settingkeyCode", 189); // Key used to change settings
    let changeSettings = function(){
        let timehold = time;
        let keyhold = key;
        time = prompt("How many seconds should we skip?", time);
        if(!time){
            time = timehold;
        }
        GM_SuperValue.set("skipTime", time);
        key = prompt("Keycode for skipping time (go to keycode.info for keycodes).", key);
        if(!key){
            key = keyhold;
        }
        GM_SuperValue.set("keyCode", key);
    };
    let url = document.URL;
    if (typeof jwplayer === 'function' && url.indexOf('kissanime.ru') == -1){
        let callback = function(e){
            if (e.which == key){
                jwplayer().seek(jwplayer().getPosition()+parseInt(time));
            }
            if (e.which == setkey){
                changeSettings();
            }
        };
        window.addEventListener('keydown', callback);
    }else{
        if (typeof videojs === 'function') {
            let vids;
            let player;
            if(url.indexOf('kissanime.ru') > -1){
                vids = document.getElementsByTagName('video');
                if(vids.length > 0){
                    player = videojs(vids[0]);
                }
            }else{
                vids = videojs.getPlayers();
                player = vids[Object.keys(vids)[0]];
            }
            let callback = function(e){
                if (e.which == key){
                    player.currentTime(player.currentTime()+parseInt(time));
                }else
                if (e.which == setkey){
                    changeSettings();
                }
            };
            player.ready(function(){
                window.addEventListener('keydown', callback);
            });
        }
    }
});