Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Last active September 25, 2021 08:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unitycoder/199ff1dfd521bd9e9ae1e70e44e6bc5d to your computer and use it in GitHub Desktop.
Save unitycoder/199ff1dfd521bd9e9ae1e70e44e6bc5d to your computer and use it in GitHub Desktop.
[Fixefox GreaseMonkey Plugin Script] Fix Old Asset Store Links
// ==UserScript==
// @name Fix Old Asset Store Links
// @version 1
// @include https://www.assetstore.unity3d.com/*
// @grant none
// ==/UserScript==
// get current url
var URL = window.location.href;
// parse package id after last "/"
var id = URL.match(/(?!\/)(?:.(?!\/))+$/);
// get new link
var newURL = "https://assetstore.unity.com/packages/slug/"+id;
// Create anchor element
var a = document.createElement('a');
// Create the text node for anchor element
var link = document.createTextNode(newURL);
// Append the text node to anchor element
a.appendChild(link);
// Set the title
a.title = newURL;
// Set the href property
a.href = newURL;
// Append the anchor element to the body
document.body.appendChild(a);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment