-
-
Notifications
You must be signed in to change notification settings - Fork 121
/
baiduShareCopyForZhidao.user.js
35 lines (35 loc) · 1.54 KB
/
baiduShareCopyForZhidao.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// ==UserScript==
// @name baiduShareCopyForZhidao
// @namespace https://github.com/dodying/Dodying-UserJs
// @name:zh-CN 【百度云】分享-答题专用
// @description:zh-CN
// @include https://pan.baidu.com/disk/home*
// @version 1.04
// @grant GM_setClipboard
// @author dodying
// @namespace https://github.com/dodying/Dodying-UserJs
// @supportURL https://github.com/dodying/Dodying-UserJs/issues
// @icon https://github.com/dodying/UserJs/raw/master/Logo.png
// @run-at document-end
// ==/UserScript==
var interval = setInterval(() => {
if (document.querySelector('input.share-url')) {
const inputUrl = document.querySelector('input.share-url');
inputUrl.oncopy = function (e) {
e.preventDefault();
const sharedName = document.querySelector('.item-active>.file-name>.text>a.filename').innerText;
const sharedSize = document.querySelector('.item-active>.file-size').innerText;
const sharedUpdateTime = document.querySelector('.item-active>.ctime').innerText;
const inputPwd = document.querySelector('.share-password');
let clip = `链接:${inputUrl.value}`;
if (inputPwd.value !== '') { // 无提取密码
clip = `${clip} 密码:${inputPwd.value}`;
}
clip = `文件名称:${sharedName}\n文件大小:${sharedSize}\n上传时间:${sharedUpdateTime}\n${clip}`;
const word = '请享用。\n如无误,请及时采纳,谢谢。( ̄︶ ̄)/\n';
clip = word + clip;
GM_setClipboard(clip);
};
clearInterval(interval);
}
}, 200);