SHOW:
|
|
- or go back to the newest paste.
1 | /* | |
2 | * Football Ultimate Cup Keyboards (FUCK) | |
3 | - | * v 0.4 |
3 | + | * v 0.5 |
4 | * Особенности: | |
5 | * - золотой гол считается за один, даже если это квадрипл, ибо нехуй | |
6 | */ | |
7 | $(function(){ | |
8 | try { clearInterval(window.fuck_updater) } catch(e){} | |
9 | ||
10 | var $ = window.jQuery | |
11 | , config_lines = $('.oppost-wrapper .post-message').html().split('<br>').filter(function(a){ return a.substr(0, 1) === '%' }) | |
12 | , config = config_lines.length === 0 ? undefined : config_lines[0].substr(1) | |
13 | , config_team_names = config | |
14 | , team_names = undefined === config ? [ '#1', '#2' ] : config_team_names.split('|').map(function(a){ return a.trim() }) | |
15 | ||
16 | if(undefined === config){ | |
17 | return false | |
18 | } | |
19 | ||
20 | $('body') | |
21 | .append( | |
22 | $('<style>') | |
23 | .html('.fuck-scoreboard{position:fixed;bottom:0px;left:0px;width:270px;height:130px;border:1px solid #ccc;padding:10px 5px;background-color:#ddd;text-align:center;}.fuck-scoreboard-one{float:left;width:125px;height:100%;}.fuck-scoreboard-one-score{height:90px;font-size:45px;font-weight:bold;line-height:90px;}.fuck-scoreboard-one-team{height:20px;color:#888;font-size:14px;line-height:20px;}') | |
24 | ) | |
25 | .append( | |
26 | $('<div>') | |
27 | .addClass('fuck-scoreboard') | |
28 | .append( | |
29 | $('<div>') | |
30 | .addClass('fuck-scoreboard-one') | |
31 | .append( | |
32 | $('<div>') | |
33 | .addClass('fuck-scoreboard-one-score') | |
34 | .html('0') | |
35 | ) | |
36 | .append( | |
37 | $('<div>') | |
38 | .addClass('fuck-scoreboard-one-team') | |
39 | .html(team_names[0]) | |
40 | ) | |
41 | ) | |
42 | .append( | |
43 | $('<div>') | |
44 | .addClass('fuck-scoreboard-one') | |
45 | .append( | |
46 | $('<div>') | |
47 | .addClass('fuck-scoreboard-one-score') | |
48 | .html('0') | |
49 | ) | |
50 | .append( | |
51 | $('<div>') | |
52 | .addClass('fuck-scoreboard-one-team') | |
53 | .html(team_names[1]) | |
54 | ) | |
55 | ) | |
56 | ) | |
57 | ||
58 | window.fuck_updater = setInterval(function(){ | |
59 | - | .append('Гол! Пенальти забивает команда ' + team_names[team_now] + '. Счёт <strong>' + score[0] + ':' + score[1] + '</strong>.') |
59 | + | |
60 | , penalty = false | |
61 | , ended = false | |
62 | ||
63 | $('.post-wrapper').each(function(n, el){ | |
64 | n++ | |
65 | el = $(el) | |
66 | ||
67 | var time_now = false | |
68 | if(n <= 150){ | |
69 | time_now = 1 | |
70 | } else if(n > 200 && n <= 350){ | |
71 | time_now = 2 | |
72 | } else if(!ended && n > 350 && score[0] === score[1]){ | |
73 | // до золотого гола | |
74 | time_now = 3 | |
75 | } | |
76 | ||
77 | var post_num = el.attr('id').replace(/[^0-9]/g, '') | |
78 | , last_digit = parseInt( post_num.substr(-1) ) | |
79 | , is_double = post_num.substr(-1, 1) === post_num.substr(-2, 1) | |
80 | , is_triple = is_double && ( post_num.substr(-1, 1) === post_num.substr(-3, 1) ) | |
81 | , is_quad = is_triple && ( post_num.substr(-1, 1) === post_num.substr(-4, 1) ) | |
82 | - | .append((time_now === 3 ? 'Золотой гол' : (is_quad ? 'Два гола' : 'Гол')) + ' забивает команда ' + team_names[team_now] + '! Счёт <strong>' + score[0] + ':' + score[1] + '</strong>.') |
82 | + | |
83 | ||
84 | el.find('.postbtn-reply-href').html(post_num) | |
85 | el.find('.post-message > span.fuck-message').remove() | |
86 | ||
87 | if(false !== time_now){ | |
88 | // игра идёт | |
89 | if(true === penalty){ | |
90 | // забит пенальти | |
91 | score[team_now]++ | |
92 | el.find('.post-message').append( | |
93 | $('<span>') | |
94 | .addClass('fuck-message') | |
95 | .css('color', 'green') | |
96 | .append('<br><br>') | |
97 | .append('Гол! Пенальти забивает команда ' + team_names[team_now] + '. Счёт ' + team_names[0] + ' <strong>' + score[0] + ':' + score[1] + '</strong> ' + team_names[1] + '.') | |
98 | ) | |
99 | ||
100 | penalty = false | |
101 | if(n > 350){ ended = true } | |
102 | } else if(is_triple && !is_quad){ | |
103 | // назначен пенальти | |
104 | penalty = true | |
105 | el.find('.post-message').append( | |
106 | $('<span>') | |
107 | .addClass('fuck-message') | |
108 | .css('color', 'green') | |
109 | .append('<br><br>') | |
110 | .append('Назначается пенальти!') | |
111 | ) | |
112 | } else if(is_double || is_quad){ | |
113 | // гол немедленно | |
114 | score[team_now] += is_quad && time_now !== 3 ? 2 : 1 | |
115 | el.find('.post-message').append( | |
116 | $('<span>') | |
117 | .addClass('fuck-message') | |
118 | .css('color', 'green') | |
119 | .append('<br><br>') | |
120 | .append((time_now === 3 ? 'Золотой гол' : (is_quad ? 'Два гола' : 'Гол')) + ' забивает команда ' + team_names[team_now] + '! Счёт ' + team_names[0] + ' <strong>' + score[0] + ':' + score[1] + '</strong> ' + team_names[1] + '.') | |
121 | ) | |
122 | if(n > 350){ ended = true } | |
123 | } | |
124 | } | |
125 | }) | |
126 | ||
127 | $('.fuck-scoreboard-one').each(function(n, el){ | |
128 | $(el).find('.fuck-scoreboard-one-score').html(score[n]) | |
129 | }) | |
130 | ||
131 | }, 1000) | |
132 | }) |