Skip to content

Instantly share code, notes, and snippets.

@hexium310
Last active May 13, 2022 10:29
Show Gist options
  • Save hexium310/774465f10e34740849d653c277cf9ab6 to your computer and use it in GitHub Desktop.
Save hexium310/774465f10e34740849d653c277cf9ab6 to your computer and use it in GitHub Desktop.
Make docs.rs latest on Google Search
// ==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