GitHub | Gist Page Modifications

// ==UserScript== // @name [Gist] Short URL // @version 1.0.2 // @description Add a few quick options on all Gist pages. Get Short URL link and direct link to CDN File. // @author Uunknownn // @match https://gist.github.com/* // @match https://git.io/ // @grant none // ==/UserScript== $(document).ready(function(){if(/^(https:\/\/gist\.github\.com\/)(.+)/i.test(window.location+""))$("a:contains('Raw')").each(function(){this.href="https://cdn.rawgit.com"+$(this).attr("href")}),$(".file-navigation-option").last().after('<div class="file-navigation-option"><a rel="nofollow" class="btn btn-sm btn btn-sm tooltipped tooltipped-s tooltipped-multiline" id="shortURL" aria-label="Click to get the short URL">Short URL</a></div>'),$("#shortURL").on("click",function(){location.href="https://git.io#"+window.location});else{var t=/(#)(.+)/gi.exec(window.location+"")[2];$("#input-url").val(t),$("form[action='/create']").trigger("submit")}});
[Tampermonkey Extension] Add a few quick options on all Gist pages. Get Short URL link and direct link to CDN File.

4 Responses

is not javascript!
@Denius Coder Is CSS
ты неправильно указал тег, это не javascript, это jquery, твой код не будет работать без библиотеки jquery

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.