Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jkaunert/efca9f3495348314fc3cd3fa89714f6f to your computer and use it in GitHub Desktop.
Save jkaunert/efca9f3495348314fc3cd3fa89714f6f 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