1function renderTip(template, context) { 2 var tokenReg = /(\\)?\{([^\{\}\\]+)(\\)?\}/g; 3 return template.replace(tokenReg, function (word, slash1, token, slash2) { 4 if (slash1 || slash2) { 5 return word.replace('\\', ''); 6 } 7 var variables = token.replace(/\s/g, '').split('.'); 8 var currentObject = context; 9 var i, 10 length, 11 variable; 12 for (i = 0, length = variables.length; i < length; ++i) { 13 variable = variables[i]; 14 currentObject = currentObject[variable]; 15 if (currentObject === undefined || currentObject === null) return ''; 16 } 17 return currentObject; 18 }); 19} 20 21String.prototype.renderTip = function (context) { 22 return renderTip(this, context); 23}; 24 25var re = /x/; 26console.log(re); 27re.toString = function () { 28 showMessage('ååï¼ä½ æå¼äºæ§å¶å°ï¼æ¯æ³è¦ççæçç§å¯åï¼', 5000); 29 return ''; 30}; 31 32$(document).on('copy', function () { 33 showMessage('ä½ é½å¤å¶äºäºä»ä¹åï¼è½¬è½½è¦è®°å¾å ä¸åºå¤å¦~~', 5000); 34}); 35 36function initTips() { 37 $.ajax({ 38 cache: true, 39 url: `${message_Path}message.json`, 40 dataType: "json", 41 success: function (result) { 42 $.each(result.mouseover, function (index, tips) { 43 $(tips.selector).mouseover(function () { 44 var text = tips.text; 45 if (Array.isArray(tips.text)) text = tips.text[Math.floor(Math.random() * tips.text.length + 1) - 1]; 46 text = text.renderTip({text: $(this).text()}); 47 showMessage(text, 3000); 48 }); 49 }); 50 $.each(result.click, function (index, tips) { 51 $(tips.selector).click(function () { 52 var text = tips.text; 53 if (Array.isArray(tips.text)) text = tips.text[Math.floor(Math.random() * tips.text.length + 1) - 1]; 54 text = text.renderTip({text: $(this).text()}); 55 showMessage(text, 3000); 56 }); 57 }); 58 } 59 }); 60} 61 62initTips(); 63 64(function () { 65 var text; 66 if (document.referrer !== '') { 67 var referrer = document.createElement('a'); 68 referrer.href = document.referrer; 69 text = 'å¨ï¼æ¥èª <span style="color:#0099cc;">' + referrer.hostname + '</span> çæåï¼'; 70 var domain = referrer.hostname.split('.')[1]; 71 if (domain == 'baidu') { 72 text = 'å¨ï¼ æ¥èª ç¾åº¦æç´¢ çæåï¼<br>欢è¿è®¿é®<span style="color:#0099cc;">ã ' + document.title.split(' - ')[0] + ' ã</span>'; 73 } else if (domain == 'so') { 74 text = 'å¨ï¼ æ¥èª 360æç´¢ çæåï¼<br>欢è¿è®¿é®<span style="color:#0099cc;">ã ' + document.title.split(' - ')[0] + ' ã</span>'; 75 } else if (domain == 'google') { 76 text = 'å¨ï¼ æ¥èª è°·ææç´¢ çæåï¼<br>欢è¿è®¿é®<span style="color:#0099cc;">ã ' + document.title.split(' - ')[0] + ' ã</span>'; 77 } 78 } else { 79 if (window.location.href == `${home_Path}`) { //主页URL夿ï¼éè¦ææ ç»å°¾ 80 var now = (new Date()).getHours(); 81 if (now > 23 || now <= 5) { 82 text = 'ä½ æ¯å¤ç«ååï¼è¿ä¹æè¿ä¸ç¡è§ï¼æå¤©èµ·çæ¥åï¼'; 83 } else if (now > 5 && now <= 7) { 84 text = 'æ©ä¸å¥½ï¼ä¸æ¥ä¹è®¡å¨äºæ¨ï¼ç¾å¥½çä¸å¤©å°±è¦å¼å§äºï¼'; 85 } else if (now > 7 && now <= 11) { 86 text = 'ä¸å好ï¼å·¥ä½é¡ºå©åï¼ä¸è¦ä¹ åï¼å¤èµ·æ¥èµ°å¨èµ°å¨å¦ï¼'; 87 } else if (now > 11 && now <= 14) { 88 text = 'ä¸åäºï¼å·¥ä½äºä¸ä¸ªä¸åï¼ç°å¨æ¯å餿¶é´ï¼'; 89 } else if (now > 14 && now <= 17) { 90 text = 'ååå¾å®¹æç¯å°å¢ï¼ä»å¤©çè¿å¨ç®æ 宿äºåï¼'; 91 } else if (now > 17 && now <= 19) { 92 text = 'åæäºï¼çªå¤å¤é³çæ¯è²å¾ç¾ä¸½å¢ï¼æç¾ä¸è¿å¤é³çº¢~~'; 93 } else if (now > 19 && now <= 21) { 94 text = 'æä¸å¥½ï¼ä»å¤©è¿å¾æä¹æ ·ï¼'; 95 } else if (now > 21 && now <= 23) { 96 text = 'å·²ç»è¿ä¹æäºåï¼æ©ç¹ä¼æ¯å§ï¼æå®~~'; 97 } else { 98 text = 'å¨~ å¿«æ¥éæç©å§ï¼'; 99 } 100 } else { 101 text = '欢è¿é 读<span style="color:#0099cc;">ã ' + document.title.split(' - ')[0] + ' ã</span>'; 102 } 103 } 104 showMessage(text, 12000); 105})(); 106 107window.setInterval(showHitokoto, 30000); 108 109function showHitokoto() { 110 $.getJSON("https://v1.hitokoto.cn/", function (result) { 111 showMessage(result.hitokoto, 5000); 112 }); 113} 114 115function showMessage(text, timeout) { 116 if (Array.isArray(text)) text = text[Math.floor(Math.random() * text.length + 1) - 1]; 117 //console.log('showMessage', text); 118 $('.message').stop(); 119 $('.message').html(text).fadeTo(200, 1); 120 if (timeout === null) timeout = 5000; 121 hideMessage(timeout); 122} 123 124function hideMessage(timeout) { 125 $('.message').stop().css('opacity', 1); 126 if (timeout === null) timeout = 5000; 127 $('.message').delay(timeout).fadeTo(200, 0); 128} 129 130function initLive2d() { 131 $('.hide-button').fadeOut(0).on('click', () => { 132 $('#landlord').css('display', 'none') 133 }) 134 $('#landlord').hover(() => { 135 $('.hide-button').fadeIn(600) 136 }, () => { 137 $('.hide-button').fadeOut(600) 138 }) 139} 140 141initLive2d();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.