Skip to content

Instantly share code, notes, and snippets.

@vanyakosmos
Last active January 26, 2024 15:49
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save vanyakosmos/83ba165b288af32cf85e2cac8f02ce6d to your computer and use it in GitHub Desktop.
Save vanyakosmos/83ba165b288af32cf85e2cac8f02ce6d to your computer and use it in GitHub Desktop.
Script for Tampermonkey that adds 'view' to the actions menu beside 'row', 'blame' and 'history' buttons and allow you to preview rendered .html pages.
// ==UserScript==
// @name Github html preview
// @author https://github.com/vaniakosmos
// @version 1.0
// @description Shortcut for htmlpreview.github.io
// @match https://github.com/**/*.html
// @grant none
// @require http://code.jquery.com/jquery-3.2.1.min.js
// ==/UserScript==
$(document).ready(function() {
var viewBtn = $('<a>')
.attr('href', 'http://htmlpreview.github.io/?' + window.location.href)
.attr('class', 'btn btn-sm BtnGroup-item')
.html('Html preview');
$('.file-actions').find('.BtnGroup').append(viewBtn);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment