-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHAD-num-comments.user.js
39 lines (35 loc) · 1.07 KB
/
HAD-num-comments.user.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
// ==UserScript==
// @name HAD numComments
// @namespace had.num.comments
// @description show num comments
// @include http://hackaday.com/*
// @match http://*.hackaday.com/*
// @match http://hackaday.com/*
// @grant none
// ==/UserScript==
function addGlobalStyle(css) {
var head,
style;
head = document.getElementsByTagName('head') [0];
if (!head) {
return ;
}
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
//addGlobalStyle(
//'li { list-style-type: decimal ! important }');
/* Make sure the page has comments. */
var comments = document.getElementById('comments');
if (comments) {
var commentNum = document.getElementsByClassName('post-comments') [0].innerHTML;
//console.log('==== ' + commentNum);
var cmt = document.createElement('div');
var cmt1 = document.createElement('div');
cmt.innerHTML = commentNum;
cmt1.innerHTML = commentNum;
comments.insertBefore(cmt, comments.firstChild);
comments.appendChild(cmt1);
}