1 | javascript:(function(){$('#打招呼膠囊, #打招呼膠囊css').remove();$('head').append('<style id="打招呼膠囊css"> .bar-color:before { display:none; } #打招呼膠囊 { left:-450px; bottom:0; position:fixed; width:450px; height:500px; transition:left .6s; } #top_bar:hover #打招呼膠囊 { left:0; } #角色, #開關 { width:100%; height:100%; position:absolute; } #打招呼 { height:90px; width:170px; position:absolute; bottom:65px; left:140px; } #說話外框 { height:160px; width:240px; font-size:16px; position:absolute; right:-120px; top:80px; display:flex; justify-content:center; align-items:center; } #說話 { all:initial; margin:20px 30px; color:#7e623e; } #角色, #開關 { transition:background .6s; } </style>');$('#top_bar .bar-color').append('<div id="打招呼膠囊"><div id="角色"></div><div id="開關"></div><div id="打招呼"></div><div id="說話外框" style="display:none;"><div id="說話"></div></div></div>');$('#打招呼膠囊').css('background', 'url(https://imgur.com/k24v0xm.png)');$('#說話外框').css('background', 'url(https://imgur.com/KTG21cp.png)');$('#角色').css('background', 'url(https://imgur.com/vvjZThx.png)');$('#開關').css('background', 'url(https://imgur.com/XW61sRM.png)');$('#開關').on('click', ()=>{if($('#開關').hasClass('open')) $('#開關').removeClass('open').css('background', 'url(https://imgur.com/XW61sRM.png)');else $('#開關').addClass('open').css('background', 'url(https://imgur.com/HdhIiyZ.png)');});$('#打招呼').on('click', ()=>{if(!$('#開關').hasClass('open')) {alert('要先打開膠囊。'); return;}let hello = get_hello();let today = (new Date().getFullYear()) + "/" + (new Date().getMonth()+1) + "/" + (new Date().getDate());if(hello.d == today) alert('今天已經打過招呼了。');else {set_hello('hello_day', today);if((new Date(today) - new Date(hello.d)) / 86400000 > 1) { say_hello(false); hello.c = 0; }else if(hello.c >= 6) { say_hello(true); hello.c = 0; }else { say_hello(false); hello.c++; }set_hello('hello_count', hello.c);}});function get_hello() {return {c: (document.cookie.split("hello_count=")[1] ? +document.cookie.split("hello_count=")[1].split(";")[0] : 0),d: (document.cookie.split("hello_day=")[1] ? document.cookie.split("hello_day=")[1].split(";")[0] : 0)};}function set_hello(c_name, c_value) {let expires = new Date();expires.setTime(expires.getTime() + 1209600000);document.cookie = c_name + "=" + escape(c_value) + ";expires=" + expires.toGMTString();}function say_hello(is_seven) {let imgs = {"自信": "https://imgur.com/vvjZThx.png", "笑": "https://imgur.com/0mSh7M7.png", "傻1": "https://imgur.com/SasdI0l.png", "傻2": "https://imgur.com/4yFjBNa.png", "沮喪": "https://imgur.com/6JfmEQw.png", "驚": "https://imgur.com/1Tns84w.png"};let content = [["自信", ["%u6253%u5012%u773C%u524D%u7684%u5C0D%u624B%uFF0C%u9084%u6709%u2026%u81EA%u5DF1%u767C%u63EE%u51FA120%25%u7684%u5BE6%u529B%u6642%u7684%u5FEB%u611F%uFF0C%u624D%u662F%u6211%u6240%u8FFD%u6C42%u7684%u3002","%u6211%u8981%u628A%u6211%u7684%u5FC5%u6BBA%u6280%u50B3%u6388%u7D66%u4F60%uFF01","%u4F60%u4F86%u4E86%u554A%uFF0C%u6211%u7684%u982D%u865F%u5F1F%u5B50%u554A%uFF01"]],["笑", ["hey%21%20hey%21%20hey%21","%u6211%u7684%u6642%u4EE3%u4F86%u81E8%u4E86%uFF01","%u597D%uFF0D%uFF0D%u5440%uFF01%uFF01"]],["傻1", ["%u662F%u55CE%uFF1F%uFF01%u662F%u55CE%uFF01"]],["傻2", ["%uFF1F%uFF1F%uFF1F"]],["沮喪", ["%u6211%u5E73%u6642%u662F%u600E%u9EBC%u6253%u5927%u659C%u7DDA%u7684%u554A%u2026%uFF1F","%u6211%u4E5F%u60F3%u5728%u4E3B%u9AD4%u80B2%u9928%u554A%u2026%uFF01"]]];if(is_seven) content = [["驚", ["%u807D%u8D77%u4F86%u597D%u50CF%u662F%u67D0%u500B%u4EBA%u7684%u540D%u5B57%u3002","%u9019%u500B%u611F%u89BA%u662F%u2026%u6709%u4EBA%u5728%u7A31%u8B9A%u6211%uFF01"]]];let target = content[Math.floor(Math.random() * content.length)];$('#角色').css('background', 'url(' + imgs[target[0]] + ')');$('#說話').html(unescape(target[1][Math.floor(Math.random() * target[1].length)]));$('#說話外框').fadeIn(600);setTimeout(()=>{$('#角色').css('background', 'url(' + imgs["自信"] + ')');$('#說話外框').fadeOut(600);}, 10000);}})() |
Direct link: https://paste.plurk.com/show/Cu5vzYB1qcn9NKg48cj2