Merge: concurrent_collections: Add implementation of has method
[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/*
6 // @downloadURL https://github.com/nitlang/nit/raw/master/contrib/nitrpg/nitrpg.user.js
7 // @version 2
8 // @grant none
9 // ==/UserScript==
10
11 // The nav bar with tabs
12 var nav = document.getElementsByClassName('reponav');
13 if (!nav || !nav[0]) return;
14
15 // The current repo to link
16 var repo = $("meta[name='octolytics-dimension-repository_nwo']").attr("content");
17 //repo = "nitlang/nit";
18 if (!repo) return;
19
20 // The content of the new tab
21 var html = '<a href="http://nitlanguage.org/rpg/games/' + repo + '" class="js-selected-navigation-item reponav-item" data-selected-links="nitrpg"><span class="octicon octicon-ruby"></span> Github RPG</a>';
22 //html = '<p><span>x</span></p>';
23
24 // Inject the new tab
25 var div = document.createElement('div');
26 div.innerHTML = html;
27 nav[0].append(div.firstChild);