nitrpg: use new github repo
[nit.git] / contrib / nitrpg / nitrpg.user.js
1 // ==UserScript==
2 // @name Github.com - Add RPG tab
3 // @namespace nitlanguage/github/rpg
4 // @description Adds a "Github RPG" Tab at the end of the tabs.
5 // @include https://github.com/nitlang/nit*
6 // @version 1
7 // @grant none
8 // ==/UserScript==
9
10 /* This script is a userscript to use in browsers with the appropriate plug-in to add a "RPG" tab on the github site.
11 */
12
13 /* TODO:
14 * Link to the player page (if logged and is a player)
15 * Link to other games (not just `nitlang/nit` but other)
16 */
17
18 // The nav bar with tabs
19 var nav = document.getElementsByClassName('repo-nav');
20
21 // The new tab
22 var html = '<li class="tooltipped tooltipped-w" aria-label="Github RPG">\
23 <a href="http://nitlanguage.org/rpg/games/nitlang/nit" aria-label="RPG" class="js-selected-navigation-item sunken-menu-item" data-selected-links="repo_settings /nitlang/nit/settings">\
24 <span class="octicon octicon-ruby"></span> <span class="full-word">Github RPG</span>\
25 <img alt="" class="mini-loader" height="16" src="https://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif" width="16">\
26 </a></li>';
27
28 // Create a new list to put the new tab
29 var group = document.createElement('ul');
30 group.setAttribute( 'class', 'sunken-menu-group' );
31 group.innerHTML = html;
32
33 nav[0].appendChild(group);