Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Last active February 14, 2024 19:47
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save unitycoder/48b46d0192e2cce356c2731c8f274880 to your computer and use it in GitHub Desktop.
GreaseMonkey script to display unity api version first added
// ==UserScript==
// @name UnityDocsShowFirstVersionAdded
// @namespace https://unitycoder.com
// @description Displays unity version when this method was added (takes from the dropdown list)
// @include https://docs.unity3d.com/ScriptReference/*
// @include https://docs.unity3d.com/*/Documentation/*
// @version 1.1 (14.02.2024)
// @grant none
// ==/UserScript==
(function() {
'use strict';
const interval = setInterval(function() {
const lastListItem = document.querySelector('#versionsWithThisPage li:last-child a');
if (lastListItem)
{
const lastListItemValue = lastListItem.innerText;
//console.log(`Last LI value: ${lastListItemValue}`);
// get the reference to the h1 element
const heading = document.querySelector('.heading.inherit');
// create a new p element
const newElement = document.createElement('p');
newElement.innerHTML = "Added in "+lastListItemValue;
// insert the new p element after the h1 element
heading.parentNode.insertBefore(newElement, heading.nextSibling);
clearInterval(interval);
}
}, 1000); // check every 1 second
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment