Sleazy Fork is available in English.

社会主义核心价值观

学习用-社会主义核心价值观

  1. // ==UserScript==
  2. // @name 社会主义核心价值观
  3. // @namespace https://icecacoa.com/
  4. // @version 0.3
  5. // @description 学习用-社会主义核心价值观
  6. // @author 0.0
  7. // @match *
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. 'use strict';
  13. var coreSocialistValues = ["富强", "民主", "文明", "和谐",
  14. "自由", "平等", "公正", "法治", "爱国", "敬业", "诚信", "友善"];
  15. var index = Math.floor(Math.random() * coreSocialistValues.length);
  16. document.addEventListener('click', function (e) {
  17. var x = e.pageX, y = e.pageY;
  18. var span = document.createElement('span');
  19. span.textContent = coreSocialistValues[index];
  20. index = (index + 1) % coreSocialistValues.length;
  21. var hue = Math.floor(Math.random() * 360);
  22. var saturation = Math.floor(Math.random() * 21) + 80;
  23. var lightness = Math.floor(Math.random() * 26) + 50;
  24. var believe = Math.floor(Math.random() * 100);
  25. if (believe < 5) {
  26. span.textContent = "河蟹";
  27. lightness = 40;
  28. }
  29. span.style.cssText = ['z-index: 9999999; position: absolute; font-weight:',
  30. 'bold; color: hsl(', hue, ',', saturation, '%,', lightness, '%); ',
  31. 'top: ', y - 20, 'px; left: ', x, 'px;'].join('');
  32. document.body.appendChild(span);
  33. animate(span);
  34. });
  35.  
  36. function animate(el) {
  37. var i = 0;
  38. var top = parseInt(el.style.top);
  39. var id = setInterval(frame, 16.7);
  40.  
  41. function frame() {
  42. if (i > 180) {
  43. clearInterval(id);
  44. el.parentNode.removeChild(el);
  45. } else {
  46. i += 2;
  47. el.style.top = top - i + 'px';
  48. el.style.opacity = (180 - i) / 180;
  49. }
  50. }
  51. }
  52. })();