Greasy Fork is available in English.
社会主义核心价值观 在你每次点击时飘出并提示!
当前为
// ==UserScript==
// @name 自用核心价值观 - 点击时提醒
// @namespace http://tampermonkey.net/
// @version 1.0
// @description 社会主义核心价值观 在你每次点击时飘出并提示!
// @author Cody
// @include http://*
// @include https://*
// @grant none
// @run-at document-idle
// ==/UserScript==
(function () {
'use strict';
var coreSocialistValues = [ "文明","自由","民主", "平等", "公正", "法制","和谐", "敬业", "友善",'狗头保命', '热爱学习','埋头苦干','加油干','别走神','去学习','去工作','别划水','别吵我'],
index;
document.body.addEventListener('click', function (e) {
index = Math.floor(Math.random() * coreSocialistValues.length)
if (e.target.tagName == 'A') {
return;
}
var x = e.pageX,
y = e.pageY,
span = document.createElement('span');
span.textContent = coreSocialistValues[index];
span.style.cssText = ['z-index: 9999999; position: absolute; font-size: 14px; font-weight: bold; color: #dd2222; top: ', y - 20, 'px; left: ', x, 'px;'].join('');
document.body.appendChild(span);
animate(span);
});
function animate(el) {
var start = window.performance.now(),
top = parseInt(el.style.top);
function frame(timestamp) {
var progress = timestamp - start;
if (progress > 1500) {
el.parentNode.removeChild(el);
} else {
el.style.top = top - progress / 8 + 'px';
el.style.opacity = (1500 - progress) / 1500;
window.requestAnimationFrame(frame);
}
}
window.requestAnimationFrame(frame);
}
})();