-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsoylent-fortune.user.js
106 lines (75 loc) · 3.05 KB
/
soylent-fortune.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
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
// ==UserScript==
// @name soylent-fortune
// @namespace soylent-fortune
// @description soylent-fortune
// @include *soylentnews.org/*
// @include file:///home/marco/*
// @version 1
// @grant none
// ==/UserScript==
//alert (12345);
function friendSymbol() {
//friend gif minimize. neutral.gif
//neutral.gif -> 15x15 to 9x9
//<img width="15" height="15"
//title="Neutral" alt="Neutral"
//src="Statistical%20Analysis%20of%20Bob%20Ross%27s%20Paintings%20by%20538_files/neutral.gif">
var friendImg = document.evaluate('//img[contains(@src,\'neutral.gif\')]',
//var friendImg = document.evaluate('//img',
document, null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
//var em1 = fortune.getElementsByTagName('em');
//document.body.insertBefore(em1[0], document.body.firstChild);
//alert(em1[0]);
for (var i = 0; i < friendImg.snapshotLength; i++) {
var node = friendImg.snapshotItem(i);
node.width=9;
node.height=9;
//alert(node);
//document.body.insertBefore(node, document.body.firstChild);
}
}
//make score 0 or less gray title
//<span class="score" id="comment_score_31860">(Score:2)</span>
function scoreZeroOrLess(){
var scores = document.evaluate('//span[contains(text(),"Score:0") or contains(text(),"Score:-1")]',
//var scores = document.evaluate('//span["@class=score"]',
document, null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
//var em1 = fortune.getElementsByTagName('em');
//document.body.insertBefore(em1[0], document.body.firstChild);
//alert(em1[0]);
for (var i = 0; i < scores.snapshotLength; i++) {
var node = scores.snapshotItem(i);
node.style.backgroundColor = '#f00';
//alert(node);
//document.body.insertBefore(node, document.body.firstChild);
}
}
function fortuneGreen() {
//var em1 = document.getElementById("footer");
//alert(em1.innerHTML);
// var x=document.getElementById("footer");
//alert(x.innerHTML);
//document.body.insertBefore(x, document.body.firstChild);
var fortune = document.evaluate('//div["@id=footer"]//em',
document, null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
//var em1 = fortune.getElementsByTagName('em');
//document.body.insertBefore(em1[0], document.body.firstChild);
//alert(em1[0]);
//for (var i = 0; i < fortune.snapshotLength; i++) {
// var node = fortune.snapshotItem(0);
//alert(node);
//document.body.insertBefore(node, document.body.firstChild);
//}
var node = fortune.snapshotItem(1); //why 1?
node.style.backgroundColor = 'green';
//document.body.insertBefore(node, document.body.firstChild);
}
//fortuneGreen();
scoreZeroOrLess();
friendSymbol();