Last active
September 25, 2021 08:14
-
-
Save unitycoder/199ff1dfd521bd9e9ae1e70e44e6bc5d to your computer and use it in GitHub Desktop.
[Fixefox GreaseMonkey Plugin Script] Fix Old Asset Store Links
This file contains hidden or 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 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