Github: Add Releases Button

Adds a releases button

Ekde 2014/10/12. Vidu La ĝisdata versio.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Github: Add Releases Button
// @namespace    https://github.com/phracker
// @version      0.1.0
// @description  Adds a releases button
// @include      http*://*github.com/*/*
// ==/UserScript==

// var owfn = document.getElementsByClassName('only-with-full-nav').item(0);

// var ur = 'hubc ' + document.URL.replace('https://github.com/','').replace('.git','').replace(/\/network$/,'').replace(/\/wiki$/,'').replace(/\/pull\/.*$/,'').replace(/\/commit\/.*$/,'').replace(/\/$/,'');
// // var ur = 'hubc ' + document.URL.replace(/(.*)github.com\/(.+)\/(.+)\/(.*)/,/hubc $2\/$3/);
// console.log(ur);
// var inner = '<h3><span class="text-emphasized">hubc</span> clone command</h3><div class="input-group"><input type="text" class="input-mini input-monospace js-url-field" value="' + ur + '" readonly="readonly"><span class="input-group-button"><button aria-label="Copy to clipboard" class="js-zeroclipboard minibutton zeroclipboard-button" data-clipboard-text="'+ur+'" data-copied-hint="Copied!" type="button"><span class="octicon octicon-clippy"></span></button></span></div>';
// var d = document.createElement('div');
// d.setAttribute("class","clone-url");
// d.setAttribute("style","display:inline;");
// d.innerHTML = inner;
// owfn.appendChild(d);

var releasesButton = document.evaluate('/html/body/div[1]/div[3]/div[3]/div[1]/div[1]/div[1]/div/ul[1]/li[4]',document,null,9,null).singleNodeValue.cloneNode(true);
releasesButton.setAttribute('aria-label','Releases');
var a = releasesButton.getElementsByTagName('a').item(0);
a.href = a.href.replace(/wiki$/,'releases');
a.setAttribute('aria-label','Releases');
a.setAttribute('data-hotkey','g r');
a.setAttribute('data-selected-links',a.getAttribute('data-selected-links').replace('repo_wiki','repo_releases').replace(/wiki$/,'releases'));
a.getElementsByClassName('full-word').item(0).textContent = 'Releases';
a.getElementsByClassName('octicon').item(0).class = 'octicon octicon-rocket';

var menu = document.evaluate('/html/body/div[1]/div[3]/div[3]/div[1]/div[1]/div[1]/div/ul[1]',document,null,9,null).singleNodeValue;
menu.appendChild(releasesButton);