// ==UserScript== // @name mooc复制粘贴助手 // @namespace http://tampermonkey.net/ // @version 1.1 // @description ① 一键复制题目,便于笔记和整理。暂时不支持图片复制。② 支持视频任意倍速播放。 // @author shandianchengzi // @include https://www.icourse163.org/learn/* // @include https://www.icourse163.org/spoc/* // @icon https://th.bing.com/th/id/R9f9f4fb2f36c5ed048b033efc79e7066?rik=GuAZZSaiqjDg1Q&riu=http%3a%2f%2fpic44.photophoto.cn%2f20170714%2f1190120161596932_b.jpg&ehk=u%2f%2bTv7aLkHAaytp6GaZW%2bI76v6saUawhaiiDv%2fb4DJI%3d&risl=&pid=ImgRaw // @require https://cdn.bootcdn.net/ajax/libs/crypto-js/4.0.0/core.js // @require https://cdn.bootcdn.net/ajax/libs/crypto-js/4.0.0/enc-base64.js // @require https://cdn.bootcdn.net/ajax/libs/crypto-js/4.0.0/md5.js // @require https://cdn.bootcdn.net/ajax/libs/crypto-js/4.0.0/evpkdf.js // @require https://cdn.bootcdn.net/ajax/libs/crypto-js/4.0.0/cipher-core.js // @require https://cdn.bootcdn.net/ajax/libs/crypto-js/4.0.0/aes.js // @license MIT // @grant none // @downloadURL https://update.greasyfork.icu/scripts/428021/mooc%E5%A4%8D%E5%88%B6%E7%B2%98%E8%B4%B4%E5%8A%A9%E6%89%8B.user.js // @updateURL https://update.greasyfork.icu/scripts/428021/mooc%E5%A4%8D%E5%88%B6%E7%B2%98%E8%B4%B4%E5%8A%A9%E6%89%8B.meta.js // ==/UserScript== var is_disable=0; function delAll(del=1,delClass=[],delId=[]){ let i,j; if(del==1&&delId.length){ //console.log("准备删除页面左侧栏……"); let leftdom=document.getElementsByClassName("m-learnleft"); if(leftdom.length) for(let i=0;i setTimeout(resolve, time)); } //轻提醒 function Toast(msg, duration) { let p1 = new Promise((resolve,reject)=>{ duration = isNaN(duration) ? 3000 : duration; var m = document.createElement('div'); m.innerHTML = msg; m.style.cssText = "font-family:siyuan;max-width:60%;min-width: 150px;padding:0 14px;height: 40px;color: rgb(255, 255, 255);line-height: 40px;text-align: center;border-radius: 4px;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%);z-index: 999999;background: rgba(0, 0, 0,.7);font-size: 16px;"; document.body.appendChild(m); setTimeout(function() { var d = 0.5; m.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in'; m.style.opacity = '0'; setTimeout(function() { document.body.removeChild(m) }, d * 1000); }, duration); }); } //让arr的元素不重复 function unique (arr) { return Array.from(new Set(arr)) } //选中某个元素的所有text function selectText(element) { if (document.createRange) { let range = document.createRange(); range.selectNodeContents(element); var selection = window.getSelection(); selection.removeAllRanges(); selection.addRange(range); } else { alert('none'); } } //创建一个按钮,并绑定事件 function createAButton(element,value,onclick,css,cla="temp",id="temp"){ let Button = document.createElement("input"); Button.type="button"; Button.value=value; Button.onclick=onclick; Button.setAttribute("style",css) ; Button.setAttribute("class",cla) ; Button.setAttribute("id",id) ; element.appendChild(Button); return Button; } //向element元素添加str字符串,支持str中包含换行 function addTextWithBR(element,str){ var textNode,i; str=str.split(/[\n]/);//分割字符串 for(i=0;i0)getDeepChildByOrder(limit1[0]);} childList=unique(childList); //去除重复元素 //console.log(childList); for(let i=0;i