27 lines
866 B
JavaScript
27 lines
866 B
JavaScript
// ==UserScript==
|
|
// @name View Code in GitHUB
|
|
// @namespace http://tampermonkey.net/
|
|
// @version 0.1
|
|
// @description try to take over the world!
|
|
// @author You
|
|
// @match https://github.com/*/*
|
|
// @grant none
|
|
// ==/UserScript==
|
|
|
|
(function() {
|
|
'use strict';
|
|
var navi = document.querySelectorAll('.file-navigation')
|
|
console.log(navi)
|
|
if (navi.length > 0) {
|
|
navi = navi[0]
|
|
var node = document.createElement('a')
|
|
node.className = 'btn btn-primary'
|
|
node.style = 'margin-left: 0.5rem'
|
|
node.href = "https://githubvsc.zmy.pub" + window.location.pathname
|
|
node.innerHTML = "View Code"
|
|
node.target = "_blank"
|
|
// var sep = navi.getElementsByClassName('flex-auto')[0]
|
|
// navi.insertBefore(node, sep.nextSibling)
|
|
navi.appendChild(node)
|
|
}
|
|
})(); |