-
Notifications
You must be signed in to change notification settings - Fork 24
/
decorate.js
171 lines (153 loc) · 15.8 KB
/
decorate.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
function Decorator() {
// <span class="author"><a href="/proloser" class="url fn" itemprop="url" rel="author"><span itemprop="title">proloser</span></a></span>
var author = document.querySelector('.author');
this.owner = author.textContent;
// <strong><a href="/proloser/github-omnibox" data-pjax="#js-repo-pjax-container">github-omnibox</a></strong>
this.repo = author.nextElementSibling.nextElementSibling.textContent;
}
Decorator.prototype.owner = '';
Decorator.prototype.repo = '';
Decorator.prototype.isPublic = function() {
var isPublic = document.querySelector('.entry-title');
return isPublic && isPublic.classList.contains('public');
};
Decorator.prototype.img = function(src, alt, className) {
return '<img src="'+src+'" alt="'+alt+'" class="'+className+'" />';
};
Decorator.prototype.row = function(data) {
var tmpl = '<a class="select-menu-item js-navigation-item" title="'+data.name+'" role="menuitem" tabindex="0" href="'+data.url+'">' +
this.img(data.icon, '', 'octicon select-menu-item-icon') +
'<div class="select-menu-item-text">' +
'<span class="select-menu-item-heading">' +
(data.badge && this.img(data.badge, data.name) || data.name) +
'</span>' +
'</div>' +
'</a>';
return tmpl.replace(/:owner/g, this.owner).replace(/:repo/g, this.repo);
};
Decorator.prototype.addTab = function(items) {
var target = document.querySelector('.reponav');
if (!target) return;
var element = document.createElement('span');
element.className = 'select-menu js-menu-container js-select-menu dropdown';
var tab = '<a class="reponav-item select-menu-button" href="#">' +
'<svg height="16" width="12" xmlns="http://www.w3.org/2000/svg" class="octicon octicon-server">' +
'<path d="M11 6H1c-0.55 0-1 0.45-1 1v2c0 0.55 0.45 1 1 1h10c0.55 0 1-0.45 1-1V7c0-0.55-0.45-1-1-1zM2 9H1V7h1v2z m2 0h-1V7h1v2z m2 0h-1V7h1v2z m2 0h-1V7h1v2zM11 1H1C0.45 1 0 1.45 0 2v2c0 0.55 0.45 1 1 1h10c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1zM2 4H1V2h1v2z m2 0h-1V2h1v2z m2 0h-1V2h1v2z m2 0h-1V2h1v2z m3-1h-1v-1h1v1z m0 8H1c-0.55 0-1 0.45-1 1v2c0 0.55 0.45 1 1 1h10c0.55 0 1-0.45 1-1V12c0-0.55-0.45-1-1-1zM2 14H1V12h1v2z m2 0h-1V12h1v2z m2 0h-1V12h1v2z m2 0h-1V12h1v2z"></path>' +
'</svg> Badges ' +
'</a>' +
'<div class="select-menu-modal-holder"><div class="select-menu-modal js-menu-content omnibox">' +
'<div class="select-menu-header">' +
'<a href="'+chrome.extension.getURL('help.html')+'">' +
'<svg aria-hidden="true" class="octicon octicon-gear" height="16" role="img" version="1.1" viewBox="0 0 14 16" width="14">' +
'<path d="M14 8.77V7.17l-1.94-0.64-0.45-1.09 0.88-1.84-1.13-1.13-1.81 0.91-1.09-0.45-0.69-1.92H6.17l-0.63 1.94-1.11 0.45-1.84-0.88-1.13 1.13 0.91 1.81-0.45 1.09L0 7.23v1.59l1.94 0.64 0.45 1.09-0.88 1.84 1.13 1.13 1.81-0.91 1.09 0.45 0.69 1.92h1.59l0.63-1.94 1.11-0.45 1.84 0.88 1.13-1.13-0.92-1.81 0.47-1.09 1.92-0.69zM7 11c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3z"></path>' +
'</svg>' +
'</a>' +
'<span class="select-menu-title">Github Omnibox</span>' +
'</div>' +
'<div class="select-menu-list js-navigation-container" role="menu">' +
items.map(this.row, this).join('') +
'</div>' +
'</div></div>';
element.innerHTML = tab;
target.appendChild(element);
var trigger = element.querySelector('.select-menu-button');
trigger.addEventListener('click', function(){
trigger.classList.add('selected');
element.classList.add('active');
setTimeout(function(){
document.addEventListener('click', function listener(){
trigger.classList.remove('selected');
element.classList.remove('active');
document.removeEventListener('click', listener);
});
});
});
[].forEach.call(element.querySelectorAll('.reponav .select-menu-item-text img'), function(el){
el.addEventListener('error', function(event){
// event.srcElement.outerHTML = event.srcElement.alt;
// <img> <span> <div> <a>
event.srcElement.parentElement.parentElement.parentElement.outerHTML = '';
});
});
}
/**
* Adds a gh-pages url if the branch exists but a url does not
*/
Decorator.prototype.addUrl = function() {
var target, element, url, tooltip, text, classes = '', icon = '';
// Is the project URL missing from the project description?
if (!document.querySelector('.repository-meta-content [itemprop=url]') && (target = document.querySelector('.repository-meta-content [itemprop=about]'))) {
element = document.createElement('span');
// Is there a gh-pages branch?
if (document.querySelector('[data-name="gh-pages"]')) {
tooltip = "Detected from repo's gh-pages branch";
url = this.owner + '.github.io';
// Is this a webpage repo?
if (!this.repo.endsWith('.github.io') && !this.repo.endsWith('.github.com'))
url += '/' + this.repo;
} else {
// Add a 5minfork.com url
// http://5minfork.com/musically-ut/lovely-forks
url = '5minfork.com/' + this.owner + '/' + this.repo;
text = '5minfork'
tooltip = 'Create a 5 minute fork of the\n project for a quick play and test';
icon = '<span class="octicon" style="width: 16px; height: 16px; margin-background-position: center; background-repeat: no-repeat; background-size: contain; background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PgogICAgICAgICAgICAgICAgICAgIDwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIKICAgICAgICAgICAgICAgICAgICAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRk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gICAgICAgICAgICA8L3N2Zz4=);"></span>';
classes = 'btn btn-sm';
}
element.setAttribute('itemprop', 'url');
element.innerHTML = ' <a href="http://'+url+'" class="tooltipped tooltipped-s ' + classes + '" aria-label="'+tooltip+'" style="white-space:nowrap">'
+ icon + ' ' + (text || url) + '</a>';
target.parentNode.insertBefore(element, target.nextSibling);
}
};
String.prototype.endsWith = function(suffix) {
return this.indexOf(suffix, this.length - suffix.length) !== -1;
};
var menu = [
{
name: 'Gitter Chat',
icon: 'https://cdn03.gitter.im/_s/a46bec8/images/favicon.ico',
badge: 'https://img.shields.io/gitter/room/:owner/:repo.svg',
url: 'https://gitter.im/:owner/:repo'
},
{
name: 'Travis CI',
icon: 'https://cdn.travis-ci.org/images/favicon.png',
badge: 'https://img.shields.io/travis/:owner/:repo.svg',
url: 'https://travis-ci.org/:owner/:repo'
},
{
name: 'David DM',
icon: 'https://david-dm.org/favicon.ico',
badge: 'https://img.shields.io/david/:owner/:repo.svg',
url: 'https://david-dm.org/:owner/:repo'
},
{
name: 'David DM Dev',
icon: 'https://david-dm.org/favicon.ico',
badge: 'https://img.shields.io/david/dev/:owner/:repo.svg',
url: 'https://david-dm.org/:owner/:repo#info=devDependencies'
},
{
name: 'Coveralls',
icon: 'https://coveralls.io/favicon.ico',
badge: 'https://img.shields.io/coveralls/:owner/:repo.svg',
url: 'https://coveralls.io/r/:owner/:repo'
},
{
name: 'Code Climate',
icon: 'https://codeclimate.com/favicon.ico',
badge: 'https://img.shields.io/codeclimate/github/:owner/:repo.svg',
url: 'https://codeclimate.com/github/:owner/:repo'
}
];
var page = new Decorator();
if (page.isPublic()) {
page.addUrl();
chrome.storage.sync.get({menu:menu}, function(data){
page.addTab(data.menu);
$(document).on('pjax:complete', function() {
page.addTab(data.menu);
})
});
}