Vote Explosion Effect

Robi BUUUM.

  1. // ==UserScript==
  2. // @name Vote Explosion Effect
  3. // @namespace voteexplosion
  4. // @description Robi BUUUM.
  5. // @include http://*.wykop.pl/*
  6. // @include https://*.wykop.pl/*
  7. // @version 2.8.5
  8. // ==/UserScript==
  9.  
  10. /*jslint browser: true*/
  11. /*jslint plusplus: true */
  12. /*jshint multistr: true */
  13. /*jslint es5: true */
  14. /*global $, jQuery, alert*/
  15.  
  16. // 88
  17. // ""
  18. //
  19. // ,adPPYba, 8b,dPPYba, ,adPPYba, 88 ,adPPYba,
  20. // a8" "8a 88P' "8a a8" "" 88 a8P_____88
  21. // 8b d8 88 d8 8b 88 8PP"""""""
  22. // "8a, ,a8" 88b, ,a8" "8a, ,aa 88 "8b, ,aa
  23. // `"YbbdP"' 88`YbbdP"' `"Ybbd8"' 88 `"Ybbd8"'
  24. // 88 ,88
  25. // 88 888P"
  26.  
  27.  
  28. var options = {
  29. particleSpread: 150,
  30. particleCount: 20,
  31. version: '2.8.1.4',
  32. velocity: false
  33. },
  34. voteCount = {
  35. VOTEplus: 0,
  36. VOTEminus: 0,
  37. VOTEsub: 0,
  38. VOTEfav: 0,
  39. VOTEblock: 0,
  40. VOTEdigg: 0,
  41. VOTEbury: 0,
  42. };
  43.  
  44. var head = document.getElementsByTagName('head')[0],
  45. velocity = document.createElement('script');
  46. velocity.type = 'text/javascript';
  47. velocity.onload = function () {
  48. 'use strict';
  49. options.velocity = true;
  50. };
  51. velocity.src = 'https://cdnjs.cloudflare.com/ajax/libs/velocity/1.2.3/velocity.min.js';
  52. head.appendChild(velocity);
  53.  
  54. // ustawienia
  55.  
  56. if (localStorage.getItem("particleSpread")) {
  57. options.particleSpread = localStorage.getItem("particleSpread");
  58. }
  59.  
  60. if (localStorage.getItem("particleCount")) {
  61. options.particleCount = localStorage.getItem("particleCount");
  62. }
  63.  
  64. // liczba głosów
  65. function updateVoteCount() {
  66. 'use strict';
  67. if (localStorage.getItem("VOTEplus")) {
  68. voteCount.VOTEplus = localStorage.getItem("VOTEplus");
  69. } else {
  70. localStorage.setItem("VOTEplus", 0);
  71. }
  72.  
  73. if (localStorage.getItem("VOTEminus")) {
  74. voteCount.VOTEminus = localStorage.getItem("VOTEminus");
  75. } else {
  76. localStorage.setItem("VOTEminus", 0);
  77. }
  78.  
  79. if (localStorage.getItem("VOTEsub")) {
  80. voteCount.VOTEsub = localStorage.getItem("VOTEsub");
  81. } else {
  82. localStorage.setItem("VOTEsub", 0);
  83. }
  84.  
  85. if (localStorage.getItem("VOTEfav")) {
  86. voteCount.VOTEfav = localStorage.getItem("VOTEfav");
  87. } else {
  88. localStorage.setItem("VOTEfav", 0);
  89. }
  90.  
  91. if (localStorage.getItem("VOTEblock")) {
  92. voteCount.VOTEblock = localStorage.getItem("VOTEblock");
  93. } else {
  94. localStorage.setItem("VOTEblock", 0);
  95. }
  96.  
  97. if (localStorage.getItem("VOTEdigg")) {
  98. voteCount.VOTEdigg = localStorage.getItem("VOTEdigg");
  99. } else {
  100. localStorage.setItem("VOTEdigg", 0);
  101. }
  102.  
  103. if (localStorage.getItem("VOTEbury")) {
  104. voteCount.VOTEbury = localStorage.getItem("VOTEbury");
  105. } else {
  106. localStorage.setItem("VOTEbury", 0);
  107. }
  108.  
  109. if (localStorage.getItem("liveEntries")) {
  110. voteCount.liveEntries = localStorage.getItem("liveEntries");
  111. } else {
  112. localStorage.setItem("liveEntries", 0);
  113. }
  114. }
  115.  
  116. function incVoteCount(countName) {
  117. 'use strict';
  118. var thisVoting = localStorage.getItem(countName);
  119. thisVoting++;
  120. localStorage.setItem(countName, thisVoting);
  121. }
  122.  
  123. function decVoteCount(countName) {
  124. 'use strict';
  125. var thisVoting = localStorage.getItem(countName);
  126. thisVoting--;
  127. if (thisVoting < 0) {
  128. thisVoting = 0;
  129. }
  130. localStorage.setItem(countName, thisVoting);
  131. }
  132.  
  133.  
  134.  
  135. // 88
  136. // ,d 88
  137. // 88 88
  138. // ,adPPYba, MM88MMM 8b d8 88 ,adPPYba,
  139. // I8[ "" 88 `8b d8' 88 a8P_____88
  140. // `"Y8ba, 88 `8b d8' 88 8PP"""""""
  141. // aa ]8I 88, `8b,d8' 88 "8b, ,aa
  142. // `"YbbdP"' "Y888 Y88' 88 `"Ybbd8"'
  143. // d8'
  144. // d8'
  145.  
  146.  
  147. $('head')
  148. .append(`
  149. <style type="text/css">
  150. .particleGreen {
  151. color: #3b915f;
  152. }
  153. .particleGray {
  154. color: #999;
  155. }
  156. .particleGold {
  157. color: #c7a054;
  158. }
  159. .particleRed {
  160. color: #c0392b;
  161. }
  162. .particle {
  163. position: absolute;
  164. pointer-events: none;
  165. z-index: 16669;
  166. -webkit-transform: translateZ(0);
  167. -moz-transform: translateZ(0);
  168. -ms-transform: translateZ(0);
  169. -o-transform: translateZ(0);
  170. transform: translateZ(0);
  171. }
  172. .particle i.fa {
  173. font-size: 1.5rem;
  174. }
  175. .optionsHalf {
  176. float:left;
  177. }
  178. body li.entry ul.responsive-menu b a.affect {
  179. color: #c0392b !important;
  180. }
  181. body li.entry .lcontrast:hover ul.responsive-menu b a.affect {
  182. color: #c0392b !important;
  183. }
  184. .voteCount {
  185. margin-top: 10px;
  186. display: inline-block;
  187. font-size: 20px;
  188. font-weight: 700;
  189. }
  190. .saveState.optionsActive {
  191. transform: scale(1);
  192. border: 1px solid rgba(255,255,255,1);
  193. color: white !important;
  194. }
  195. .saveState {
  196. border-radius: 5px;
  197. transition: 0.2s all;
  198. transform: scale(0.8);
  199. cursor: pointer;
  200. display: inline-block;
  201. margin: 0 3px;
  202. padding: 15px 0;
  203. width: 55px;
  204. border: 1px solid rgba(150,150,150,0.1);
  205. }
  206. input[type="number"] {
  207. padding: 1rem .6rem;
  208. width: 100%;
  209. border: 1px solid rgba(155,155,155,0.5);
  210. background-color: transparent;
  211. }
  212. </style>`
  213. );
  214.  
  215.  
  216.  
  217. // ad88 88 88
  218. // d8" 88 ""
  219. // 88 88
  220. // MM88MMM 88 88 8b,dPPYba, 88 ,d8 ,adPPYba, 88 ,adPPYba,
  221. // 88 88 88 88P' `"8a 88 ,a8" a8" "" 88 a8P_____88
  222. // 88 88 88 88 88 8888[ 8b 88 8PP"""""""
  223. // 88 "8a, ,a88 88 88 88`"Yba, "8a, ,aa 88 "8b, ,aa
  224. // 88 `"YbbdP'Y8 88 88 88 `Y8a `"Ybbd8"' 88 `"Ybbd8"'
  225. // ,88
  226. // 888P"
  227.  
  228. function getParticlePosition(x, y, direction) {
  229.  
  230. 'use strict';
  231.  
  232. var spread = Math.floor((Math.random() * options.particleSpread) + 1 - (options.particleSpread / 2)),
  233. randomX = x - spread,
  234. randomY = y - spread,
  235. randomDirection = Math.floor((Math.random() * 200) + 1);
  236.  
  237. if (direction === 'down') {
  238. randomY = randomY + randomDirection;
  239. } else {
  240. randomY = randomY - randomDirection;
  241. }
  242.  
  243. return [randomX, randomY];
  244. }
  245.  
  246. function randomRotate() {
  247. 'use strict';
  248. return Math.floor((Math.random() * 360) + 1);
  249. }
  250.  
  251. function randomZoom() {
  252. 'use strict';
  253. return 2 - (Math.floor((Math.random() * 200) + 1) / 100);
  254. }
  255.  
  256. function particleExplode(iconClass, colorClass, direction, click) {
  257.  
  258. 'use strict';
  259.  
  260. var bodyElemsVote = document.getElementsByTagName("body"),
  261. bodyVote = bodyElemsVote[0],
  262. posX = click.pageX,
  263. posY = click.pageY,
  264. particleRandomClass = 'particle_' + Math.random().toString(36).substring(4),
  265. particlesArray = [],
  266. particle = '';
  267.  
  268. for (var i = 0; i < options.particleCount; i++) {
  269. var particleID = 'particle_' + Math.random().toString(36).substring(4),
  270. particleClass = 'particle ' + colorClass + ' ' + particleRandomClass,
  271. particleStyle = 'top: ' + posY + 'px; left: ' + posX + 'px;',
  272. particle = particle + '<div class="' + particleClass + '" style="' + particleStyle + '" id="' + particleID + '"><i class="fa ' + iconClass + '"></i></div>';
  273.  
  274. particlesArray[i] = particleID;
  275. }
  276.  
  277. document.body.insertAdjacentHTML('beforeend', particle);
  278.  
  279. for (var i = 0; i < options.particleCount; i++) {
  280. var particlePosition = getParticlePosition(posX, posY, direction),
  281. fadeOutTime = 500 + Math.floor((Math.random() * 500) + 1),
  282. animOptions = {
  283. easing: [0,.84,.25,.99],
  284. duration: fadeOutTime,
  285. queue: false
  286. },
  287. particle = $('#' + particlesArray[i]),
  288. particleID = particle.attr('id');
  289.  
  290. particle.velocity({ top: particlePosition[1],
  291. left: particlePosition[0],
  292. rotateZ: randomRotate(),
  293. scale: randomZoom() }, animOptions)
  294. .velocity('fadeOut', fadeOutTime, { queue: false })
  295. .velocity({function(){
  296. var thisParticle = document.getElementById($(this).attr('id'));
  297. thisParticle.remove();
  298. }}, {delay: fadeOutTime}, { queue: false });
  299. }
  300. }
  301.  
  302. function updateSettings() {
  303. 'use strict';
  304. $('.saveState').each(function(){
  305. var thisOptionName = $(this).attr('data-saveattr');
  306. if(localStorage['enabled_' + thisOptionName] == 'undefined') {
  307. localStorage['enabled_' + thisOptionName] = 'true';
  308. }
  309. if(localStorage['enabled_' + thisOptionName] == 'true') {
  310. $(this).addClass('optionsActive');
  311. }
  312. });
  313. }
  314.  
  315.  
  316.  
  317.  
  318. $('body').on('click', '.saveState', function() {
  319. 'use strict';
  320. $(this).toggleClass('optionsActive');
  321. var thisOptionName = $(this).attr('data-saveattr');
  322. if(localStorage['enabled_' + thisOptionName] == 'true') {
  323. localStorage['enabled_' + thisOptionName] = false;
  324. } else {
  325. localStorage['enabled_' + thisOptionName] = true;
  326. }
  327. });
  328.  
  329. function checkOption(thisOptionName) {
  330. 'use strict';
  331. if(localStorage['enabled_' + thisOptionName] == 'false') {
  332. return false;
  333. } else {
  334. return true;
  335. }
  336. }
  337.  
  338. function particleExplodeRemote(object, iconClass, colorClass, direction) {
  339. 'use strict';
  340. var $this = $(object);
  341. var offset = $this.offset();
  342. var width = $this.width();
  343. var height = $this.height();
  344.  
  345. var centerX = offset.left + width / 2;
  346. var centerY = offset.top + height / 2;
  347. var click = {
  348. pageX: centerX,
  349. pageY: centerY
  350. }
  351. particleExplode(iconClass, colorClass, direction, click);
  352. }
  353.  
  354. // ad88 88
  355. // d8" ""
  356. // 88
  357. // MM88MMM 88 8b, ,d8 8b d8
  358. // 88 88 `Y8, ,8P' `8b d8'
  359. // 88 88 )888( `8b d8'
  360. // 88 88 ,d8" "8b, `8b,d8'
  361. // 88 88 8P' `Y8 Y88'
  362. // d8'
  363. // d8'
  364.  
  365.  
  366. $(document).ready(function(){
  367. 'use strict';
  368. updateVoteCount();
  369. });
  370.  
  371.  
  372. // 88,dPYba,,adPYba, ,adPPYba, 8b,dPPYba, 88 88
  373. // 88P' "88" "8a a8P_____88 88P' `"8a 88 88
  374. // 88 88 88 8PP""""""" 88 88 88 88
  375. // 88 88 88 "8b, ,aa 88 88 "8a, ,a88
  376. // 88 88 88 `"Ybbd8"' 88 88 `"YbbdP'Y8
  377.  
  378.  
  379. $('.dropdown.right.m-hide div ul li:last').before(`
  380. <li>
  381. <a href="#" title="" id="openSettingsWindow">
  382. <i class="fa fa-wrench"></i> <span>opcje skryptu</span>
  383. </a>
  384. </li>
  385. `);
  386.  
  387. $('body').on('click', '#openSettingsWindow', function(){
  388. updateVoteCount();
  389. var userNick = $('.dropdown-show.auto > img.avatar').attr('alt');
  390.  
  391. if(localStorage.getItem("particleSpread")) {
  392. var particleSpread = localStorage.getItem("particleSpread");
  393. } else {
  394. var particleSpread = options.particleSpread;
  395. }
  396.  
  397. if(localStorage.getItem("particleCount")) {
  398. var particleCount = localStorage.getItem("particleCount");
  399. } else {
  400. var particleCount = options.particleCount;
  401. }
  402.  
  403. var settingsForm = `<br>
  404. <p><strong>Ustawienia skryptu</strong></p>
  405. <p>Kliknij, by włączyć lub wyłączyć naliczanie oraz animacje po kliknięciu. Podświetlone na biało = włączone. Ostatni przycisk uruchamia funkcje Heartbeat (na bieżąco odświeża wartości plusów).</p>
  406. <div><br \>
  407. <div style="margin: 10px; text-align: center;">
  408. <div class="particleGreen saveState" data-saveattr="VOTEplus" data-value="0">
  409. <p><i class="fa fa-plus" style="font-size: 40px;"></i></p>
  410. <p class="voteCount">${voteCount.VOTEplus}</p>
  411. </div>
  412. <div class="particleRed saveState" data-saveattr="VOTEminus" data-value="0">
  413. <p><i class="fa fa-minus" style="font-size: 40px;"></i></p>
  414. <p class="voteCount">${voteCount.VOTEminus}</p>
  415. </div>
  416. <div class="particleGold saveState" data-saveattr="VOTEfav" data-value="0">
  417. <p><i class="fa fa-star" style="font-size: 40px;"></i></p>
  418. <p class="voteCount">${voteCount.VOTEfav}</p>
  419. </div>
  420. <div class="particleGreen saveState" data-saveattr="VOTEsub" data-value="0">
  421. <p><i class="fa fa-eye" style="font-size: 40px;"></i></p>
  422. <p class="voteCount">${voteCount.VOTEsub}</p>
  423. </div>
  424. <div class="particleRed saveState" data-saveattr="VOTEblock" data-value="0">
  425. <p><i class="fa fa-lock" style="font-size: 40px;"></i></p>
  426. <p class="voteCount">${voteCount.VOTEblock}</p>
  427. </div>
  428. <div class="particleGreen saveState" data-saveattr="VOTEdigg" data-value="0">
  429. <p><i class="fa fa-thumbs-up" style="font-size: 40px;"></i></p>
  430. <p class="voteCount">${voteCount.VOTEdigg}</p>
  431. </div>
  432. <div class="particleRed saveState" data-saveattr="VOTEbury" data-value="0">
  433. <p><i class="fa fa-thumbs-down" style="font-size: 40px;"></i></p>
  434. <p class="voteCount">${voteCount.VOTEbury}</p>
  435. </div>
  436. <div class="particleGold saveState" data-saveattr="liveEntries" data-value="0">
  437. <p><i class="fa fa-heart" style="font-size: 40px;"></i></p>
  438. <p class="voteCount">&nbsp;</p>
  439. </div>
  440. </div>
  441. </div>
  442. <br>
  443. <div class="optionsHalf" style="width: 49%; margin: 0 1% 0 0;">
  444. <label for="particleSpread">wielkość wybuchu (px)</label>
  445. <input type="number" min="0" step="5" class="form-control" id="particleSpread" value="${particleSpread}">
  446. </div>
  447. <div class="optionsHalf" style="width: 49%; margin: 0 0 0 1%;">
  448. <label for="particleCount">ilość cząsteczek</label>
  449. <input type="number" min="0" step="5" class="form-control" id="particleCount" value="${particleCount}">
  450. </div>
  451. <br>
  452. <div style="clear:both;"><br></div>
  453. <div style=" margin: 10px">
  454. <div style="margin: 15px; text-align: center;" id="msgContainer">Zmiany zapisują się automatycznie.</div>
  455. </div>`,
  456. settingsPropaganda = `<div style="clear:both;"><br></div>
  457. <img src="http://xw.cdn03.imgwykop.pl/c3397992/Dreszczyk_WDOQLWuDSL,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>.`,
  458. settingsWindow = `<div id="violationContainer">
  459. <div class="overlay" style="display: block;"></div>
  460. <div id="zgloszenie" style="display: none;" class="normal m-set-fullwidth m-reset-top m-reset-margin m-reset-left">
  461. <form id="scriptSettings">
  462. <div class="header">
  463. <a href="#" title="zamknij" class="fright close"><span class="icon inlblk mini closepreview"><i class="fa fa-times"></i></span></a>
  464. <span class="title">Vote Explosion Script - ustawienia (${options.version})</span>
  465. </div>
  466. <div class="view" style="max-height: initial;">${settingsForm}${settingsPropaganda}</div>
  467. </form>
  468. </div>
  469. </div>`;
  470.  
  471. $('body').prepend(settingsWindow).find('#zgloszenie').fadeIn(250, function(){
  472. 'use strict';
  473. updateSettings();
  474. });
  475. });
  476.  
  477. $('body').on('click', 'div.overlay', function(){
  478. 'use strict';
  479. $('#violationContainer').remove();
  480. });
  481.  
  482. $('body').on('change', '#scriptSettings input', function(){
  483. 'use strict';
  484. localStorage.setItem($(this).attr('id'), $(this).val());
  485. options[$(this).attr('id')] = $(this).val();
  486. $('#msgContainer').html('Zmiany zapisują się automatycznie.<br><b>zapisane</b>.');
  487. });
  488.  
  489.  
  490. // 88
  491. // 88
  492. // 88
  493. // 8b,dPPYba, 88 88 88 ,adPPYba, 8b d8
  494. // 88P' "8a 88 88 88 I8[ "" `8b d8'
  495. // 88 d8 88 88 88 `"Y8ba, `8b d8'
  496. // 88b, ,a8" 88 "8a, ,a88 aa ]8I `8b,d8'
  497. // 88`YbbdP"' 88 `"YbbdP'Y8 `"YbbdP"' Y88'
  498. // 88 d8'
  499. // 88 d8'
  500.  
  501. $('body').on('click', 'a.button.mikro.ajax', function (click) {
  502. 'use strict';
  503.  
  504. var colorClass;
  505.  
  506. if($(this).parent().find('.fa-minus').length) { // komentarz ze znaleziska
  507. if($(this).find('.fa-plus').length) { // dajemy plusa
  508. if(checkOption('VOTEPlus')) {
  509. if(!colorClass) {
  510. colorClass = 'particleGreen';
  511. }
  512. particleExplode('fa-plus', colorClass, 'up', click);
  513. if($(this).parent().find('.disabled').length) { // dajemy plusa, a już daliśmy minusa
  514. decVoteCount('VOTEminus');
  515. }
  516. incVoteCount('VOTEplus');
  517. }
  518. } else { // dajemy minusa
  519. if(checkOption('VOTEminus')) {
  520. if(!colorClass) {
  521. colorClass = 'particleRed';
  522. }
  523. particleExplode('fa-minus', colorClass, 'down', click);
  524. if($(this).parent().find('.disabled').length) { // dajemy minusa, a już daliśmy plusa
  525. decVoteCount('VOTEplus');
  526. }
  527. incVoteCount('VOTEminus');
  528. }
  529. }
  530. } else { // wpis na mikroblogu
  531. if($(this).parent().find('.voted').length) { // zabieramy plusa
  532. if(checkOption('VOTEminus')) {
  533. if(!colorClass) {
  534. colorClass = 'particleRed';
  535. }
  536. particleExplode('fa-minus', colorClass, 'down', click);
  537. decVoteCount('VOTEplus');
  538. }
  539. } else {
  540. if(checkOption('VOTEplus')) {
  541. if(!colorClass) {
  542. colorClass = 'particleGreen';
  543. }
  544. particleExplode('fa-plus', colorClass, 'up', click);
  545. incVoteCount('VOTEplus');
  546. }
  547. }
  548. }
  549. });
  550.  
  551.  
  552. // 88
  553. // 88
  554. // 88
  555. // ,adPPYba, 88 88 88,dPPYba,
  556. // I8[ "" 88 88 88P' "8a
  557. // `"Y8ba, 88 88 88 d8
  558. // aa ]8I "8a, ,a88 88b, ,a8"
  559. // `"YbbdP"' `"YbbdP'Y8 8Y"Ybbd8"'
  560.  
  561.  
  562. $('body').on('click', 'a[title="Dodaj do obserwowanych"]', function (click) {
  563. 'use strict';
  564. if(checkOption('VOTEsub')) {
  565. particleExplode('fa-eye', 'particleGreen', 'up', click);
  566. incVoteCount('VOTEsub');
  567. }
  568. });
  569.  
  570. $('body').on('click', 'a[title="Usuń z obserwowanych"]', function (click) {
  571. 'use strict';
  572. if(checkOption('VOTEsub')) {
  573. particleExplode('fa-eye-slash', 'particleGray', 'down', click);
  574. decVoteCount('VOTEsub');
  575. }
  576. });
  577.  
  578.  
  579. // 88 88
  580. // 88 ""
  581. // 88
  582. // ,adPPYb,88 88 ,adPPYb,d8
  583. // a8" `Y88 88 a8" `Y88
  584. // 8b 88 88 8b 88
  585. // "8a, ,d88 88 "8a, ,d88
  586. // `"8bbdP"Y8 88 `"YbbdP"Y8
  587. // aa, ,88
  588. // "Y8bbdP"
  589.  
  590. // niewykopany i niezakopany - wykopywanie i cofanie wykopu
  591. $('body').on('click', '.diggbox:not(.burried) span', function (click) {
  592. 'use strict';
  593. if($(this).parent().parent().hasClass('digout')) {
  594. if(checkOption('VOTEdigg')) {
  595. particleExplode('fa-thumbs-down', 'particleRed', 'down', click);
  596. decVoteCount('VOTEdigg');
  597. }
  598. } else {
  599. if(checkOption('VOTEdigg')) {
  600. particleExplode('fa-thumbs-up', 'particleGreen', 'up', click);
  601. incVoteCount('VOTEdigg');
  602. }
  603. }
  604. });
  605.  
  606. // niewykopany i niezakopany - zakopywanie
  607. $('body').on('click', '.diggbox .dropdown ul li a', function (click) {
  608. 'use strict';
  609. if(checkOption('VOTEbury')) {
  610. particleExplode('fa-thumbs-down', 'particleRed', 'down', click);
  611. incVoteCount('VOTEbury');
  612. }
  613. });
  614.  
  615. // zakopany - cofanie zakopu
  616. $('body').on('click', '.diggbox.burried span', function (click) {
  617. 'use strict';
  618. if(checkOption('VOTEbury')) {
  619. particleExplode('fa-thumbs-down', 'particleRed', 'down', click);
  620. decVoteCount('VOTEbury');
  621. }
  622. });
  623.  
  624. // ad88
  625. // d8"
  626. // 88
  627. // MM88MMM ,adPPYYba, 8b d8
  628. // 88 "" `Y8 `8b d8'
  629. // 88 ,adPPPPP88 `8b d8'
  630. // 88 88, ,88 `8b,d8'
  631. // 88 `"8bbdP"Y8 "8"
  632.  
  633. $('body').on('click', 'div.actions ul.responsive-menu a', function (click) {
  634. 'use strict';
  635. if($(this).text() == ' ulubiony') {
  636. if(checkOption('VOTEfav')) {
  637. if($(this).parent().is('b')) {
  638. particleExplode('fa-star-o', 'particleGray', 'down', click);
  639. decVoteCount('VOTEfav');
  640. } else {
  641. particleExplode('fa-star', 'particleGold', 'up', click);
  642. incVoteCount('VOTEfav');
  643. }
  644. }
  645. }
  646. });
  647.  
  648.  
  649. // 88 88 88
  650. // 88 88 88
  651. // 88 88 88
  652. // 88,dPPYba, 88 ,adPPYba, ,adPPYba, 88 ,d8
  653. // 88P' "8a 88 a8" "8a a8" "" 88 ,a8"
  654. // 88 d8 88 8b d8 8b 8888[
  655. // 88b, ,a8" 88 "8a, ,a8" "8a, ,aa 88`"Yba,
  656. // 8Y"Ybbd8"' 88 `"YbbdP"' `"Ybbd8"' 88 `Y8a
  657.  
  658.  
  659. $('body').on('click', 'a[title="zablokuj użytkownika"]', function (click) {
  660. 'use strict';
  661. if(checkOption('VOTEblock')) {
  662. particleExplode('fa-lock', 'particleRed', 'down', click);
  663. incVoteCount('VOTEblock');
  664. }
  665. });
  666.  
  667. $('body').on('click', 'a[title="odblokuj użytkownika"]', function (click) {
  668. 'use strict';
  669. if(checkOption('VOTEblock')) {
  670. particleExplode('fa-unlock', 'particleGray', 'up', click);
  671. decVoteCount('VOTEblock');
  672. }
  673. });
  674.  
  675.  
  676. // 88 88 88 88
  677. // 88 "" "" ,d ""
  678. // 88 88
  679. // 88 88 8b d8 88 8b,dPPYba, ,adPPYb,d8 ,adPPYba, 8b,dPPYba, MM88MMM 8b,dPPYba, 88 ,adPPYba, ,adPPYba,
  680. // 88 88 `8b d8' 88 88P' `"8a a8" `Y88 a8P_____88 88P' `"8a 88 88P' "Y8 88 a8P_____88 I8[ ""
  681. // 88 88 `8b d8' 88 88 88 8b 88 8PP""""""" 88 88 88 88 88 8PP""""""" `"Y8ba,
  682. // 88 88 `8b,d8' 88 88 88 "8a, ,d88 "8b, ,aa 88 88 88, 88 88 "8b, ,aa aa ]8I
  683. // 88 88 "8" 88 88 88 `"YbbdP"Y8 `"Ybbd8"' 88 88 "Y888 88 88 `"Ybbd8"' `"YbbdP"'
  684. // aa, ,88
  685. // "Y8bbdP"
  686.  
  687. if(window.location.href.indexOf("wykop.pl/wpis") > -1) {
  688. setInterval(function(){
  689. if(localStorage.getItem("enabled_liveEntries") == 'true') {
  690. $.ajax({
  691. url: window.location.href
  692. })
  693. .done(function(data) {
  694. var explosions = 0;
  695. $(data).find('div.wblock.dC').each(function(index, el) {
  696. 'use strict';
  697. var voteCountObj = $(el).find('p.vC');
  698. var voteCount = voteCountObj.attr('data-vc');
  699. var entryID = $(el).attr('data-id');
  700.  
  701. var voteCurrent = $('div.wblock.dC[data-id="' + entryID + '"]');
  702. var voteCurrentCountObj = voteCurrent.find('p.vC');
  703. var voteCurrentCount = voteCurrentCountObj.attr('data-vc');
  704.  
  705. if(voteCount !== voteCurrentCount) {
  706. var explosionTimeout = explosions * 1500;
  707. explosions++;
  708. if(voteCount > voteCurrentCount) {
  709. setTimeout(function() {
  710. voteCurrentCountObj.attr('data-vc', voteCount);
  711. voteCurrent.find('p.vC').html(voteCountObj.html());
  712. particleExplodeRemote(voteCurrentCountObj.find('b.plus'), 'fa-plus', 'particleGreen', 'up');
  713. }, explosionTimeout);
  714. } else {
  715. setTimeout(function() {
  716. voteCurrentCountObj.attr('data-vc', voteCount);
  717. voteCurrent.find('p.vC').html(voteCountObj.html());
  718. particleExplodeRemote(voteCurrentCountObj.find('b.plus'), 'fa-minus', 'particleRed', 'down');
  719. }, explosionTimeout);
  720. }
  721. }
  722.  
  723. });
  724. });
  725. }
  726. }, 10000);
  727. }
  728.  
  729. // ,,#%%%%#,, ,,%%%%%#,,
  730. // %%/ .#@@@@@@@%%&@@@@( #%%#. .#@@@@@@@%%&@@@@(
  731. // *@@( .@@#@@/ (@@ (@%. &@@@. .@@#@@/ (@@ .@@@@%.
  732. // *@@% ,@% &@, &@@@. ,@% &@, %@@/
  733. // *@@@. /@@%%@@% &@@@@@# /@@%&@@% .&@@/
  734. // &@@@ ./%%* #%%@@@@&. ./%%* (@@&.
  735. // @@@% .&@@@. ,@@@/
  736. // .@@@( (@@@* .&@@#
  737. // .@@@# (@@@* .&@@(
  738. // @@@% @@@( /@@@# ,@@@,
  739. // %@@@ /@@@@@@@@@@( (@@%
  740. // &@@* *#%%%*. ,@@&.
  741. // .@@& .&@% (@@/ %@@,
  742. // %@&. *@@@@%%%%%%@@@@(. *@@/
  743. // ,,. .,#%%%%%*, ,,.
  744.  
  745. (() => {
  746. let aprilFools = new Date(2017,3,1).setHours(0,0,0,0).toString();
  747. let today = new Date().setHours(0,0,0,0).toString();
  748. if (
  749. aprilFools === today &&
  750. !localStorage.getItem("funDisable")
  751. ) {
  752. if(!localStorage.getItem("funSize")) {
  753. localStorage.setItem("funSize", 0);
  754. } else {
  755. let blur = 'blur(' + localStorage.getItem("funSize") + 'px)';
  756. $('div#footer, div#site, ul.mainnav, div.doodle')
  757. .hide()
  758. .css('filter', blur)
  759. .css('webkitFilter', blur)
  760. .css('mozFilter', blur)
  761. .css('oFilter', blur)
  762. .css('msFilter', blur)
  763. .css('transition', 'all 30s')
  764. .show();
  765. console.log('( ͡° ͜ʖ ͡°) śmieszkowanie z siłą ' + localStorage.getItem("funSize") + ' pikseli');
  766. }
  767. let increaseFun = () => {
  768. let newFun = Number(localStorage.getItem("funSize")) + 0.1;
  769. let blur = 'blur(' + newFun + 'px)';
  770. localStorage.setItem("funSize", newFun);
  771. $('div#footer, div#site, ul.mainnav, div.doodle').css('filter', blur)
  772. .css('webkitFilter', blur)
  773. .css('mozFilter', blur)
  774. .css('oFilter', blur)
  775. .css('msFilter', blur)
  776. .css('transition', 'all 10s');
  777. console.log('( ͡° ͜ʖ ͡°) śmieszkowanie z siłą ' + newFun + ' pikseli');
  778. return newFun;
  779. }
  780. setInterval(() => {
  781. increaseFun();
  782. }, 30000);
  783. $('.dropdown.right.m-hide div ul li:last').before(`
  784. <li>
  785. <a href="" id="funDisable">
  786. <i class="fa fa-smile-o"></i> <span>prima aprillis!</span>
  787. </a>
  788. </li>
  789. `);
  790. $('body').on('click', '#funDisable', (e) => {
  791. e.preventDefault();
  792. localStorage.setItem("funDisable", 1);
  793. window.location.href = 'http://www.wykop.pl/wpis/23037911';
  794. });
  795. }
  796. })();