// ==UserScript== // @name good mood--何 // @namespace http://tampermonkey.net/ // @version 0.1 // @description 开发这个脚本主要是为了夸nv朋友,还有玩~ 根据自己修改【姓名和性别】。 // @author 华东交大-何江涛 // @include * // @match http://127.0.0.1:5500/%E6%96%B0%E5%BB%BA%E6%96%87%E6%9C%AC%E6%96%87%E6%A1%A3.html // @icon https://www.google.com/s2/favicons?sz=64&domain=0.1 // @grant none // @license MIT // @downloadURL none // ==/UserScript== ; (function () { //姓名,性别 必改。 let name = '何江涛' let sex = '男' //弹框停留时间,单位秒 可改,时间单位:秒。 let time = 1.5 // 弹框个数 可改 let num = 1 //弹框出现的范围 可改,范围:0-100 let left = 80 let top = 40 //字体 let fontFamily = ['STXingkai', 'STXingkai', 'STXingkai', 'STXingkai', 'STXingkai', 'STXingkai', 'STXingkai', 'STHeiti', 'STKaiti', 'STSong', 'STFangsong', 'SimHei', 'SimSun', 'NSimSun', 'FangSong', 'KaiTi', 'STXinwei', 'STHupo', 'STCaiyun', 'FZYaoti', 'FZShuTi', 'YouYuan'] let colors = [ // ×(金) ['#f9d681', 'black'], // 金,红 ['#f9d681', 'black'], ['#dc2c1f', '#ffffff'], // 暗白不明显,故注释 。 //['#f7f7f7', '#black'], ] let colorsGril = [ // 粉红 ['#fee6f3', '#e5717a'], // ×(红) ['#dc2c1f', '#ffffff'], ].concat(colors) let colorsBoy = [ // ×(红) ['#dc2c1f', '#ffffff'], ].concat(colors) let sentences = [ 'aaa,我喜欢你!', 'aaa,我喜欢你!', 'aaa要开心哦', 'aaa你好鸭!', ] let sentencesGirl = [ 'aaa好美!!!', 'aaa好漂亮!!!!', '让我多看两眼aaa,太好看了吧', '认识aaa真好。', 'aaa小姐姐!', '小姐姐来了?', 'aaa有点好看。', '为什么aaa这么好看?', 'aaa,你怎么这么温柔呀?', 'aaa好漂亮啊!!!', 'aaa长得真漂亮!!!', 'aaa穿得真好看!!!!', 'aaa要开心哦', ].concat(sentences) let sentencesBoy = [ 'aaa好帅!!!', 'aaa真帅!!!!', 'aaa有点小帅。', 'aaa气宇轩昂啊!!!', 'aaa有点小厉害。', 'aaa哥哥!', '帅哥来了?', '为什么aaa这么厉害?', ].concat(sentences) function random(max, min = 0) { return Math.round(Math.random() * (max - min) + min) } function randomArray(array, min = 0) { let randomArray = random(array.length - 1, min) return array[randomArray] } for (let i = 0; i < num; i++) { // 句子 let sentence; // 颜色 let color; if (sex === "女") { sentence = randomArray(sentencesGirl).replace(/aaa/g, `${name}`); color = randomArray(colorsGril) } else { sentence = randomArray(sentencesBoy).replace(/aaa/g, `${name}`); color = randomArray(colorsBoy) } let sentenceNum = sentence.length // 句子背景宽度 let sentenceWidth = 0; if (sentenceNum < 10) { sentenceWidth = sentenceNum * 30 } else if (sentenceNum < 20) { sentenceWidth = sentenceNum * 22 } else { sentenceWidth = sentenceNum * (21 - Math.log10(sentenceNum) * 0.5) } let windowWidth = document.documentElement.clientWidth * left / 100 || document.body.clientWidth * left / 100; let appear=Math.random()*1000 new Promise((a, b) => { // 弹框出现的时间 setTimeout(() => { a(11) }, num===1?100:appear) }).then(() => { let l = document.createElement('p') l.style.display l.innerHTML = `
${sentence}
` document.body.insertBefore(l, null) setTimeout(() => { l.style.display = 'none' },num===1?time * 1000:time * 1000+500-appear) // 变量 // background-color: ${color[0]}; // color:${color[1]}; // font-family: 'STXingkai'; // ${randomArray(fontFamily)} // width: 250px; // ${sentenceWidth} // left: 20%; // ${random(windowWidth-sentenceWidth)} // top: 20%; // ${random(100)} // border-radius: 2px; // ${random(28,2)} }) } })()