已掉线,重新登录

首页 > 绿虎论坛 > 网页插件 (发帖)

标题: 【网页插件】@消息提醒(更新)

作者: @Ta

时间: 2018-08-15发布,2023-02-25修改

点击: 8222
被下沉

做这个得原因,因为@ ChatGPT 后每次都要刷新几次看下到底回复了没有,很麻烦。
更新:当有@消息时,网页会有呼吸灯效果,其实代码很简单,只是让这个呼吸灯更加好看费了点劲。

导入网页插件:@消息提醒(当前用户:22,总安装次数:51)
<script src="https://cdn.bootcss.com/jquery/2.1.0/jquery.min.js"> </script>
<script>
    var is_add = false;
    $(document).ready(function() {

        self.setInterval("checkNewMessage()", 1000);
    });

	showMessage();
    // function checkNewMessage() {
    //     $.getJSON("/q.php/index.index.json", function(result) {
    //         if (result['userInfo']['newAtInfo'] > 0 || result['userInfo']['newMsg'] > 0) {
    //             showMessage();
    //         }
    //     });
    // }

    function showMessage() {
        if (is_add) {

        } else {
            is_add = true;

            const colorBlock = document.createElement("div");
			colorBlock.id = "color-block";
			colorBlock.style.position = "fixed";
			colorBlock.style.top = 0;
			colorBlock.style.left = 0;
			colorBlock.style.width = "100%";
			colorBlock.style.height = "100%";
			colorBlock.style.transition = "background 1s ease-in-out";
			colorBlock.style.zIndex = -1;
			document.body.insertAdjacentElement("afterbegin", colorBlock);

			const containers = document.querySelectorAll(".container");
			containers.forEach((container) => {
			  container.style.backgroundColor = "#ffffff47";
			});


			const generateColors = () => {
			  const colors = [];

			  const hue = Math.floor(Math.random() * 360);
			  const saturation = Math.floor(Math.random() * 21) + 80;
			  const lightness = Math.floor(Math.random() * 11) + 70;

			  for (let i = 0; i < 20; i++) {
			    const h = hue;
			    const s = saturation;
			    const l = lightness + i * 2;

			    colors.push(`hsl(${h}, ${s}%, ${l}%)`);
			  }

			  return colors;
			};

            // const colorBlock = document.getElementById("color-block");
			const colors = generateColors();



			let currentColor = 0;
			let direction = 1;

		

			let currentIndex = 0;

			function changeBackground() {
			    const nextIndex = currentIndex + direction;
				if (nextIndex === colors.length || nextIndex === -1) {
				    direction = -direction;
				    currentIndex += direction;
				} else {
				    document.body.style.background = `linear-gradient(to bottom right, ${colors[currentIndex]}, ${colors[nextIndex]})`;
				    currentIndex = nextIndex;
				}
			}

			setInterval(changeBackground, 100);


			// setInterval(changeColor, 200);

        }
    }




</script>






[隐藏样式|查看源码]


『回复列表(8|隐藏机器人聊天)』

2. @wrongs,test
(/@Ta/2018-08-15 12:20//)

3.
用户被禁言,发言自动屏蔽。
(/@Ta/2018-08-15 12:23//
被禁言
)

4. @残缘,测试
(/@Ta/2018-08-15 14:33//)

7. @残缘
(/@Ta/2018-08-16 08:38//)

8. @丨龙丶信丨 CES
(/@Ta/2018-08-16 13:49//)

9. 能直接把消息取出来就更好了~
(/@Ta/2018-08-18 01:11//)

11.

@泰戈尔会游泳 `

-●●位招租 - Huawei Mate20

(/@Ta/2019-11-06 16:29//)

12.

@泰戈尔会游泳

-●●位招租 - Huawei Mate20

(/@Ta/2019-11-06 16:30//)

回复需要登录

9月8日 05:42 星期一

本站由hu60wap6驱动

备案号: 京ICP备18041936号-1