-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcollectRich.js
More file actions
26 lines (23 loc) · 831 Bytes
/
collectRich.js
File metadata and controls
26 lines (23 loc) · 831 Bytes
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
// 衣服列表
const data = [...document.querySelectorAll("#mw-content-text div.item-baseinfo div.item-name.rarity-common")].map(item => item.innerText);
// 套装名称
const name = document.querySelector("#firstHeading > h1").innerText;
// 预览图
const preview = document.querySelector(".blueimp-gallery > div.slides > div > img")?.src
|| document.querySelector("#mw-content-text > div > div.floatright > a > img")?.src
|| '';
// wikiLink
const link = location.href;
const text = JSON.stringify({
name,
link,
preview,
data
});
let textareaEl = document.createElement('textarea');
textareaEl.setAttribute('readonly', 'readonly');
textareaEl.value = text + ',';
document.body.appendChild(textareaEl);
textareaEl.select();
let res = document.execCommand('copy');
document.body.removeChild(textareaEl);