Vote Explosion Effect

Robi BUUUM.

当前为 2016-05-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Vote Explosion Effect
  3. // @namespace voteexplosion
  4. // @description Robi BUUUM.
  5. // @include http://*.wykop.pl/*
  6. // @version 2.5.7
  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.2',
  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.  
  314.  
  315.  
  316. $('body').on('click', '.saveState', function() {
  317. 'use strict';
  318. $(this).toggleClass('optionsActive');
  319. var thisOptionName = $(this).attr('data-saveattr');
  320. if(localStorage['enabled_' + thisOptionName] == 'true') {
  321. localStorage['enabled_' + thisOptionName] = false;
  322. } else {
  323. localStorage['enabled_' + thisOptionName] = true;
  324. }
  325. });
  326.  
  327. function checkOption(thisOptionName) {
  328. 'use strict';
  329. if(localStorage['enabled_' + thisOptionName] == 'false') {
  330. return false;
  331. } else {
  332. return true;
  333. }
  334. }
  335.  
  336. function particleExplodeRemote(object, iconClass, colorClass, direction) {
  337. 'use strict';
  338. var $this = $(object);
  339. var offset = $this.offset();
  340. var width = $this.width();
  341. var height = $this.height();
  342.  
  343. var centerX = offset.left + width / 2;
  344. var centerY = offset.top + height / 2;
  345. var click = {
  346. pageX: centerX,
  347. pageY: centerY
  348. }
  349. particleExplode(iconClass, colorClass, direction, click);
  350. }
  351.  
  352. // ad88 88
  353. // d8" ""
  354. // 88
  355. // MM88MMM 88 8b, ,d8 8b d8
  356. // 88 88 `Y8, ,8P' `8b d8'
  357. // 88 88 )888( `8b d8'
  358. // 88 88 ,d8" "8b, `8b,d8'
  359. // 88 88 8P' `Y8 Y88'
  360. // d8'
  361. // d8'
  362.  
  363.  
  364. $(document).ready(function(){
  365. 'use strict';
  366. updateVoteCount();
  367. });
  368.  
  369.  
  370. // 88,dPYba,,adPYba, ,adPPYba, 8b,dPPYba, 88 88
  371. // 88P' "88" "8a a8P_____88 88P' `"8a 88 88
  372. // 88 88 88 8PP""""""" 88 88 88 88
  373. // 88 88 88 "8b, ,aa 88 88 "8a, ,a88
  374. // 88 88 88 `"Ybbd8"' 88 88 `"YbbdP'Y8
  375.  
  376.  
  377. $('.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>');
  378.  
  379. $('body').on('click', '#openSettingsWindow', function(){
  380. updateVoteCount();
  381. var userNick = $('.dropdown-show.auto > img.avatar').attr('alt');
  382.  
  383. if(localStorage.getItem("particleSpread")) {
  384. var particleSpread = localStorage.getItem("particleSpread");
  385. } else {
  386. var particleSpread = options.particleSpread;
  387. }
  388.  
  389. if(localStorage.getItem("particleCount")) {
  390. var particleCount = localStorage.getItem("particleCount");
  391. } else {
  392. var particleCount = options.particleCount;
  393. }
  394.  
  395. var settingsForm = '<br>\
  396. <p><strong>Ustawienia skryptu</strong></p>\
  397. <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>\
  398. <div><br \>\
  399. <div style="margin: 10px; text-align: center;">\
  400. <div class="particleGreen saveState" data-saveattr="VOTEplus" data-value="0">\
  401. <p><i class="fa fa-plus" style="font-size: 40px;"></i></p>\
  402. <p class="voteCount">' + voteCount.VOTEplus + '</p>\
  403. </div>\
  404. <div class="particleRed saveState" data-saveattr="VOTEminus" data-value="0">\
  405. <p><i class="fa fa-minus" style="font-size: 40px;"></i></p>\
  406. <p class="voteCount">' + voteCount.VOTEminus + '</p>\
  407. </div>\
  408. <div class="particleGold saveState" data-saveattr="VOTEfav" data-value="0">\
  409. <p><i class="fa fa-star" style="font-size: 40px;"></i></p>\
  410. <p class="voteCount">' + voteCount.VOTEfav + '</p>\
  411. </div>\
  412. <div class="particleGreen saveState" data-saveattr="VOTEsub" data-value="0">\
  413. <p><i class="fa fa-eye" style="font-size: 40px;"></i></p>\
  414. <p class="voteCount">' + voteCount.VOTEsub + '</p>\
  415. </div>\
  416. <div class="particleRed saveState" data-saveattr="VOTEblock" data-value="0">\
  417. <p><i class="fa fa-lock" style="font-size: 40px;"></i></p>\
  418. <p class="voteCount">' + voteCount.VOTEblock + '</p>\
  419. </div>\
  420. <div class="particleGreen saveState" data-saveattr="VOTEdigg" data-value="0">\
  421. <p><i class="fa fa-thumbs-up" style="font-size: 40px;"></i></p>\
  422. <p class="voteCount">' + voteCount.VOTEdigg + '</p>\
  423. </div>\
  424. <div class="particleRed saveState" data-saveattr="VOTEbury" data-value="0">\
  425. <p><i class="fa fa-thumbs-down" style="font-size: 40px;"></i></p>\
  426. <p class="voteCount">' + voteCount.VOTEbury + '</p>\
  427. </div>\
  428. <div class="particleGold saveState" data-saveattr="liveEntries" data-value="0">\
  429. <p><i class="fa fa-heart" style="font-size: 40px;"></i></p>\
  430. <p class="voteCount">&nbsp;</p>\
  431. </div>\
  432. </div>\
  433. </div>\
  434. <br>\
  435. <div class="optionsHalf" style="width: 49%; margin: 0 1% 0 0;">\
  436. <label for="particleSpread">wielkość wybuchu (px)</label>\
  437. <input type="number" min="0" step="5" class="form-control" id="particleSpread" value="' + particleSpread + '">\
  438. </div>\
  439. <div class="optionsHalf" style="width: 49%; margin: 0 0 0 1%;">\
  440. <label for="particleCount">ilość cząsteczek</label>\
  441. <input type="number" min="0" step="5" class="form-control" id="particleCount" value="' + particleCount + '">\
  442. </div>\
  443. <br>\
  444. <div style="clear:both;"><br></div>\
  445. <div style=" margin: 10px">\
  446. <div style="margin: 15px; text-align: center;" id="msgContainer">Zmiany zapisują się automatycznie.</div>\
  447. </div>',
  448. settingsPropaganda = '<div style="clear:both;"><br></div>\
  449. <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>.',
  450. settingsWindow = '<div id="violationContainer">\
  451. <div class="overlay" style="display: block;"></div>\
  452. <div id="zgloszenie" style="display: none;" class="normal m-set-fullwidth m-reset-top m-reset-margin m-reset-left">\
  453. <form id="scriptSettings">\
  454. <div class="header">\
  455. <a href="#" title="zamknij" class="fright close"><span class="icon inlblk mini closepreview"><i class="fa fa-times"></i></span></a>\
  456. <span class="title">Vote Explosion Script - ustawienia</span>\
  457. </div>\
  458. <div class="view" style="max-height: initial;">' + settingsForm + '' + settingsPropaganda + '</div>\
  459. </form>\
  460. </div>\
  461. </div>';
  462.  
  463. $('body').prepend(settingsWindow).find('#zgloszenie').fadeIn(250, function(){
  464. 'use strict';
  465. updateSettings();
  466. });
  467. });
  468.  
  469. $('body').on('click', 'div.overlay', function(){
  470. 'use strict';
  471. $('#violationContainer').remove();
  472. });
  473.  
  474. $('body').on('change', '#scriptSettings input', function(){
  475. 'use strict';
  476. localStorage.setItem($(this).attr('id'), $(this).val());
  477. options[$(this).attr('id')] = $(this).val();
  478. $('#msgContainer').html('Zmiany zapisują się automatycznie.<br><b>zapisane</b>.');
  479. });
  480.  
  481.  
  482. // 88
  483. // 88
  484. // 88
  485. // 8b,dPPYba, 88 88 88 ,adPPYba, 8b d8
  486. // 88P' "8a 88 88 88 I8[ "" `8b d8'
  487. // 88 d8 88 88 88 `"Y8ba, `8b d8'
  488. // 88b, ,a8" 88 "8a, ,a88 aa ]8I `8b,d8'
  489. // 88`YbbdP"' 88 `"YbbdP'Y8 `"YbbdP"' Y88'
  490. // 88 d8'
  491. // 88 d8'
  492.  
  493. $('body').on('click', 'a.button.mikro.ajax', function (click) {
  494. 'use strict';
  495. if($(this).parent().find('.fa-minus').length) { // komentarz ze znaleziska
  496. if($(this).find('.fa-plus').length) { // dajemy plusa
  497. if(checkOption('votePlus')) {
  498. particleExplode('fa-plus', 'particleGreen', 'up', click);
  499. if($(this).parent().find('.disabled').length) { // dajemy plusa, a już daliśmy minusa
  500. decVoteCount('VOTEminus');
  501. }
  502. incVoteCount('VOTEplus');
  503. }
  504. } else { // dajemy minusa
  505. if(checkOption('VOTEminus')) {
  506. particleExplode('fa-minus', 'particleRed', 'down', click);
  507. if($(this).parent().find('.disabled').length) { // dajemy minusa, a już daliśmy plusa
  508. decVoteCount('VOTEplus');
  509. }
  510. incVoteCount('VOTEminus');
  511. }
  512. }
  513. } else { // wpis na mikroblogu
  514. if($(this).parent().find('.voted').length) { // zabieramy plusa
  515. if(checkOption('VOTEminus')) {
  516. particleExplode('fa-minus', 'particleRed', 'down', click);
  517. decVoteCount('VOTEplus');
  518. }
  519. } else {
  520. if(checkOption('VOTEplus')) {
  521. particleExplode('fa-plus', 'particleGreen', 'up', click);
  522. incVoteCount('VOTEplus');
  523. }
  524. }
  525. }
  526. });
  527.  
  528.  
  529. // 88
  530. // 88
  531. // 88
  532. // ,adPPYba, 88 88 88,dPPYba,
  533. // I8[ "" 88 88 88P' "8a
  534. // `"Y8ba, 88 88 88 d8
  535. // aa ]8I "8a, ,a88 88b, ,a8"
  536. // `"YbbdP"' `"YbbdP'Y8 8Y"Ybbd8"'
  537.  
  538.  
  539. $('body').on('click', 'a[title="Dodaj do obserwowanych"]', function (click) {
  540. 'use strict';
  541. if(checkOption('VOTEsub')) {
  542. particleExplode('fa-eye', 'particleGreen', 'up', click);
  543. incVoteCount('VOTEsub');
  544. }
  545. });
  546.  
  547. $('body').on('click', 'a[title="Usuń z obserwowanych"]', function (click) {
  548. 'use strict';
  549. if(checkOption('VOTEsub')) {
  550. particleExplode('fa-eye-slash', 'particleGray', 'down', click);
  551. decVoteCount('VOTEsub');
  552. }
  553. });
  554.  
  555.  
  556. // 88 88
  557. // 88 ""
  558. // 88
  559. // ,adPPYb,88 88 ,adPPYb,d8
  560. // a8" `Y88 88 a8" `Y88
  561. // 8b 88 88 8b 88
  562. // "8a, ,d88 88 "8a, ,d88
  563. // `"8bbdP"Y8 88 `"YbbdP"Y8
  564. // aa, ,88
  565. // "Y8bbdP"
  566.  
  567. // niewykopany i niezakopany - wykopywanie i cofanie wykopu
  568. $('body').on('click', '.diggbox:not(.burried) span', function (click) {
  569. 'use strict';
  570. if($(this).parent().parent().hasClass('digout')) {
  571. if(checkOption('VOTEdigg')) {
  572. particleExplode('fa-thumbs-down', 'particleRed', 'down', click);
  573. decVoteCount('VOTEdigg');
  574. }
  575. } else {
  576. if(checkOption('VOTEdigg')) {
  577. particleExplode('fa-thumbs-up', 'particleGreen', 'up', click);
  578. incVoteCount('VOTEdigg');
  579. }
  580. }
  581. });
  582.  
  583. // niewykopany i niezakopany - zakopywanie
  584. $('body').on('click', '.diggbox .dropdown ul li a', function (click) {
  585. 'use strict';
  586. if(checkOption('VOTEbury')) {
  587. particleExplode('fa-thumbs-down', 'particleRed', 'down', click);
  588. incVoteCount('VOTEbury');
  589. }
  590. });
  591.  
  592. // zakopany - cofanie zakopu
  593. $('body').on('click', '.diggbox.burried span', function (click) {
  594. 'use strict';
  595. if(checkOption('VOTEbury')) {
  596. particleExplode('fa-thumbs-down', 'particleRed', 'down', click);
  597. decVoteCount('VOTEbury');
  598. }
  599. });
  600.  
  601. // ad88
  602. // d8"
  603. // 88
  604. // MM88MMM ,adPPYYba, 8b d8
  605. // 88 "" `Y8 `8b d8'
  606. // 88 ,adPPPPP88 `8b d8'
  607. // 88 88, ,88 `8b,d8'
  608. // 88 `"8bbdP"Y8 "8"
  609.  
  610. $('body').on('click', 'div.actions ul.responsive-menu a', function (click) {
  611. 'use strict';
  612. if($(this).text() == ' ulubiony') {
  613. if(checkOption('VOTEfav')) {
  614. if($(this).parent().is('b')) {
  615. particleExplode('fa-star-o', 'particleGray', 'down', click);
  616. decVoteCount('VOTEfav');
  617. } else {
  618. particleExplode('fa-star', 'particleGold', 'up', click);
  619. incVoteCount('VOTEfav');
  620. }
  621. }
  622. }
  623. });
  624.  
  625.  
  626. // 88 88 88
  627. // 88 88 88
  628. // 88 88 88
  629. // 88,dPPYba, 88 ,adPPYba, ,adPPYba, 88 ,d8
  630. // 88P' "8a 88 a8" "8a a8" "" 88 ,a8"
  631. // 88 d8 88 8b d8 8b 8888[
  632. // 88b, ,a8" 88 "8a, ,a8" "8a, ,aa 88`"Yba,
  633. // 8Y"Ybbd8"' 88 `"YbbdP"' `"Ybbd8"' 88 `Y8a
  634.  
  635.  
  636. $('body').on('click', 'a[title="zablokuj użytkownika"]', function (click) {
  637. 'use strict';
  638. if(checkOption('VOTEblock')) {
  639. particleExplode('fa-lock', 'particleRed', 'down', click);
  640. incVoteCount('VOTEblock');
  641. }
  642. });
  643.  
  644. $('body').on('click', 'a[title="odblokuj użytkownika"]', function (click) {
  645. 'use strict';
  646. if(checkOption('VOTEblock')) {
  647. particleExplode('fa-unlock', 'particleGray', 'up', click);
  648. decVoteCount('VOTEblock');
  649. }
  650. });
  651.  
  652.  
  653. // 88 88 88 88
  654. // 88 "" "" ,d ""
  655. // 88 88
  656. // 88 88 8b d8 88 8b,dPPYba, ,adPPYb,d8 ,adPPYba, 8b,dPPYba, MM88MMM 8b,dPPYba, 88 ,adPPYba, ,adPPYba,
  657. // 88 88 `8b d8' 88 88P' `"8a a8" `Y88 a8P_____88 88P' `"8a 88 88P' "Y8 88 a8P_____88 I8[ ""
  658. // 88 88 `8b d8' 88 88 88 8b 88 8PP""""""" 88 88 88 88 88 8PP""""""" `"Y8ba,
  659. // 88 88 `8b,d8' 88 88 88 "8a, ,d88 "8b, ,aa 88 88 88, 88 88 "8b, ,aa aa ]8I
  660. // 88 88 "8" 88 88 88 `"YbbdP"Y8 `"Ybbd8"' 88 88 "Y888 88 88 `"Ybbd8"' `"YbbdP"'
  661. // aa, ,88
  662. // "Y8bbdP"
  663.  
  664. if(window.location.href.indexOf("wykop.pl/wpis") > -1) {
  665. setInterval(function(){
  666. if(localStorage.getItem("enabled_liveEntries") == 'true') {
  667. $.ajax({
  668. url: window.location.href
  669. })
  670. .done(function(data) {
  671. var explosions = 0;
  672. $(data).find('div.wblock.dC').each(function(index, el) {
  673. 'use strict';
  674. var voteCountObj = $(el).find('p.vC');
  675. var voteCount = voteCountObj.attr('data-vc');
  676. var entryID = $(el).attr('data-id');
  677.  
  678. var voteCurrent = $('div.wblock.dC[data-id="' + entryID + '"]');
  679. var voteCurrentCountObj = voteCurrent.find('p.vC');
  680. var voteCurrentCount = voteCurrentCountObj.attr('data-vc');
  681.  
  682. if(voteCount !== voteCurrentCount) {
  683. var explosionTimeout = explosions * 1500;
  684. explosions++;
  685. if(voteCount > voteCurrentCount) {
  686. setTimeout(function() {
  687. voteCurrentCountObj.attr('data-vc', voteCount);
  688. voteCurrent.find('p.vC').html(voteCountObj.html());
  689. particleExplodeRemote(voteCurrentCountObj.find('b.plus'), 'fa-plus', 'particleGreen', 'up');
  690. }, explosionTimeout);
  691. } else {
  692. setTimeout(function() {
  693. voteCurrentCountObj.attr('data-vc', voteCount);
  694. voteCurrent.find('p.vC').html(voteCountObj.html());
  695. particleExplodeRemote(voteCurrentCountObj.find('b.plus'), 'fa-minus', 'particleRed', 'down');
  696. }, explosionTimeout);
  697. }
  698. }
  699.  
  700. });
  701. });
  702. }
  703. }, 10000);
  704. }