-
Notifications
You must be signed in to change notification settings - Fork 0
/
TAPD关键字复制优化.js
50 lines (46 loc) · 1.88 KB
/
TAPD关键字复制优化.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// ==UserScript==
// @name TAPD关键字复制优化
// @namespace https://greasyfork.org/zh-CN/users/306433
// @version 0.1
// @description TAPD关键字复制优化, 关闭的trace log动作跟踪, 添加一个自定义复制项
// @author https://greasyfork.org/zh-CN/users/306433-baster
// @supportURL https://greasyfork.org/zh-CN/users/306433-baster
// @homepageURL https://greasyfork.org/zh-CN/users/306433
// @match https://www.tapd.cn/*
// @icon https://www.tapd.cn/favicon.ico
// @grant none
// @run-at document-start
// ==/UserScript==
(function () {
"use strict";
function hookVar(name, value) {
window[name] = value;
Object.defineProperty(window, name, {
get: function () {
return value;
},
set: function (value) {},
enumerable: true,
configurable: true,
});
}
// 关闭trace跟踪
hookVar("copy_title_and_url_in_view_link", "https://www.tapd.cn/fuck");
hookVar("copy_short_link_in_view_link", "https://www.tapd.cn/fuck");
hookVar("copy_io_convert_link_in_view_link", "https://www.tapd.cn/fuck");
hookVar("copy_svn_commit_key_words_in_view_link", "https://www.tapd.cn/fuck");
hookVar("copy_id__in_view_link", "https://www.tapd.cn/fuck");
document.addEventListener("DOMContentLoaded", function () {
console.log(document.getElementById("copy_id_new"));
if (document.getElementById("copy_id_new") != null) {
let title = $(".story-title").data("editable-value");
let id = $("#copy_id_new").attr("data-clipboard-text");
$("#copy_id_new").parent().prepend(`
<li>
<a id="copy_new" data-clipboard-text='"msg": "${id} ${title}"' href="javascript:;" title="复制 ID&标题" class="clipboard-btn">
复制 ID&标题</a>
</li>
`);
}
});
})();