ryoakg
10/15/2017 - 12:22 AM

user script: View this gist on JSBin

user script: View this gist on JSBin

// ==UserScript==
// @name         View this gist on JSBin
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       ryo
// @include      /^https?://gist\.github.com/[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}/[0-9a-f]+
// @grant        none
// ==/UserScript==

// cf. http://jsbin.com/help/import-gists
(function() {
    'use strict';

    var parent = document.getElementsByClassName('pagehead-actions')[0];
    var child = document.createElement('li');
    var a = document.createElement('a');
    a.href = 'http://jsbin.com/gist'+window.location.pathname;
    a.target = '_blank';
    a.classList.add('btn');
    a.classList.add('btn-sm');
    a.setAttribute('aria-label', 'view this gist on JSBin');
    a.textContent = 'JSBin';
    child.appendChild(a);
    parent.appendChild(child);
})();