Popup Video Player for tirkx.com

enter something useful

目前為 2015-10-17 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Popup Video Player for tirkx.com
// @namespace    http://your.homepage/
// @version      0.2
// @description  enter something useful
// @author       Soginal
// @match        http://*.tirkx.com/main/showthread.php?*
// @grant        none
// @local        en
// ==/UserScript==
var process = function(){
    $('head').append('<script src="https://releases.flowplayer.org/6.0.3/flowplayer.min.js"></script>');
    $('head').append('<link rel="stylesheet" type="text/css" href="https://releases.flowplayer.org/6.0.3/skin/minimalist.css">');
    $(document.body).on('click', '.dl_chapter a',function(e){
        if (e.ctrlKey || e.altKey || e.shiftKey) return;
        closeVideo();
        var html = '<div style="z-index:1000000;position:fixed;left:0px; top:0px;width:800px;background-color:black;padding-left:10px;padding-right:10px;padding-bottom:35px;boxing-size:border-box;">' +
            '<div style="position:relative;font-size:20px;color:white;padding:3px;height:20px;"><span style="font-size:12px;display:inline-block;margin-top:4px;">' + $(this).text() + '</span>' +
            '<div style="position:absolute;right:6px;top:1px;cursor:pointer;font-weight:bolder;" onclick="closeVideo()">X</div> </div>' +
            '<div id="videoplayer" class="flowplayer fixed-controls" data-ratio="0.4167"></div>' +
            '</div>'
        var div = $(html);
        window.videoElement = div;
        div.css({
            left: $(document).width()/2-div.width()/2,
            top: 50
        });
        $(document.body).append(div);
        window.player = flowplayer("#videoplayer", {
            autoplay: true,
            //ratio: 5/12,
            mouseoutTimeout: 2000,
            clip: {
                sources: [
                    { type: "video/webm",  src: $(this).attr('href')  },
                    { type: "video/mp4",  src: $(this).attr('href')  },
                    
                ]
            },
            embed: {
                skin: "//releases.flowplayer.org/6.0.3/skin/minimalist.css"
            }
        });
        div.find('.fp-embed').hide();
        div.find('.fp-fullscreen').css({top:-26, right:30, height:20});
        return false;
    });
};

window.closeVideo = function(){
    
    if (window.player){
        player.stop();
        player.shutdown();
    }
    if (window.videoElement) {
        var video = videoElement.find('video').attr('src', '');
        video[0].load();
        videoElement.remove();
    }
    window.videoElement = null;
    window.player = null;
}

$(document).ready(process);