From f6c76afac48cc87cb46aa03419cc62f5898322a8 Mon Sep 17 00:00:00 2001 From: mingyang Date: Fri, 19 Feb 2021 19:36:17 +0800 Subject: [PATCH] view code in github based on github1s.com --- view_github_code_in_vscode | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 view_github_code_in_vscode diff --git a/view_github_code_in_vscode b/view_github_code_in_vscode new file mode 100644 index 0000000..21b85d0 --- /dev/null +++ b/view_github_code_in_vscode @@ -0,0 +1,27 @@ +// ==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.getElementsByClassName('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://github1s.com" + 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) + } +})(); \ No newline at end of file