forked from OverlordQ/Reddit-Pro-Tools
-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.js
97 lines (65 loc) · 1.78 KB
/
test.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
var urls = [
'https://www.reddit.com/r/politics/comments/86sw65/stormy_daniels_lawyer_says_he_has_dvd_containing/',
'https://www.reddit.com/r/worldnews/comments/86r24m/french_police_hero_dies_of_wounds/',
'https://www.reddit.com/r/politics/comments/86sfy8/new_data_show_the_nra_increased_online_ad/',
'https://www.reddit.com/r/politics/comments/86nlte/millennials_really_hate_the_republicans/',
'https://www.reddit.com/r/news/comments/86sorm/father_gets_60_years_for_trying_to_sell_4yearold/'
];
function runTest () {
console.log('runTest');
test = [];
urls.forEach(function (url) {
test.push(new TestPage(url));
page = test[test.length-1];
//console.log(page.url);
});
//.about.updated
//.stats.comment.updated
}
function testMain() {
if (!db) {
console.log('db loading... ');
setTimeout(function () { testMain(); }, 100);
return;
}
let authors = getAuthors();
//authors = ['feeling_impossible'];
authors.forEach(function(user) {
if (!working[user]) {
if (!users[user]) { users[user] = new User(user); }
working[user] = true;
users[user].about.updated = 0;
users[user].dbGet();
users[user].aboutGet();
users[user].commentsGet();
};
});
}
function addTestLink() {
let testLink = $('<a></a>')
.attr('href', '#')
.css({color: '#ffffff'})
.html('run tests!');
let testDiv = $('<div></div>')
.addClass('rptTag propagandaColor')
.attr('id', 'testDiv')
.css({
position: 'fixed',
bottom: '20px',
left: '0px'
})
.html(testLink);
$(document.body).append(testDiv);
// add click event
$('#testDiv').click(function() {
console.log('runTest');
runTest();
});
}
function TestPage (reddit) {
this.url = reddit;
this.title = null;
this.authors = null;
this.comments = null;
this.size = null;
}