-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
26 lines (23 loc) · 1.02 KB
/
Copy pathscript.js
File metadata and controls
26 lines (23 loc) · 1.02 KB
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
$(document).ready(function () {
var last_commit_title = document.querySelector('relative-time').title;
var last_commit_datetime = document.querySelector('relative-time').getAttribute('datetime');
var date = moment(last_commit_datetime);
var now = moment();
var diff_date = date.diff(now, 'months');
var insertElement = document.createElement('p');
insertElement.setAttribute('class', 'container');
insertElement.style.cssText = 'background-color: ##fafbfc;' +
'margin-top: 15px;' +
'font-size: 15px;' +
'font-weight: bold;' +
'margin-bottom: 15px;';
if (diff_date <= -12) {
insertElement.style.cssText += 'color: #FF2D2D';
} else if (diff_date <= -6) {
insertElement.style.cssText += 'color: #FDDC2B';
} else {
insertElement.style.cssText += 'color: #888';
}
insertElement.innerHTML = 'Latest commit:' + last_commit_title;
$('.container.repohead-details-container').after(insertElement);
});