tampermonkey是一款Chrome的插件。
将这个脚本加入tampermonkey。就可以在任何网页点击任意地方出现24字箴言。
修改// @match :///可更改生效的网页,默认是全部网页生效。
导入网页插件:tampermonkey(当前用户:1,总安装次数:1)<script>
// ==UserScript==
// @name 24字箴言
// @namespace http://liuwanlin.cn/
// @version 0.1
// @description try to take over the world!
// @author Blue☆Sky
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var text_index = 0;
document.addEventListener("mousedown",function(e){
var texts = new Array("富强", "民主", "文明", "和谐", "自由", "平等", "公正" ,"法治", "爱国", "敬业", "诚信", "友善");
var colors = new Array("#FF6347","#FF7F00","#CD00CD","#71C671","#7D26CD","#218868","#00E5EE","#EE30A7","#CD00CD","#CD8500","#EE4000","#EE3A8C","#F08080","#9ACD32","#66CDAA");
var span = document.createElement("span");
span.innerHTML = texts[text_index]+"-t";
text_index = (text_index + 1) % texts.length;
var x = e.pageX,
y = e.pageY;
var rand = Math.floor(Math.random()*colors.length);
span.style.transitionProperty = "ALL";
span.style.webkitTransitionProperty = "ALL";
span.style.MozTransitionProperty = "ALL";
span.style.msTransitionProperty = "ALL";
span.style.transitionDuration = "2s";
span.style.webkitTransitionDuration = "2s";
span.style.MozTransitionDuration = "2s";
span.style.msTransitionDuration = "2";
span.style.zIndex = "999999999";
span.style.top = (y-20)+"px";
span.style.left = (x-25)+"px";
span.style.position = "absolute";
span.style.fontWeight = "bold";
span.style.fontSize = "15";
span.style.color = "#ffffff";
span.style.backgroundColor = colors[rand];
span.style.display = "block";
span.style.height = "20px";
span.style.width = "50px";
span.style.borderRadius = "10px";
span.style.lineHeight = "20px";
span.style.textAlign = "center";
var body = document.getElementsByTagName("body")[0];
body.appendChild(span);
setTimeout(function () {
span.style.transform = "scale(2.0)";
span.style.webkitTransform = "scale(2.0)";
span.style.MozTransform = "scale(2.0)";
span.style.msTransform = "scale(2.0)";
span.style.top = (y-180)+"px";
span.style.opacity = "0";
},20);
setTimeout(function () {span.remove(span.selectedIndex);},2020);
});
})();
</script>