Skip to content

Instantly share code, notes, and snippets.

@deprecatedcoder
Last active January 2, 2018 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deprecatedcoder/33deacce1cb1ecb19763144d23d738ac to your computer and use it in GitHub Desktop.
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
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