Vote Explosion Effect

Robi BUUUM.

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

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