Last active
May 13, 2022 10:29
-
-
Save hexium310/774465f10e34740849d653c277cf9ab6 to your computer and use it in GitHub Desktop.
Make docs.rs latest on Google Search
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Make docs.rs latest on Google Search | |
// @namespace hexium310 | |
// @version 0.0.1 | |
// @author Hexin | |
// @include /^(http|https):\/\/www\.google\..+\/search.*/ | |
// @downloadUrl https://gist.github.com/hexium310/774465f10e34740849d653c277cf9ab6/raw/make-docs.rs-latest.user.js | |
// @updateUrl https://gist.github.com/hexium310/774465f10e34740849d653c277cf9ab6/raw/make-docs.rs-latest.user.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const elements = document.querySelectorAll('a[href*="https://docs.rs/"]'); | |
for (const element of elements) { | |
const href = element.href; | |
element.href = href.replace(/(docs.rs\/.*?)\/(.*?)\//, '$1\/latest\/'); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment