-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMSDN 我告诉你 清爽特别版.user.js
67 lines (65 loc) · 2.42 KB
/
MSDN 我告诉你 清爽特别版.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// ==UserScript==
// @name MSDN 我告诉你 清爽特别版
// @namespace https://greasyfork.org/zh-CN/scripts/370789
// @version 0.12
// @author zhenhappy<[email protected]>
// @description MSDN 我告诉你 去除广告, 界面宽度100%(解决SideBar里面的内容太长看不到的问题), 去除捐赠提示
// @icon https://msdn.itellyou.cn/favicon.ico
// @match http*://msdn.itellyou.cn/*
// @require https://unpkg.com/jquery/dist/jquery.slim.min.js
// @require https://unpkg.com/autosize/dist/autosize.min.js
// @run-at document-start
// @license MIT
// ==/UserScript==
document.documentElement.style.display = 'none'
$(document).ready(() => {
const userSelectStyle = {
'-webkit-user-select': 'none',
'-moz-user-select': 'none',
'-ms-user-select': 'none',
'user-select': 'none',
}
const textAreaStyle = {
'width': '100%',
'min-height': '40px',
'padding': '10px',
'font-size': '14px',
'color': '#333',
'word-break': 'break-all',
'word-wrap': 'break-word',
'background-color': '#f5f5f5',
'border': '1px solid #ccc',
'border-radius': '4px',
'outline': 'none',
'resize': 'none'
}
document.cookie = 'never_show_donate_auto=true;expires=Fri, 31 Dec 9999 23:59:59 GMT;path=/'
$('#view_data_container img').remove()
$('.container').css('width', '100%')
$('.panel-title a').css('text-decoration', 'none')
$('.list-unstyled label, span.label, .panel').css(userSelectStyle)
$(document).off('DOMSubtreeModified').on('DOMSubtreeModified', ({target}) => {
$('.list-unstyled label, span.label, .panel').css(userSelectStyle)
$('.shang_box').remove()
$('.detail > pre:nth-child(3)').remove()
if ($(target).attr('class') === 'detail') {
if ($(target).children('textarea').length > 0) return
else if ($(target).children('pre').length > 0) {
$(target).children('textarea').remove()
const textarea = document.createElement('textarea')
textarea.rows = '1'
textarea.value = $(target).children('pre').text()
$(textarea).css(textAreaStyle)
textarea.onclick = () => {
textarea.select()
document.execCommand('copy')
console.log('复制成功')
}
$(target).append(textarea)
autosize(textarea)
$(target).children('pre').remove()
}
}
})
document.documentElement.style.display = ''
})