Timvision Enhanced

Aggiunge scorciatoie simili a quelle di Youtube a timvision.it

Cài đặt script này?
Script được tác giả gợi ý

Bạn có thế thích Repubblica - Enhanced video player

Cài đặt script này

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

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

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.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

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           Timvision Enhanced
// @name:it        Timvision Enhanced
// @namespace      http://cosoleto.free.fr/
// @version        0.3
// @description    Aggiunge scorciatoie simili a quelle di Youtube a timvision.it
// @description:it Aggiunge scorciatoie simili a quelle di Youtube a timvision.it
// @author         Francesco Cosoleto
// @match        http*://www.timvision.it/*
// @exclude      http*://www.timvision.it/profile
// @exclude      http*://www.timvision.it/promo
// @exclude      http*://www.timvision.it/support
// @grant        none
// ==/UserScript==

var statusbar;

function isFullscreen() {return document.fullscreen || document.webkitIsFullScreen || document.mozFullScreen || false;}

function toggleFullscreen() {

    if (isFullscreen()) {
        document.exitFullscreen();
    } else {
        var fsbut = document.getElementsByClassName("fullscreen-button");
        if (fsbut) { fsbut[0].firstElementChild.click();}
        //vid.requestFullscreen();
    }
}

function keydown(e) {

    if (!(document.activeElement.tagName === "BODY" || document.activeElement.tagName === "VIDEO" || document.activeElement.tagName === "DIV")) {
        return;}

    var vid = document.getElementById("videoPlayer");

    if (!vid) {
        return;
    }

    var bottom_ctrl = document.getElementsByClassName("bottom-controls");
    if (bottom_ctrl) {
        bottom_ctrl[0].appendChild(statusbar);
    }
    statusbar.innerHTML = '';
    if (keydown.timeout) {
        clearTimeout(keydown.timeout);
    }

    if (!e.ctrlKey && !e.altKey) {
        switch (e.key) {
            case 'f':
            case 'F':
                toggleFullscreen();
                e.preventDefault();
                break;
            case 'k':
            case 'K':
                if (vid.paused) {
                    vid.play();
                } else {
                    vid.pause();
                }
                e.preventDefault();
                break;
            case 'm':
            case 'M':
                vid.muted = !vid.muted;
                e.preventDefault();
                break;
            case '1':
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
                vid.currentTime = e.key/10 * vid.duration;
                e.preventDefault();
                break;
            case 'j':
                vid.currentTime -= 10;
                e.preventDefault();
                break;
            case 'l':
                vid.currentTime += 10;
                e.preventDefault();
                break;
        }
        switch (e.keyCode) {
            case 35:
                // end video
                vid.currentTime = vid.duration;
                break;
            case 36:
                // restart video
                vid.currentTime = 0;
                break;
            case 37:
                // seek backward
                vid.currentTime -=5;
                break;
            case 39:
                // seek forward
                vid.currentTime +=5;
                break;
                // ,
            case 188:
                vid.playbackRate -= 0.1;
                statusbar.innerText = "Velocità: " + vid.playbackRate.toFixed(1);
                vid.parentNode.classList.remove("hide-controls");
                e.preventDefault();
                break;
                // .
            case 190:
                vid.playbackRate += 0.1;
                statusbar.innerText = "Velocità: " + vid.playbackRate.toFixed(1);
                vid.parentNode.classList.remove("hide-controls");
                e.preventDefault();
                break;
        }
    }
    keydown.timeout = setTimeout(function(){statusbar.innerHTML = ''}, 5000);
}

(function() {
    'use strict';

    statusbar = document.createElement('div');
    statusbar.setAttribute('style', "paddingLeft: 10px;");

    window.addEventListener("keydown", keydown, false);
})();