View difference between Paste ID: 1DkGPJsA and ZjByGfZq
SHOW: | | - or go back to the newest paste.
1
$(document).ready(function() {
2
    var ShillCount = 0;
3
    var UUIDs = 0;
4
    var ThreadPosts = 0;
5
    var ShowingPosts = 0;
6
    var BreadQuality = 0;
7
    var LastThreadPosts = 0;
8
    var UUID_DB = {}
9
    var UUID_POST_COUNT = {}
10
    var POST_REPLIES = {}
11
    var SHILL_SCORE = {}
12
    var SHILL_DB = {}
13
    var MY_POSTS = {};
14
    var BAD_POSTS = {};
15
    var GOOD_POSTS = {};
16
    var POSTS_SCORE = {};
17
    var POST_TO_ANON = {};
18
    var TOP_ANONS = [];
19
    var TOP_POSTS = [];
20
    var TOP_NOTABLES = [];
21
    var NOTABLES_MAP = {};
22
    var MY_SCORE = 0;
23
24
    var BAKER = $('.op').find('.poster_id').text();
25
    var Subject = $('.op').find('.subject').text().split(' ');
26
    var BREAD_ID = 0;
27
    var BREAD_DATE = parseInt($('.op').find('time').attr('unixtime'));
28
    var LAST_DATE = BREAD_DATE;
29
30
    for (var n = 0; n < Subject.length; n++) {
31
        if (Subject[n].startsWith('#')) {
32
            BREAD_ID = parseInt(Subject[n].substr(1, Subject[n].length - 1));
33
        }
34
    }
35
36
    var LastIdFocus = "";
37
    var LastIdIndex = 0;
38
39
    function ApplyFilter() {
40
41
      browser.storage.local.get(['filter'], function(result) {
42
        var FILTER_ON = true;
43
        if (  result.filter === undefined){
44
          browser.storage.local.set({'filter': true}, function() {});
45
        }
46
        else {
47
          FILTER_ON = result.filter;
48
        }
49
50
        var Intros = $('.intro');
51
        for (var n = 0; n < Intros.length; n++) {
52
            if ($(Intros[n]).find('.poster_id').text() in SHILL_DB) {
53
                $(Intros[n]).parent().css('background-color', '#7b7b7b');
54
55
                if (FILTER_ON){
56
                  $(Intros[n]).parent().hide();
57
                  $(Intros[n]).parent().next().hide();
58
                }
59
                else {
60
                  $(Intros[n]).parent().show();
61
                  $(Intros[n]).parent().next().show();
62
                }
63
            }
64
        }
65
66
      });
67
68
69
    }
70
71
72
73
    function GetNotables() {
74
        var Intros = $('.intro');
75
        NOTABLES_MAP = {};
76
        for (var n = 0; n < Intros.length; n++) {
77
            if ($(Intros[n]).find('.poster_id').text() == BAKER) {
78
79
              var BodyText = $(Intros[n]).parent().find('.body').text().toLowerCase();
80
                if (BodyText.includes('#' + BREAD_ID) || BodyText.includes('#' + (BREAD_ID+1))) {
81
82
                var Lines = $(Intros[n]).parent().find('.body').find('p.body-line.ltr');
83
                for (var l = 0; l < Lines.length; l++) {
84
                    var Line = $(Lines[l]).find('a')
85
86
                    if (Line.length > 0) {
87
                        var post_id = parseInt($(Line[0]).text().substr(2));
88
                        if (post_id in GOOD_POSTS) {
89
                            NOTABLES_MAP[post_id] = 0;
90
                            if (post_id in POSTS_SCORE) {
91
                                NOTABLES_MAP[post_id] = POSTS_SCORE[post_id];
92
                            }
93
                        }
94
                    }
95
                }
96
              }
97
            }
98
        }
99
    }
100
101
    function CleanAnonsFromShills(){
102
      for (shill in SHILL_DB){
103
        delete UUID_DB[shill];
104
      }
105
      for (post in POST_TO_ANON){
106
        if (POST_TO_ANON[post] in SHILL_DB){
107
          delete POSTS_SCORE[post];
108
        }
109
      }
110
111
    }
112
113
    function CalcTop() {
114
        CleanAnonsFromShills();
115
        TOP_ANONS = [];
116
        var sorted = Object.keys(UUID_DB) //Create a list from the keys of your map.
117
            .sort( //Sort it ...
118
                function(a, b) { // using a custom sort function that...
119
                    // compares (the keys) by their respective values.
120
                    return UUID_DB[b] - UUID_DB[a];
121
                });
122
123
        for (var s = 0; s < sorted.length && s < 10; s++) {
124
            TOP_ANONS.push([sorted[s], UUID_DB[sorted[s]]]);
125
        }
126
        TOP_POSTS = [];
127
        var sorted = Object.keys(POSTS_SCORE) //Create a list from the keys of your map.
128
            .sort( //Sort it ...
129
                function(a, b) { // using a custom sort function that...
130
                    // compares (the keys) by their respective values.
131
                    return POSTS_SCORE[b] - POSTS_SCORE[a];
132
                });
133
134
        for (var s = 0; s < sorted.length && s < 10; s++) {
135
            TOP_POSTS.push([sorted[s], POSTS_SCORE[sorted[s]]]);
136
        }
137
138
        TOP_MY = [];
139
        var sorted = Object.keys(MY_POSTS) //Create a list from the keys of your map.
140
            .sort( //Sort it ...
141
                function(a, b) { // using a custom sort function that...
142
                    // compares (the keys) by their respective values.
143
                    return MY_POSTS[b] - MY_POSTS[a];
144
                });
145
146
        for (var s = 0; s < sorted.length && s < 10; s++) {
147
            TOP_MY.push([sorted[s], MY_POSTS[sorted[s]]]);
148
        }
149
150
151
        TOP_NOTABLES = [];
152
        var sorted = Object.keys(NOTABLES_MAP) //Create a list from the keys of your map.
153
            .sort( //Sort it ...
154
                function(a, b) { // using a custom sort function that...
155
                    // compares (the keys) by their respective values.
156
                    return NOTABLES_MAP[b] - NOTABLES_MAP[a];
157
                });
158
159
        for (var s = 0; s < sorted.length && s < 10; s++) {
160
            TOP_NOTABLES.push([sorted[s], NOTABLES_MAP[sorted[s]]]);
161
        }
162
163
164
165
166
    }
167
168
169
170
    function FloatingStats() {
171
      browser.storage.local.get(['filter'], function(result) {
172
        var FILTER_ON = true;
173
        if (  result.filter === undefined){
174
          browser.storage.local.set({'filter': true}, function() {});
175
        }
176
        else {
177
          FILTER_ON = result.filter;
178
        }
179
180
        $('.thread').find('.floating-menu').remove();
181
182
        //var NavHTML = '<nav class="floating-menu" style="font-family: sans-serif;background: #33434a;padding: 5px;width: 15%;z-index: 100;position: fixed;right: 0;top: 0;margin-top: 20px;margin-right: 10px;border-radius: 5px;display: block;font-size: 10px;font-family: monospace;color: #fff;">';
183
        ThreadPosts = parseInt($('#thread_stats_posts').text());
184
        UUIDs = parseInt($('#thread_stats_uids').text());
185
186
        var Posts = $('.post');
187
        ShowingPosts = -1;
188
189
190
        for (var n = 0; n < Posts.length; n++) {
191
            if ($(Posts[n]).css('display') != 'none') {
192
                ShowingPosts++;
193
            }
194
        }
195
        ShillCount = Object.keys(SHILL_DB).length;
196
        var NavHTML = '<nav class="floating-menu" style="font-family: sans-serif;background: #33434a;padding: 5px;width: 15%;z-index: 100;position: fixed;right: 0;top: 0;margin-top: 20px;margin-right: 10px;border-radius: 5px;display: block;font-size: 10px;font-family: monospace;color: #fff;">';
197
                NavHTML += '<div id="overflower" style="overflow:auto">';
198
        NavHTML += '<table style="width: 100%;">';
199
        NavHTML += '<tbody>';
200
        NavHTML += '<tr style="background-color: #33434a;"><td style="font-size: 10px;color: #fdf39e;font-weight: bold;">BREAD STATUS</td><td>' + BreadLifetime() + '</td><td>#' + BREAD_ID + '</td></tr>';
201
        NavHTML += '</tbody>';
202
        NavHTML += '</table>';
203
        NavHTML += '<div id="myProgress" style="width: 100%;background-color: grey;border-radius: 3px;">';
204
        NavHTML += '<div id="inner-bar" style="border-radius: 3px;background-color: #ac0;width: ' + parseInt((ThreadPosts / 751) * 100) + '%;transition: width .5s ease-in;height: 15px;background-size: 18px 18px;box-shadow: inset 0px 2px 8px rgba(255, 255, 255, .5), inset -1px -1px 0px rgba(0, 0, 0, .2);"></div>';
205
        NavHTML += '</div>';
206
207
208
        NavHTML += '<table style="width: 100%;"><tbody>';
209
        NavHTML += '<tr style="background-color: #33434a;"><td style="width: 78%;">TOTAL POSTS: </td><td style="font-weight: bold;">' + ThreadPosts + '</td></tr>';
210
211
212
213
214
            if (FILTER_ON){
215
              NavHTML += '<tr style="background-color: #33434a;"><td style="width: 75%;">FILTERED POSTS:</td><td style="color: #f74b3e;font-weight: bold;">' + parseInt((ThreadPosts - ShowingPosts)) + '</td></tr>';
216
            }
217
            else {
218
              NavHTML += '<tr style="background-color: #33434a;"><td style="width: 75%;">FILTERED POSTS:</td><td style="color: #f74b3e;font-weight: bold;">0</td></tr>';
219
            }
220
221
222
        NavHTML += '<tr style="background-color: #33434a;"><td style="width: 75%;">EST. SHILL COUNT:</td><td style="color: #f74b3e;font-weight: bold;">' + ShillCount + '</td></tr>';
223
        NavHTML += '<tr style="background-color: #33434a;"><td style="width: 75%;">EST. ANON COUNT:</td><td style="font-weight: bold;">' + (UUIDs - ShillCount) + '</td></tr>';
224
        NavHTML += '<tr style="background-color: #33434a;"><td style="width: 75%;">BREAD QUALITY:</td><td style=" color: #8BC34A; font-weight: bold; ">' + BreadQuality + '</td></tr>';
225
        NavHTML += '<tr style="background-color: #33434a;"><td style="width: 75%;">BAKER:</td><td style=" color: #c5d406; font-weight: bold;cursor:pointer" class="idfocus">' + BAKER + '</td></tr>';
226
        if (TOP_MY.length > 0) {
227
            NavHTML += '<tr style="background-color: #33434a;"><td style="width: 75%;font-size: 10px;color: #fdf39e;font-weight: bold;">YOUR SCORE:</td><td style="font-weight: bold;color: #8BC34A;">' + MY_SCORE + '</td></tr>';
228
        }
229
        NavHTML += '</tbody></table>';
230
        if (TOP_MY.length > 0) {
231
232
            NavHTML += '<h3 style="font-size: 10px;display: block;margin: 2px;color: #fdf39e;">YOUR TOP POSTS</h3>';
233
            NavHTML += '<table style="width: 100%;"><thead><tr><td>Post No.</td><td>SCORE</td></tr></thead>';
234
            NavHTML += '<tbody>';
235
            for (var n = 0; n < TOP_MY.length; n++) {
236
                NavHTML += '<tr style="background-color: #33434a;"><td style="width: 50%;color: #fcd;cursor:pointer" class="postfocus">' + TOP_MY[n][0] + '</td><td style="font-weight: bold;color: #8BC34A;">' + TOP_MY[n][1] + '</td></tr>';
237
            }
238
            NavHTML += '</tbody></table>';
239
        }
240
241
        if (TOP_NOTABLES.length > 0) {
242
            NavHTML += '<h3 style="font-size: 10px;display: block;margin: 2px;color: #fdf39e;">TOP 10 NOTABLES</h3>';
243
            NavHTML += '<table style="width: 100%;"><thead><tr><td>Post No.</td><td>POSTER</td><td>SCORE</td></tr></thead>';
244
            NavHTML += '<tbody>';
245
            for (var n = 0; n < TOP_NOTABLES.length; n++) {
246
                if ( TOP_NOTABLES[n][1] > 0){
247
                  NavHTML += '<tr style="background-color: #33434a;"><td style="width: 50%;color: #fcd;cursor:pointer" class="postfocus">' + TOP_NOTABLES[n][0] + '</td><td style="color: #bcedfd;cursor:pointer" class="idfocus">' + POST_TO_ANON[TOP_NOTABLES[n][0]] + '</td><td style="font-weight: bold;color: #8BC34A;">' + TOP_NOTABLES[n][1] + '</td></tr>';
248
                }
249
            }
250
251
            NavHTML += '</tbody></table>';
252
        }
253
254
255
        if (TOP_POSTS.length > 0) {
256
            NavHTML += '<h3 style="font-size: 10px;display: block;margin: 2px;color: #fdf39e;">TOP 10 POSTS</h3>';
257
            NavHTML += '<table style="width: 100%;"><thead><tr><td>Post No.</td><td>POSTER</td><td>SCORE</td></tr></thead>';
258
            NavHTML += '<tbody>';
259
            for (var n = 0; n < TOP_POSTS.length; n++) {
260
              if ( TOP_POSTS[n][1] > 0){
261
                NavHTML += '<tr style="background-color: #33434a;"><td style="width: 50%;color: #fcd;cursor:pointer" class="postfocus">' + TOP_POSTS[n][0] + '</td><td style="color: #bcedfd;cursor:pointer" class="idfocus">' + POST_TO_ANON[TOP_POSTS[n][0]] + '</td><td style="font-weight: bold;color: #8BC34A;">' + TOP_POSTS[n][1] + '</td></tr>';
262
              }
263
            }
264
265
            NavHTML += '</tbody></table>';
266
        }
267
268
269
270
        NavHTML += '<h3 style="font-size: 10px;display: block;margin: 2px;color: #fdf39e;">TOP 10 ANONS</h3>';
271
        NavHTML += '<table style="width: 100%;"><thead><tr><td>ID</td><td>POSTS</td><td>SCORE</td></tr></thead>';
272
        NavHTML += '<tbody>';
273
        for (var n = 0; n < TOP_ANONS.length; n++) {
274
            if ( TOP_ANONS[n][1] > 0){
275
              NavHTML += '<tr style="background-color: #33434a;"><td style="width: 50%;color: #bcedfd;cursor:pointer" class="idfocus">' + TOP_ANONS[n][0] + '</td><td style="font-weight: bold;">' + UUID_POST_COUNT[TOP_ANONS[n][0]] + '</td><td style="font-weight: bold;color: #8BC34A;">' + TOP_ANONS[n][1] + '</td></tr>';
276
            }
277
        }
278
        NavHTML += '</tbody>';
279
280
        NavHTML += '</table><br> ';
281
        NavHTML += '<table style="width:100%"><tbody><tr>';
282
        NavHTML += '<td style="width:33%"><a href="https://8ch.net/qresearch/catalog.html" style="font-size: 10px;display: block;margin: 2px;text-align: center;color:#fff;text-decoration: none;">◀ CATALOG</a></td>';
283
        NavHTML += '<td style="width:33%"><a href="#bottom" style="font-size: 10px;display: block;margin: 2px;text-align: center;color:#fdf39e;text-decoration: none;">▼ BOTTOM ▼</a></td>';
284
        NavHTML += '<td style="width:33%"><a href="https://8ch.net/patriotsfight/catalog.html" style="font-size: 10px;display: block;margin: 2px;text-align: center;color:#fff;text-decoration: none;">PF ▶</a></td>';
285
        NavHTML += '<tr></tbody></table>';
286
287
              NavHTML += '</div>';
288
        NavHTML += '</nav>';
289
290
        $('.thread').prepend(NavHTML);
291
        $('#overflower').css('max-height',($(window).height()-50) + 'px');
292
293
294
        $(".postfocus").on("click", function() {
295
296
            var Bodies = $('.post').find('.body');
297
            for (var n = 0; n < Bodies.length; n++) {
298
                if ($(Bodies[n]).parent().find('.post_no').text().substr(3) == $(this).text()) {
299
                    $([document.documentElement, document.body]).animate({
300
                        scrollTop: $($(Bodies[n])).offset().top - 350
301
                    }, 400);
302
                    $($(Bodies[n])).parent().fadeTo(100, 1).fadeTo(100, 0.5).fadeTo(100, 1).fadeTo(100, 0.5).fadeTo(100, 1).fadeTo(100, 1).fadeTo(100, 0.5).fadeTo(100, 1).fadeTo(100, 0.5).fadeTo(100, 1);
303
                    break;
304
                }
305
            }
306
        });
307
308
        $(".idfocus").on("click", function() {
309
            var Scrolled = false;
310
            var Bodies = $('.post').find('.body');
311
            for (var n = LastIdIndex; n < Bodies.length; n++) {
312
313
                if (LastIdFocus != $(this).text()) {
314
                    LastIdFocus = $(this).text();
315
                    n = 0;
316
                }
317
                if ($(Bodies[n]).parent().find('.poster_id').text() == $(this).text()) {
318
                    LastIdFocus = $(this).text();
319
                    if (n < Bodies.length) {
320
                        Scrolled = true;
321
                        $([document.documentElement, document.body]).animate({
322
                            scrollTop: $($(Bodies[n])).offset().top - 350
323
                        }, 400);
324
                        LastIdIndex = (n + 1);
325
                        $($(Bodies[n])).parent().fadeTo(100, 1).fadeTo(100, 0.5).fadeTo(100, 1).fadeTo(100, 0.5).fadeTo(100, 1).fadeTo(100, 1).fadeTo(100, 0.5).fadeTo(100, 1).fadeTo(100, 0.5).fadeTo(100, 1);
326
                    }
327
328
                    break;
329
                }
330
            }
331
            if (!Scrolled) {
332
                LastIdIndex = 0;
333
                for (var n = LastIdIndex; n < Bodies.length; n++) {
334
335
                    if (LastIdFocus != $(this).text()) {
336
                        LastIdFocus = $(this).text();
337
                        n = 0;
338
                    }
339
                    if ($(Bodies[n]).parent().find('.poster_id').text() == $(this).text()) {
340
                        LastIdFocus = $(this).text();
341
                        if (n < Bodies.length) {
342
                            Scrolled = true;
343
                            $([document.documentElement, document.body]).animate({
344
                                scrollTop: $($(Bodies[n])).offset().top - 350
345
                            }, 400);
346
                            LastIdIndex = (n + 1);
347
                            $($(Bodies[n])).parent().fadeTo(100, 1).fadeTo(100, 0.5).fadeTo(100, 1).fadeTo(100, 0.5).fadeTo(100, 1).fadeTo(100, 1).fadeTo(100, 0.5).fadeTo(100, 1).fadeTo(100, 0.5).fadeTo(100, 1);
348
                        }
349
350
                        break;
351
                    }
352
                }
353
            }
354
        });
355
356
357
                });
358
359
360
    }
361
362
    function NiceDesign() {
363
        $('.fileinfo').hide();
364
        $('hr').hide();
365
        $('.post').css('width', '80%');
366
        $('.post').css('border-radius', '6px');
367
        $('.post').css('border-width', '1px');
368
        $('.post').css('border-color', '#acc2cc');
369
        $('.post').css('border-style', 'solid');
370
        $('.post').css('padding', '10px');
371
        $('.post-image').css('border-radius', '10px');
372
        $('.op').css('background', '#ffffff');
373
        $('.op').css('padding', '20px');
374
        $('.op').css('width', '95%');
375
        $('time').css('color', '#000000');
376
        $('.post_no').css('color', '#f56017');
377
        $('.post_no').css('font-weight', 'bold');
378
        $('.poster_id').css('font-weight', 'bold');
379
        $('.poster_id').css('color', '#0035ff');
380
381
382
383
384
    }
385
386
    function BreadLifetime() {
387
        var Total = (LAST_DATE - BREAD_DATE);
388
        var Hours = Math.floor(Total / 3600);
389
        var Minutes = (Math.floor(Total / 60)) % 60;
390
        var Result = "";
391
        if (Hours > 0) {
392
            Result += Hours + "h ";
393
        }
394
        Result += Minutes + "m ";
395
        Result += (Total % 60) + "s ";
396
397
        return Result;
398
    }
399
400
    function SimpleShillFinder() {
401
        SHILL_SCORE = {};
402
        UUID_DB = {};
403
        SHILL_DB = {};
404
        var Intros = $('.intro');
405
        for (var n = 0; n < Intros.length; n++) {
406
            //if( typeof ID !== 'undefined'){
407
//              POST_TO_ANON[$(Intros[n]).find('.post_no').text().substr(3)] = ID;
408
            //}
409
410
            while ($(Intros[n]).find('.poster_id').text() == BAKER){
411
                POST_TO_ANON[$(Intros[n]).find('.post_no').text().substr(3)] = BAKER;
412
                n++; // Skipping baker
413
            }
414
            var ID = $(Intros[n]).find('.poster_id').text();
415
            POST_TO_ANON[$(Intros[n]).find('.post_no').text().substr(3)] = ID;
416
            var Score = 0;
417
            if (ID != "") {
418
              if (ID in SHILL_DB){
419
                BAD_POSTS[$(Intros[n]).find('.post_no').text().substr(3)] = ID;
420
              }
421
              else {
422
                UUID_DB[ID] = 0;
423
                if ($(Intros[n]).find('.name').text() != "Anonymous" && $(Intros[n]).find('.name').text() != "Q" && $(Intros[n]).find('.name').text() != "" && $(Intros[n]).find('.name').text() != "Q " && $(Intros[n]).find('.name').text() != "Anonymous (You)") {
424
                    //console.log(ID + " : Namefag");
425
                    Score++;
426
                }
427
                if ($(Intros[n]).parent().find('.video-container-hooktube').length > 0) {
428
                    //console.log(ID + " : Hooktube");
429
                    Score++;
430
                }
431
                if ($(Intros[n]).parent().find('span.heading').length > 0) {
432
                    var RedTexts = $(Intros[n]).parent().find('span.heading');
433
                    var TotalLength = 0;
434
                    for (var r = 0; r < RedTexts.length; r++) {
435
                        TotalLength += $(RedTexts[r]).text().length;
436
                    }
437
                    if (TotalLength > 1000) {
438
                        Score++;
439
440
                    }
441
                }
442
                var BodyText = $(Intros[n]).parent().find('.body').text();
443
                if (BodyText.length - BodyText.replace(/[A-Z]/g, '').length > 1000) {
444
                    Score++;
445
                }
446
                if ($(Intros[n]).find('.mentioned').children().length > 3) {
447
                    $(Intros[n]).parent().css('background-color', '#ffdada');
448
                }
449
450
451
              var PostCount = $(Intros[n]).find('.posts_by_id').text();
452
              UUID_POST_COUNT[$(Intros[n]).find('.poster_id').text()] = parseInt(PostCount.substr(2, PostCount.length - 2))
453
              if($(Intros[n]).find('.capcode').text() == "## Board Owner" || $(Intros[n]).find('.name').text() == "Q" ||  $(Intros[n]).find('.name').text() == "Q " ){
454
                  Score = 0;
455
              }
456
457
              if (Score > 0) {
458
                  SHILL_DB[ID] = 0;
459
                  SHILL_SCORE[ID] = Score+1;
460
                  BAD_POSTS[$(Intros[n]).find('.post_no').text().substr(3)] = ID;
461
                  //BanID(Intros[n]);
462
              }
463
              else {
464
                  GOOD_POSTS[$(Intros[n]).find('.post_no').text().substr(3)] = ID;
465
              }
466
467
            }
468
469
470
            }
471
472
        };
473
        LAST_DATE = parseInt($(Intros[Intros.length - 1]).find('time').attr('unixtime'));
474
    }
475
476
    function AdvancedShillFinder(){
477
      var Intros = $('.intro');
478
      for (var n = 0; n < Intros.length; n++) {
479
        if (UUID_POST_COUNT[$(Intros[n]).find('.poster_id').text()] > 6){
480
          if(UUID_DB[$(Intros[n]).find('.poster_id').text()] == 0 || UUID_POST_COUNT[$(Intros[n]).find('.poster_id').text()] > 4*UUID_DB[$(Intros[n]).find('.poster_id').text()] ){
481
            SHILL_DB[$(Intros[n]).find('.poster_id').text()] = 0;
482
          }
483
        }
484
      }
485
    }
486
487
    function CalcAllPosts(){
488
      var Intros = $('.intro');
489
      for (var n = 0; n < Intros.length; n++) {
490
        var ID = $(Intros[n]).find('.poster_id').text();
491
        var Quotes = $(Intros[n]).parent().find('.body').find('a');
492
        var uniq = {};
493
        for (var q = 0; q < Quotes.length; q++) {
494
            uniq[Quotes[q].innerText.substr(2)] = true;
495
        }
496
        for (u in uniq) {
497
            if (u in BAD_POSTS) {
498
                UUID_DB[ID] -= 3;
499
                $(Intros[n]).css("opacity", "0.6");
500
            }
501
        }
502
503
        var Replies = $(Intros[n]).find('.mentioned').children();
504
        POST_REPLIES[ID] = $(Intros[n]).find('.mentioned').children().length;
505
506
507
        for (var r = 0; r < Replies.length; r++) {
508
            var post_id = $(Replies[r]).text().substr(2);
509
            if (post_id in GOOD_POSTS && GOOD_POSTS[post_id] != ID) {
510
                UUID_DB[ID]++;
511
                if ($(Intros[n]).find('.post_no').text().substr(3) in POSTS_SCORE) {
512
                    //POST_TO_ANON[$(IDs[n]).parent().parent().find('.post_no').text().substr(3)] = ID;
513
                    POSTS_SCORE[$(Intros[n]).find('.post_no').text().substr(3)]++;
514
                } else {
515
                    //POST_TO_ANON[$(IDs[n]).parent().parent().find('.post_no').text().substr(3)] = ID;
516
                    POSTS_SCORE[$(Intros[n]).find('.post_no').text().substr(3)] = 1;
517
                }
518
            }
519
        }
520
      }
521
    }
522
523
524
browser.storage.local.get(['filter'], function(result) {
525
  if (  result.filter === undefined){
526
    browser.storage.local.set({'filter': true}, function() {});
527
  }
528
  else {
529
530
  }
531
});
532
533
    function start() {
534
      browser.storage.local.get(['plugin'], function(result) {
535
        var PLUGIN_ON = true;
536
        if (  result.plugin === undefined){
537
          browser.storage.local.set({'plugin': true}, function() {});
538
        }
539
        else {
540
          PLUGIN_ON = result.plugin;
541
        }
542
        if(PLUGIN_ON){
543
        setTimeout(function() {
544
            if (LastThreadPosts != $('#thread_stats_posts').text()) {
545
                LastThreadPosts = $('#thread_stats_posts').text();
546
547
                ShillCount = 0;
548
                UUIDs = 0;
549
                ThreadPosts = 0;
550
                ShowingPosts = 0;
551
                BreadQuality = 0;
552
                UUID_DB = {}
553
                UUID_POST_COUNT = {}
554
                POST_REPLIES = {}
555
                SHILL_SCORE = {}
556
                SHILL_DB = {}
557
                MY_POSTS = {};
558
                BAD_POSTS = {};
559
                GOOD_POSTS = {};
560
                POSTS_SCORE = {};
561
                POST_TO_ANON = {};
562
                TOP_ANONS = [];
563
                TOP_POSTS = [];
564
                TOP_NOTABLES = [];
565
                NOTABLES_MAP = {};
566
                MY_SCORE = 0;
567
568
                NiceDesign();
569
                SimpleShillFinder();
570
                CalcAllPosts();
571
                AdvancedShillFinder();
572
                GetNotables();
573
                CalcTop();
574
                ApplyFilter();
575
                AnonCount = Object.keys(UUID_DB).length;
576
                ShillCount = Object.keys(SHILL_DB).length;
577
                PostSum = 0;
578
                for (var v = 0; v < TOP_POSTS.length; v++) {
579
                    PostSum += TOP_POSTS[v][1];
580
                }
581
                BreadQuality = parseInt(((AnonCount / (AnonCount + ShillCount)) * 10) * PostSum);
582
                FloatingStats();
583
            }
584
585
            start();
586
            // Every 3 sec
587
        }, 1000);
588
589
      }
590
    });
591
592
    }
593
594
595
    browser.storage.local.get(['plugin'], function(result) {
596
      var PLUGIN_ON = true;
597
      if (  result.plugin === undefined){
598
        browser.storage.local.set({'plugin': true}, function() {});
599
      }
600
      else {
601
        PLUGIN_ON = result.plugin;
602
      }
603
      if(PLUGIN_ON){
604
605
606
        if (!$('#auto_update_status').is(':checked')) {
607
            $('#auto_update_status').click();
608
        }
609
        start();
610
611
      }
612
613
    });
614
615
    $( window ).resize(function() {
616
      $('#overflower').css('max-height',$(window).height()-50 + 'px');
617
    });
618
});