-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocsrs.user.js
34 lines (27 loc) · 876 Bytes
/
docsrs.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
// ==UserScript==
// @name Docs.rs tweak
// @namespace https://github.com/lilydjwg/userscripts
// @description Docs.rs tweak
// @include https://docs.rs/*
// @version 0.2
// @run-at document-end
// @grant none
// ==/UserScript==
for(const link of document.querySelectorAll('.recent-releases-container > ul > li > a.release')) {
if(link.href.indexOf('https://docs.rs/crate/') === 0) {
continue
}
link.href = link.href.replace(/^(https:\/\/docs.rs\/[^/]+\/)[^/]+/, '$1latest')
}
function addStyle(css) {
const head = document.getElementsByTagName('head')[0]
if (head) {
const style = document.createElement('style')
style.setAttribute('type', 'text/css')
style.textContent = css
head.appendChild(style)
return style
}
}
const css = 'a:visited .name { color: #964dae !important; }'
addStyle(css)