Last active
January 2, 2018 18:05
-
-
Save deprecatedcoder/33deacce1cb1ecb19763144d23d738ac to your computer and use it in GitHub Desktop.
Utility script for adding a shortcut in the upper right corner to the glitch source
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
var project = window.location.hostname.replace('.glitch.me', ''); | |
var subProject = window.location.pathname.slice('1'); | |
console.log( "subProject: " + subProject); | |
if (!subProject.includes(".htm")) | |
{ | |
subProject = subProject + "/index.html"; | |
console.log( "subProject: " + subProject); | |
} | |
document.write( '<a href="https://glitch.com/edit/#!/' + project + '?path=' + subProject + '">' + | |
'<img width="40" height="26" src="https://glitch.com/edit/images/logos/glitch/logo-day.svg" style="position: absolute; top: 10; border: 0; right: 0; transform: rotate(45deg);">' + | |
'</a>'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment