3
如何分叉我自己的GitHub要點?如何在GitHub上分享我自己的要點?
一種可能性:有一個腳本張貼在要點上,但我不知道如何將它安裝在我的gitHub上。在這種情況下,解釋如何使用腳本以及它在做什麼。
(Re)Fork any gist, including your own
<!-- language: lang-js -->
// ==UserScript==
// @name (Re)fork any gist, including your own
// @namespace https://github.com/johan
// @description Adds a "fork" button to gists missing one at gist.github.com, so you can create multiple forks
// @match https://gist.github.com/*
// @include https://gist.github.com/*
// ==/UserScript==
if (/^\/\d+/.test(location.pathname) &&
!document.querySelector('a img[alt="fork"]')) {
var i = document.createElement('img')
, a = document.createElement('a')
, u = document.querySelector('img.button').src
, p = document.querySelector('.title');
a.title = 'Create another fork of this gist';
a.style.cssText = 'float: right; margin: 4px 7px 0';
a.addEventListener('click', fork);
a.appendChild(i);
i.alt = 'fork';
i.src = u.replace(/[^\/]*$/, 'fork_button.png');
i.className = 'button';
p.appendChild(a);
}
function fork(e) {
var f = document.body.appendChild(document.createElement('form'));
f.method = 'POST';
f.action = '/fork' + location.pathname;
f.appendChild(document.querySelector('input[name=authenticity_token]'));
f.submit();
return false;
}
StackOverflow上展示瞭如何餐桌自己GitHub repository。
我分叉了你的這個版本,做了2個修正,並編輯了自述文件,向firefox用戶解釋如何去做。 [位於這裏 - Gist Fork](https://gist.github.com/Noitidart/8794639)。我也做了一個Firefox插件([位於這裏 - ghForkable](https://addons.mozilla.org/en-US/firefox/addon/ghforkable/)) – Noitidart 2014-02-16 22:59:45
我現在得到一個錯誤'Uncaught TypeError: $不是來自答案中小書籤的函數。 – 2016-12-14 19:00:57