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