Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MTco/df4e2f82da8ae8eee591c835a95e0072 to your computer and use it in GitHub Desktop.
Save MTco/df4e2f82da8ae8eee591c835a95e0072 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==
// @encoding utf-8
// @name Github html preview
// @author https://github.com/vaniakosmos
// @modified-by Mathew Tyler <[email protected]> (http://mathewtyler.co)
// @version 1.1
// @description Shortcut for htmlpreview.github.io
// @grant none
// @run-at document-end
// @match https://github.com/**/*.html
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js#md5=oJ4T7pTVHFJLfipyjH1AOQ==
// ==/UserScript==
;(function(H,l,err){
l = H.document;
(function($, dom){
var viewBtn = $('<a>')
.attr('class', 'btn btn-sm BtnGroup-item')
.attr('href', 'https://htmlpreview.github.io/?' + H.location.href)
.attr('target', '_blank')
.html('Html preview');
$('body', $('html')['0']).first().find('.BtnGroup').append(viewBtn);
}(H.jQuery.noConflict(!0), l));
})(window, null, null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment