Greasy Fork

Greasy Fork is available in English.

icourse Downloader

get urls of video courses and copy to clipboard

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name          icourse Downloader
// @namespace
// @description   get urls of video courses and copy to clipboard
// @include       https://www.icourse163.org/learn/*
// @version       0.9.0
// @version 0.0.1.20180405103144
// @namespace http://greasyfork.icu/users/38547
// ==/UserScript==
(function () {
    'use strict';
	create_button();
	function btn_onclick(){
		var img_addr = document.getElementsByTagName("source")[0].src;
		if (img_addr){
			var patt1 = /http.*(?=\?)/;
            var res = img_addr.match(patt1);
            var obj = document.getElementById("down_video_url");
            obj.value = res;
            obj.type ="";
            obj.select();
            document.execCommand('copy');
            obj.type = "hidden";
            alert('复制完成!');
		}
		else {
			alert("none!");
		}
	}

	function create_button(){
        var ul_tag = document.getElementsByClassName('f-cb')[2];
        var btn = document.createElement("div");
        var t = document.createTextNode("Download");
        btn.appendChild(t);
        btn.style="background-color: green; border: 2px solid green; border-radius: 2px; color: white; padding: 0px 15px; font-size: 14px; cursor: pointer; height: 21px; margin-left: 7px; margin-top: opx; line-height: 21px; font-weight: 500; display: inline-block;";
        btn.setAttribute('id','down_video_btn');
        btn.onclick = btn_onclick;
        ul_tag.appendChild(btn);
        //create input form
        var input1 = document.createElement("input");
        input1.id ="down_video_url";
        input1.value="";
        input1.type="hidden";
        ul_tag.appendChild(input1);
    }


  })();