From 649400ba17e54ee72b1078622f3350b582835538 Mon Sep 17 00:00:00 2001 From: nineya <361654768@qq.com> Date: Mon, 4 Dec 2023 11:46:34 +0800 Subject: [PATCH] =?UTF-8?q?feat(prosperous):=20=E6=B7=BB=E5=8A=A0=E5=AF=8C?= =?UTF-8?q?=E5=BC=BA=E6=B0=91=E4=B8=BB=E4=B8=8A=E5=8D=87=E6=96=87=E5=AD=97?= =?UTF-8?q?=E9=BC=A0=E6=A0=87=E7=82=B9=E5=87=BB=E7=89=B9=E6=95=88=EF=BC=8C?= =?UTF-8?q?#71?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- settings.yaml | 2 ++ src/js/cursor/click/prosperous.js | 23 +++++++++++++++++++ .../assets/js/cursor/click/prosperous.min.js | 1 + 3 files changed, 26 insertions(+) create mode 100644 src/js/cursor/click/prosperous.js create mode 100644 templates/assets/js/cursor/click/prosperous.min.js diff --git a/settings.yaml b/settings.yaml index 1919f42..33382d6 100644 --- a/settings.yaml +++ b/settings.yaml @@ -977,6 +977,8 @@ spec: label: 烟花特效 - value: granule label: 粒子爆炸 + - value: prosperous + label: 富强民主 - $formkit: radio name: enable_sw label: "启用 Service Worker 优化" diff --git a/src/js/cursor/click/prosperous.js b/src/js/cursor/click/prosperous.js new file mode 100644 index 0000000..d19140d --- /dev/null +++ b/src/js/cursor/click/prosperous.js @@ -0,0 +1,23 @@ +var a_idx = 0 +jQuery(document).ready(function ($) { + $('body').click(function (e) { + var a = ['富强', '民主', '文明', '和谐', '自由', '平等', '公正', '法治', '爱国', '敬业', '诚信', '友善'] + var $i = $('<span/>').text(a[a_idx]) + a_idx = (a_idx + 1) % a.length + var x = e.pageX, y = e.pageY + let scrolly = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop + y = y - scrolly + $i.css({ + 'z-index': 999, + 'top': y - 20, + 'left': x, + 'position': 'fixed', + 'font-weight': 'bold', + 'color': /*"#ff6651" 随机颜色写法:*/ 'rgb(' + ~~(255 * Math.random()) + ',' + ~~(255 * Math.random()) + ',' + ~~(255 * Math.random()) + ')' + }) + $('body').append($i) + $i.animate({'top': y - 180, 'opacity': 0}, 1500, function () { + $i.remove() + }) + }) +}) \ No newline at end of file diff --git a/templates/assets/js/cursor/click/prosperous.min.js b/templates/assets/js/cursor/click/prosperous.min.js new file mode 100644 index 0000000..5b7f8b2 --- /dev/null +++ b/templates/assets/js/cursor/click/prosperous.min.js @@ -0,0 +1 @@ +(()=>{var a=0;jQuery(document).ready(function(n){n("body").click(function(o){var t=["富强","民主","文明","和谐","自由","平等","公正","法治","爱国","敬业","诚信","友善"],e=n("<span/>").text(t[a]),t=(a=(a+1)%t.length,o.pageX),o=o.pageY;o-=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop,e.css({"z-index":999,top:o-20,left:t,position:"fixed","font-weight":"bold",color:"rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"}),n("body").append(e),e.animate({top:o-180,opacity:0},1500,function(){e.remove()})})})})(); \ No newline at end of file