Vote Explosion Effect (o_o)

Robi BUUUM.

当前为 2016-02-09 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name            Vote Explosion Effect (o_o)
Edytor
Ustawienia
Save to diskZapiszAnuluj zmianyUstawienia domyślneZamknijRun syntax checkAdres URL aktualizacji:
https://greasyfork.org/scripts/16867-vote-explosion-effect-o-o/code/Vote%20Explosion%20Effect%20(o_o).user.js
SearchReplaceJump to lineInsert constructorAuto-Indent all

1
// ==UserScript==
2
// @name            Vote Explosion Effect (o_o)
3
// @namespace       voteexplosion
4
// @description     Robi BUUUM.
5
// @include         http://*.wykop.pl/*
6
// @version         1.5
7
// ==/UserScript==
8
/*global $, console */
9
function getParticlePosition(t,e,a){"use strict";var i=($(window).width(),$(window).height(),t-Math.floor(Math.random()*options.blastRadius+1-options.blastRadius/2)),s=e-Math.floor(Math.random()*options.blastRadius+1-options.blastRadius/2);return" particlered"==a?s+=100:s-=100,[i,s]}function randomRotate(){return Math.floor(1600*Math.random()+1)}function microtime(t){"use strict";var e=(new Date).getTime()/1e3,a=parseInt(e,10);return t?e:Math.round(1e3*(e-a))/1e3+" "+a}var options={blastRadius:200,particles:20,subparticles:10};$("head").append('<style type="text/css">.particlegreen { text-shadow: 0 0 10px #3b915f;color: #3b915f;transition: 1s all cubic-bezier(0.000, 0.895, 0.985, 1.005);}.particlered{text-shadow: 0 0 10px #c0392b;color: #c0392b;transition: 2s all cubic-bezier(0.000, 0.895, 0.985, 1.005);}.particle {position: absolute;pointer-events: none;z-index: 696969;-webkit-transform: translate3d(0, 0, 10px);-webkit-backface-visibility: hidden;-webkit-perspective: 1000;}.subparticle {position: absolute;pointer-events: none;z-index: 696969;-webkit-transform: translate3d(0, 0, 10px);-webkit-backface-visibility: hidden;-webkit-perspective: 1000;}.votersContainer {min-height: 18px;margin-bottom: 6px;}</style>'),$("body").on("click","a.button.mikro.ajax",function(){"use strict";var t,e=$(this),a=e.offset(),i=a.left,s=a.top,o=$("body"),r="particle_"+Math.random().toString(36).substring(3),n="particle "+r;if(e.find(".affect").length||e.find(".fa-minus").length)var t=" particlered",c='<i class="fa fa-minus"></i>';else var t=" particlegreen",c='<i class="fa fa-plus lcontrast affect"></i>';for(var l=0;l<options.particles;l++){var f=getParticlePosition(i,s,t),p="particle_"+Math.random().toString(36).substring(7),d=randomRotate();e.clone().appendTo(o).html(c).attr("id",p).attr("class",n+t).attr("href","").css("top",s).css("left",i).fadeIn(1,function(){$("#"+p).css("top",f[1]).css("left",f[0]).css("transform","rotate("+d+"deg)").fadeOut(1e3,function(){$("."+r).each(function(){$(this).remove()})})})}}),$("body").on("click","a.ajax.button.folNeutral, a.ajax.button.folObserved",function(){"use strict";var t=$(this),e=t.offset(),a=e.left,i=e.top,s=$("body"),o="subparticle_"+Math.random().toString(36).substring(3),r="subparticle "+o;if(console.log(t.attr("class")),t.hasClass("folObserved"))var n=" particlered",c='<i class="fa fa-eye-slash"></i>';else var n=" particlegreen",c='<i class="fa fa-eye"></i>';for(var l=0;l<options.subparticles;l++){var f=getParticlePosition(a,i,n),p="subparticle"+Math.random().toString(36).substring(7),d=randomRotate();t.clone().appendTo(s).html(c).attr("id",p).attr("class",r+n).attr("href","").css("top",i).css("left",a).fadeIn(1,function(){$("#"+p).css("top",f[1]).css("left",f[0]).css("transform","rotate("+d+"deg)").fadeOut(1e3,function(){$("."+o).each(function(){$(this).remove()})})})}});

// @namespace       voteexplosion
// @description     Robi BUUUM.
// @include         http://*.wykop.pl/*
// @version         2.0
// ==/UserScript==

//                                     88
//                                     ""
//
//   ,adPPYba,  8b,dPPYba,   ,adPPYba, 88  ,adPPYba,
//  a8"     "8a 88P'    "8a a8"     "" 88 a8P_____88
//  8b       d8 88       d8 8b         88 8PP"""""""
//  "8a,   ,a8" 88b,   ,a8" "8a,   ,aa 88 "8b,   ,aa
//   `"YbbdP"'  88`YbbdP"'   `"Ybbd8"' 88  `"Ybbd8"'
//              88                    ,88
//              88                  888P"




var options = {
    particleSpread:        150,
    particleCount:          20
};

if(localStorage.getItem("particleSpread")) {
    options.particleSpread = localStorage.getItem("particleSpread");
}

if(localStorage.getItem("particleCount")) {
    options.particleCount = localStorage.getItem("particleCount");
}


//                                88
//              ,d                88
//              88                88
//  ,adPPYba, MM88MMM 8b       d8 88  ,adPPYba,
//  I8[    ""   88    `8b     d8' 88 a8P_____88
//   `"Y8ba,    88     `8b   d8'  88 8PP"""""""
//  aa    ]8I   88,     `8b,d8'   88 "8b,   ,aa
//  `"YbbdP"'   "Y888     Y88'    88  `"Ybbd8"'
//                        d8'
//                       d8'


$('head').append('<style type="text/css">\
                    .particleGreen {\
                        color: #3b915f;\
                    }\
                    .particleGray {\
                        color: #999;\
                    }\
                    .particleGolden {\
                        color: #c7a054;\
                    }\
                    .particleRed {\
                        color: #c0392b;\
                    }\
                    .particle {\
                        position: absolute;\
                        pointer-events: none;\
                        z-index: 696969;\
                        transition: 1.5s all cubic-bezier(0.000, 0.895, 0.985, 1.005);\
                    }\
                    .particle i.fa {\
                        font-size: 1.5rem;\
                    }\
                    .votersContainer {\
                        min-height: 18px;\
                        margin-bottom: 6px;\
                    }\
                    body li.entry ul.responsive-menu b a.affect {\
                        color: #c0392b !important;\
                    }\
                    body li.entry .lcontrast:hover ul.responsive-menu b a.affect {\
                        color: #c0392b !important;\
                    }\
                 </style>');



//     ad88                         88                  88
//    d8"                           88                  ""
//    88                            88
//  MM88MMM 88       88 8b,dPPYba,  88   ,d8  ,adPPYba, 88  ,adPPYba,
//    88    88       88 88P'   `"8a 88 ,a8"  a8"     "" 88 a8P_____88
//    88    88       88 88       88 8888[    8b         88 8PP"""""""
//    88    "8a,   ,a88 88       88 88`"Yba, "8a,   ,aa 88 "8b,   ,aa
//    88     `"YbbdP'Y8 88       88 88   `Y8a `"Ybbd8"' 88  `"Ybbd8"'
//                                                     ,88
//                                                   888P"



function getParticlePosition(x, y, direction) {

    'use strict';

    var randomX = x - Math.floor((Math.random() * options.particleSpread) + 1 - (options.particleSpread / 2)),
        randomY = y - Math.floor((Math.random() * options.particleSpread) + 1 - (options.particleSpread / 2)),
        randomDirection = Math.floor((Math.random() * 100) + 1);

    if(direction == 'down') {
        randomY = randomY + randomDirection;
    } else {
        randomY = randomY - randomDirection;
    }

    return [randomX, randomY];
}

function randomRotate() {
    return Math.floor((Math.random() * 360) + 1);
}

function randomZoom() {
    return 2 - (Math.floor((Math.random() * 200) + 1) / 100);
}

function particleExplode(iconClass, colorClass, direction, click) {

    'use strict';

    var body = $('body'),
        posX = click.pageX,
        posY = click.pageY,
        particleRandomClass = 'particle_' + Math.random().toString(36).substring(4),
        particlesArray = [],
        particle = '';

    for (var i = 0; i < options.particleCount; i++) {
        var particleID = 'particle_' + Math.random().toString(36).substring(4),
            particleClass = 'particle ' + colorClass + ' ' + particleRandomClass,
            particleStyle = 'top: ' + posY + 'px; left: ' + posX + 'px;',
            particle = particle + '<div class="' + particleClass + '" style="' + particleStyle + '" id="' + particleID + '"><i class="fa ' + iconClass + '"></i></div>';

            particlesArray[i] = particleID;
    }

    body.append(particle);

    for (var i = 0; i < options.particleCount; i++) {
        var particlePosition = getParticlePosition(posX, posY, direction),
            rotate = randomRotate(),
            zoom = randomZoom(),
            fadeOutTime = 300 + Math.floor((Math.random() * 1200) + 1);
        $('#' + particlesArray[i])
        .fadeIn(1, function(){
            $(this)
                .css('top', particlePosition[1] + 'px')
                .css('left', particlePosition[0] + 'px')
                .css('transform', 'rotate(' + rotate + 'deg) scale(' + randomZoom() + ')')
                .fadeOut(fadeOutTime, function(){
                    $(this).remove();
                });
        });
    }
}




//     ad88 88
//    d8"   ""
//    88
//  MM88MMM 88 8b,     ,d8 8b       d8
//    88    88  `Y8, ,8P'  `8b     d8'
//    88    88    )888(     `8b   d8'
//    88    88  ,d8" "8b,    `8b,d8'
//    88    88 8P'     `Y8     Y88'
//                             d8'
//                            d8'


if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
    // fajerfoksy chodzą źle, trzeba zmniejszyć liczbę cząsteczków :<
    options.particleCount = 10;
}


//  88,dPYba,,adPYba,   ,adPPYba, 8b,dPPYba,  88       88
//  88P'   "88"    "8a a8P_____88 88P'   `"8a 88       88
//  88      88      88 8PP""""""" 88       88 88       88
//  88      88      88 "8b,   ,aa 88       88 "8a,   ,a88
//  88      88      88  `"Ybbd8"' 88       88  `"YbbdP'Y8


$('.dropdown.right.m-hide div ul li:last').before('<li><a href="#" title="" id="openSettingsWindow"><i class="fa fa-wrench"></i> <span>opcje skryptu</span></a></li>');

$(document).on('click', '#openSettingsWindow', function(){
    
    var userNick = $('.dropdown-show.auto > img.avatar').attr('alt');
    
    if(localStorage.getItem("particleSpread")) {
        var particleSpread = localStorage.getItem("particleSpread");
    } else {
        var particleSpread = options.particleSpread;
    }

    if(localStorage.getItem("particleCount")) {
        var particleCount = localStorage.getItem("particleCount");
    } else {
        var particleCount = options.particleCount;
    }
        
    var settingsForm = '<br>\
                            <p>Tutaj możesz zmienić ustawienia skryptu.</p>\
                            <br>\
                                <label for="particleSpread">wielkość wybuchu (px)</label>\
                                <input type="text" class="form-control" id="particleSpread" value="' + particleSpread + '">\
                            <br>\
                            <br>\
                                <label for="particleCount">liczba cząsteczek (px)</label>\
                                <input type="text" class="form-control" id="particleCount" value="' + particleCount + '">\
                            <br>\
                            <div style="margin: 15px; text-align: center;" id="msgContainer">Zmiany zapisują się automatycznie.</div>\
                            <div style="text-align: center;" id="msgContainer">\
                                <input class="bigred closepreview" style="text-align:center; cursor: pointer;" type="button" value="zapisz ustawienia" id="">\
                            </div>',
        settingsPropaganda = '<br><hr><br>\
                                <img src="http://xs.cdn03.imgwykop.pl/c3397992/Dreszczyk_sBtjObQZ5c,q48.jpg" style="float:left; margin-right: 10px;">Cześć ' + userNick + '. Tutaj twórca tego skryptu, @Dreszczyk. Jeżeli chcesz podziękować z ten skrypt, to wiedz, że bardzo lubie <a href="http://www.wykop.pl/ludzie/Dreszczyk/">subskrybowanie mojego profilu</a>.',
        settingsWindow = '<div id="violationContainer">\
                                <div class="overlay" style="display: block;"></div>\
                                <div id="zgloszenie" style="display: none;" class="normal m-set-fullwidth m-reset-top m-reset-margin m-reset-left">\
                                    <form id="scriptSettings">\
                                        <div class="header">\
                                            <a href="#" title="zamknij" class="fright close"><span class="icon inlblk mini closepreview"><i class="fa fa-times"></i></span></a>\
                                            <span class="title">Vote Explosion Script - ustawienia</span>\
                                        </div>\
                                        <div class="view" style="max-height: initial;">' + settingsForm + '' + settingsPropaganda + '</div>\
                                    </form>\
                                </div>\
                            </div>';
    
    $('body').prepend(settingsWindow).find('#zgloszenie').fadeIn();
});

$(document).on('click', 'div.overlay', function(){
    $('#violationContainer').remove();
});

$(document).on('change', '#scriptSettings input', function(){
    localStorage.setItem($(this).attr('id'), $(this).val());
    options[$(this).attr('id')] = $(this).val();
    $('#msgContainer').html('Zmiany zapisują się automatycznie - <b>zapisane</b>.');
});


//              88
//              88
//              88
//  8b,dPPYba,  88 88       88 ,adPPYba, 8b       d8
//  88P'    "8a 88 88       88 I8[    "" `8b     d8'
//  88       d8 88 88       88  `"Y8ba,   `8b   d8'
//  88b,   ,a8" 88 "8a,   ,a88 aa    ]8I   `8b,d8'
//  88`YbbdP"'  88  `"YbbdP'Y8 `"YbbdP"'     Y88'
//  88                                       d8'
//  88                                      d8'


$('body').on('click', 'a.button.mikro.ajax', function (click) {
    if($(this).parent().find('b.voted.plus').length) {
        particleExplode('fa-minus', 'particleRed', 'down', click);
    } else {
        particleExplode('fa-plus', 'particleGreen', 'up', click);
    }
});


//                             88
//                             88
//                             88
//       ,adPPYba, 88       88 88,dPPYba,
//       I8[    "" 88       88 88P'    "8a
//        `"Y8ba,  88       88 88       d8
//       aa    ]8I "8a,   ,a88 88b,   ,a8"
//       `"YbbdP"'  `"YbbdP'Y8 8Y"Ybbd8"'


$('body').on('click', 'a[title="Dodaj do obserwowanych"]', function (click) {
    particleExplode('fa-eye', 'particleGreen', 'up', click);
});

$('body').on('click', 'a[title="Usuń z obserwowanych"]', function (click) {
    particleExplode('fa-eye-slash', 'particleGray', 'down', click);
});


//           88 88
//           88 ""
//           88
//   ,adPPYb,88 88  ,adPPYb,d8
//  a8"    `Y88 88 a8"    `Y88
//  8b       88 88 8b       88
//  "8a,   ,d88 88 "8a,   ,d88
//   `"8bbdP"Y8 88  `"YbbdP"Y8
//                  aa,    ,88
//                   "Y8bbdP"


$('body').on('click', '.diggbox span', function (click) {
    if($(this).parent().parent().hasClass('digout')) {
        particleExplode('fa-thumbs-down', 'particleRed', 'down', click);
    } else {
        particleExplode('fa-thumbs-up', 'particleGreen', 'up', click);
    }
});


//     ad88            88 88
//    d8"              88 88
//    88               88 88
//  MM88MMM ,adPPYba,  88 88  ,adPPYba,  8b      db      d8
//    88   a8"     "8a 88 88 a8"     "8a `8b    d88b    d8'
//    88   8b       d8 88 88 8b       d8  `8b  d8'`8b  d8'
//    88   "8a,   ,a8" 88 88 "8a,   ,a8"   `8bd8'  `8bd8'
//    88    `"YbbdP"'  88 88  `"YbbdP"'      YP      YP


$('body').on('click', 'a[title="Dodaj do obserwowanych"]', function (click) {
    particleExplode('fa-eye', 'particleGreen', 'down', click);
});

$('body').on('click', 'a[title="Usuń z obserwowanych"]', function (click) {
    particleExplode('fa-eye-crossed', 'particleGray', 'up', click);
});

//     ad88
//    d8"
//    88
//  MM88MMM ,adPPYYba, 8b       d8
//    88    ""     `Y8 `8b     d8'
//    88    ,adPPPPP88  `8b   d8'
//    88    88,    ,88   `8b,d8'
//    88    `"8bbdP"Y8     "8"

$('body').on('click', 'li.entry .responsive-menu a.affect.ajax, li.iC .responsive-menu a.affect.ajax', function (click) {
    if($(this).parent().is('b')) {
        particleExplode('fa-heart-o', 'particleGray', 'down', click);
    } else {
        particleExplode('fa-heart', 'particleRed', 'up', click);
    }
});


//  88          88                        88
//  88          88                        88
//  88          88                        88
//  88,dPPYba,  88  ,adPPYba,   ,adPPYba, 88   ,d8
//  88P'    "8a 88 a8"     "8a a8"     "" 88 ,a8"
//  88       d8 88 8b       d8 8b         8888[
//  88b,   ,a8" 88 "8a,   ,a8" "8a,   ,aa 88`"Yba,
//  8Y"Ybbd8"'  88  `"YbbdP"'   `"Ybbd8"' 88   `Y8a


$('body').on('click', 'a[title="zablokuj użytkownika"]', function (click) {
    particleExplode('fa-lock', 'particleRed', 'down', click);
});

$('body').on('click', 'a[title="odblokuj użytkownika"]', function (click) {
    particleExplode('fa-unlock', 'particleGray', 'up', click);
});