Vote Explosion Effect

Robi BUUUM.

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

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