挂机脚本:
http://www.herokay.cn/index.php/archives/449/
修改说明:
修改前:
// @match https://pn202164004.stu.teacher.com.cn/course/intoSelectCourseVideo*
修改后:
// @match https://pn202236005.stu.teacher.com.cn/course/intoSelectCourseVideo*
http://www.herokay.cn/index.php/archives/449/
修改前:
// @match https://pn202164004.stu.teacher.com.cn/course/intoSelectCourseVideo*
修改后:
// @match https://pn202236005.stu.teacher.com.cn/course/intoSelectCourseVideo*
window.location.href = "http://www.herokay.com/";
为什么不用setTimeout??自行体会
window.sleep = function(ms){
return new Promise(resolve => setTimeout(resolve, ms || 1000))
};
// 延时3秒后进入未学课程
(async () => {
await sleep(3000);
//执行后执行代码
})();
$("li.ovd").each(function()
{
//执行代码
});
$(el).trigger("click");
$("#img_right")[0].click();
// @require file:///C:/js/jquery.js
unsafeWindow.alert=function(msg) {console.info(msg);};
window.alert=function(msg){console.info(msg);};
window.onblur=null;
下面代码仅限控制台使用,因为getEventListeners属于Devtool API,js无法直接使用
getEventListeners(document).visibilitychange.forEach(fn => document.removeEventListener("visibilitychange",fn.listener));
下面代码通用,在tampermonkey中加入run-at document-start
let oldadd=EventTarget.prototype.addEventListener
EventTarget.prototype.addEventListener=function (...args)
{
if(args[0] == "visibilitychange")
{
console.info("拦截成功");
}
else
{
oldadd.call(this,...args);
}
}
Tampermonkey 是一款免费的浏览器扩展和最为流行的用户脚本管理器,它适用于 Chrome, Microsoft Edge, Safari, Opera Next, 和 Firefox等。
中文网站:https://www.tampermonkey.net/
国内用户常用的360浏览器、极速浏览器、QQ浏览器等都是基于Chrome内核,Tampermonkey仍然适用。
类似的工具还有GreasyMonkey,两者基本互通。
由于某些原因,国内没法打开谷歌的webstore,这里以手动安装演示。(能翻墙打开webstore的直接在线安装即可)
将提前下载解压好的文件夹选中即完成安装。
下载好的的tampermonkey是个压缩包,解压后得到一个XXXX.crx文件,将后缀crx改成zip即可解压或者点右键打开方式选择解压缩软件进行解压。
搜索tampermonkey安装即可
https://greasyfork.org/zh-CN
https://www.tampermonkey.net/index.php?ext=dhdg
这类网站上有大量的脚本可以在线安装,比如百度文库复制等。。。
打开Tampermonkey管理面板
实用工具——压缩包,选择压缩包即可导入
当打开脚本运行的网页后脚本会自动运行,红色角标中的数字是当前页面运行的脚本数量。
编写脚本设计js相关知识,建议对html、css、js有一定基础后再开始编写自己的脚本。
备用下载地址:
Tampermonkey.rar
项目地址:http://html.study.teacheredu.cn/el/proj_21181/index.html
脚本功能:学习过程中不用弹窗确定
// ==UserScript==
// @name 江西edu
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://study.teacheredu.cn/proj/studentwork/study.htm?courseId=*
// @grant unsafeWindow
// ==/UserScript==
(function() {
'use strict';
// Your code here...
// 延时3秒后进入未学课程
window.sleep = function(ms){
return new Promise(resolve => setTimeout(resolve, ms || 1000))
};
// 延时3秒后进入未学课程
(async () => {
console.info("一分钟后载入脚本...");
await sleep(60*1000);
console.info("尝试载入...");
unsafeWindow.alert=function(msg) {console.info(msg);};
window.alert=function(msg){console.info(msg);};
console.info("载入成功!");
})();
})();
安装库
pip310 install --trusted-host mirrors.aliyun.com pdfrw -i http://mirrors.aliyun.com/pypi/simple/
pdfrw库地址:https://github.com/pmaupin/pdfrw
from pdfrw import PdfReader,PdfWriter
import os
new_title = "www.herokay.cn"
files = os.listdir('./')
for file_path in files:
if os.path.splitext(file_path)[-1]==".pdf":
trailer = PdfReader(file_path)
print(trailer.Info.Title,"\t=>\t",new_title,)
trailer.Info.Title = new_title
PdfWriter(file_path, trailer=trailer).write()
print("finish")