SkipperScript

It should be able to skip and autoskip intos

La data de 24-06-2019. Vezi ultima versiune.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         SkipperScript
// @version      0.1
// @match        ://stream.proxer.me/*
// @description  It should be able to skip and autoskip intos
// @author       Schlauewurst
// @require      http://code.jquery.com/jquery-3.4.1.min.js
// @namespace https://greasyfork.org/users/312840
// ==/UserScript==
/*TODO
Add Database
Add compatibly to other players
Skip Flashbacks
Skip Filler
Parse all the Info from somewhere
*/

(function() {
    'use strict';
    function getCoockies(){

    }

    var createCookie = function(name, value, days=365) {
        var expires;
        if (days) {
            var date = new Date();
            date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
            expires = "; expires=" + date.toGMTString();
        }
        else {
            expires = "";
        }
        document.cookie = name + "=" + value + expires + "; path=/";
    }

    function getCookie(c_name) {
        if (document.cookie.length > 0) {
            let c_start = document.cookie.indexOf(c_name + "=");
            if (c_start != -1) {
                c_start = c_start + c_name.length + 1;
                let c_end = document.cookie.indexOf(";", c_start);
                if (c_end == -1) {
                    c_end = document.cookie.length;
                }
                return unescape(document.cookie.substring(c_start, c_end));
            }
        }
        return "";
    }

    function loadSettings(){
        if(getCookie("show") == "false"){
            $("#hidebtn").text("Show");
            $("#buttonlist").hide();
        }
        if(getCookie("autoplay") == "true"){
            $("#autoplay").find("input").prop('checked', true);
        }
        if(getCookie("skipintro") == "true"){
            $("#skipintro").find("input").first().prop('checked', true);
        }
        if(getCookie("skipoutro") == "true"){
            $("#skipoutro").find("input").first().prop('checked', true);
        }
        if (!getCookie("outrostart") == ""){
         $("#skipoutro input").eq(1).val(getCookie("outrostart"));
        }
        if (!getCookie("introstart") == ""){
            $("#skipintro input").eq(1).val(getCookie("introstart"))
        }
        if (!getCookie("introend") == ""){
            $("#skipintro input").eq(2).val(getCookie("introend"))
        }
    }

    function makeButtons(){
        $("#psplayercontrols").append(" <button id='hidebtn'>Hide</button><span id='buttonlist'>")
        $("#buttonlist").append(" | <span id='autoplay'><label for='autoplay'>Autoplay</label><input name='autoplay' type='checkbox'></input></span>");
        $("#buttonlist").append(" | <span id='skipintro'><label for='skipintro'>Skip Intro</label><input name='skipintro' type='checkbox'></input><input class='start' style='width:30px' value='0' type='text'></input><input class='end' style='width:30px' value='100' type='text'></input></span>");
        $("#buttonlist").append(" | <span id='skipoutro'><label for='skipoutro'>Skip Outro</label><input name='skipoutro' type='checkbox'></input><input style='width:30px' value='1300' type='text'</span>");
        $("#psplayercontrols").append("</span>");
    }

    function startTimer(){
        setInterval(function(){
            let skipstart = $("#skipintro input").eq(1).val(),
                skipend = $("#skipintro input").eq(2).val(),
                skip1 = $("#skipintro input").is(":checked"),
                skip2 = $("#skipoutro input").is(":checked"),
                skipoutro = $("#skipoutro input").eq(1).val();

            if(skip1 && player.currentTime > skipstart && player.currentTime < skipend){
                player.currentTime = parseInt(skipend);
            }
            if(skip2 && player.currentTime>skipoutro){
                var url = new URL(window.location.href).searchParams.get("ref");
                url = url.split("/")
                window.top.location.href="https://proxer.me/watch/"+url[2]+"/"+(parseInt(url[3])+1)+"/"+url[4]
            }
        }, 1000);
    }

    $(document).ready(function(){
        makeButtons();
        loadSettings();

        if(player.ready && $("#autoplay").find("input").is(":checked")){
            player.play()
        }

        startTimer();

        $(document).on("click","#hidebtn",function(){
            if($(this).text()=="Hide"){
                $(this).text("Show");
                $("#buttonlist").hide();
                createCookie("show",false);
            }else{
                $(this).text("Hide");
                $("#buttonlist").show();
                createCookie("show",true);
            }
        })

        $(document).on("click","#autoplay",function(){
            let autoplay = $(this).find("input").is(":checked")
            createCookie("autoplay",autoplay);
        })

        $(document).on("click","#skipintro",function(){
            let skipintro = $(this).find("input").first().is(":checked")
            createCookie("skipintro",skipintro);
        })

        $(document).on("click","#skipoutro",function(){
            let skipoutro = $(this).find("input").first().is(":checked")
            createCookie("skipoutro",skipoutro);
        })

        $(document).on("change","#skipoutro input",function(){
            createCookie("outrostart",$(this).val());
        })

        $(document).on("change","#skipintro",function(){
            createCookie("introstart",$(this).find(".start").val());
            createCookie("introend",$(this).find(".end").val());
        })
    })

})();