Myself-bbs.com HTML5 Player

HTML5 Player for 云端

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Myself-bbs.com HTML5 Player
// @namespace    http://myself-bbs.com/
// @version      0.7
// @description  HTML5 Player for 云端
// @author       Deloz
// @match        http://*.myself-bbs.com/*
// @match        http://myself-bbs.com/*
// @grant        none
// ==/UserScript==

(function($) {
    'use strict';
    $(function() {
        var  getUrlVars = function(url){
            var vars = [], hash;
            var hashes = url.slice(url.indexOf('?') + 1).split('&');
            for(var i = 0; i < hashes.length; i++)
            {
                hash = hashes[i].split('=');
                vars.push(hash[0]);
                vars[hash[0]] = hash[1];
            }
            return vars;
        };
        var getUrlVar = function(url, name){
            return  getUrlVars(url)[name];
        };
        var videoList = $('.various.google');
        videoList.each(function() {
            var self = $(this);
            if (self) {
                self.fancybox({live: false});
                self.off("click.fb-start");
                self.off('click');
            }
        });
        videoList.click(function(e) {
            e.preventDefault();
            var self = $(this);
            var url = self.data('href');
            var docId = getUrlVar(url, 'docid');
            var videoUrl = (docId === undefined ? url.replace('/preview', '/view') : 'https://docs.google.com/file/d/'+docId+'/view');
            window.open(videoUrl, '_blank');
        });
    });
})(jQuery);