我想添加一个按钮,从文件的原始文件转到Github源页面,这里是代码:
// ==UserScript==
// @name From Raw To Github
// @namespace From Raw To Github
// @description Add a button to go to Github source page from the raw of a file
// @include https://raw.githubusercontent.com/*
// @version 1
// @grant none
// ==/UserScript==
var rawURL = window.location.href;
var [_, repo, path] = rawURL.match(/https?:\/\/raw\.githubusercontent\.com\/([^\/]+\/[^\/]+)\/(.+)\/.+/);
var a = document.createElement("a");
a.href = "https://github.com/" + repo + "/tree/" + path;
var button = document.createElement("button");
button.innerHTML = "Go to Github folder";
a.appendChild(button);
document.body.insertBefore(a, document.body.firstChild);


这是错误:
出了什么问题?