gamespot expose download links

gamespot video Links appear in the video description next to the social buttons.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        gamespot expose download links
// @namespace   *.gamespot.*
// @description gamespot video Links appear in the video description next to the social buttons.
// @include     *.gamespot.*
// @version     1.01
// @grant       none
// ==/UserScript==


var addLinks = function(){  
     var components = $('#kubrick-lead').html().split('{"f4m_stream":"')[1].split('.csmil')[0].replace(/\\/g, '').replace('/z/','/').replace('/hdv.','/video.').split(',')
     var base = components[0]
     var mediatype = components.slice(-1)[0] 
     var toolbar = document.querySelectorAll('.news-hdr')[0];
     
    for (var i = 1; i < components.length-1; i++) {
       var desiredLink = base + components[i] + mediatype;
       var desiredText = components[i] + " "; 
       var link=document.createElement("a");
       link.appendChild(document.createTextNode(desiredText));
       link.href = desiredLink;
       toolbar.appendChild(link);

    }
    
};

addLinks();