StreamCloud Enhancer

Prepares video for playback and enables download.

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name        StreamCloud Enhancer
// @namespace   schwarztee
// @description Prepares video for playback and enables download.
// @include     *streamcloud.eu/*
// @copyright   2015, schwarztee
// @license     MIT
// @version     0.1.1
// @grant       none
// ==/UserScript==


// jQuery ist auf streamcloud.eu verfügbar und kann genutzt werden
(function($){
    
    // Warteseite?
    if ( document.getElementById( 'login' ) )
    {
        var submitForm = function submitForm()
        {
            // Event-Handler entfernen, der Absenden des Formulars verhindert
            $(document).off( 'submit', 'form.proform' );
            
            // Formular absenden
            $( 'form.proform' ).submit();
        };
        
        // 11 Sekunden warten (unvermeidbar, wird serverseitig kontrolliert)
        setTimeout( submitForm, 11000 );
    }
    
    // Videoseite?
    if ( typeof jwplayer != 'undefined' )
    {
        // Referenz auf Player zurechtlegen
        var player = jwplayer( 'mediaplayer' );
        
        // Button-Reihe in Titelleiste anvisieren
        var buttonList = $( '#page .header ul' );
        
        // neuen Download-Link erzeugen
        var link = $( '<a>' )
        .attr( 'href', player.config.file )
        .html( "Download" )
        .attr( 'title', "Direktlink zum Video" );
        
        // Link in Listenelement einpacken
        var element = $( '<li>' )
        .html( link )
        .addClass( 'active' );
        
        // falschen Download-Button entfernen und neuen Button hinzufügen
        buttonList.find( 'li:last-child' ).remove();
        buttonList.append( element );
        
        // erstmaliges Anhalten?
        var initialPause = true;
        
        // Wiedergabe anhalten, sobald bereit zum Abspielen
        player.onPlay( function pauseOnce()
        {
            // pausieren
            initialPause && player.pause(true);
            
            // fertig
            initialPause = false;
        });
        
        // Laden des Videos starten
        player.play();
    }

})(jQuery);