User:SaoMikoto/common.js: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
No edit summary Tag: Reverted |
// Edit via InPageEdit Tag: Reverted |
||
| Line 24: | Line 24: | ||
(function() { |
$(document).ready(function() { |
||
var elements = ['🍀', '☘️', '🌸', '🌿']; |
|||
// 创建飘落元素 |
|||
| ⚫ | |||
function createFallingElement() { |
function createFallingElement() { |
||
var |
var element = $('<div class="falling-element">') |
||
.text(elements[Math.floor(Math.random() * elements.length)]) |
|||
var element = document.createElement('div'); |
|||
.css({ |
|||
'left': Math.random() * 100 + '%', |
|||
'animation-duration': (Math.random() * 3 + 2) + 's', |
|||
'animation-delay': Math.random() * 2 + 's' |
|||
}); |
|||
element.style.position = 'fixed'; |
|||
element.style.top = '-50px'; |
|||
element.style.pointerEvents = 'none'; |
|||
element.style.zIndex = '9999'; |
|||
element.style.fontSize = '20px'; |
|||
element.style.animation = 'fall linear infinite'; |
|||
$('body').append(element); |
|||
// 动画结束后移除元素 |
|||
setTimeout(function() { |
setTimeout(function() { |
||
element.remove(); |
|||
element.parentNode.removeChild(element); |
|||
} |
|||
}, 8000); |
}, 8000); |
||
} |
} |
||
| ⚫ | |||
| ⚫ | |||
// 添加CSS动画 |
|||
| ⚫ | |||
function addFallingCSS() { |
|||
if (document.getElementById('falling-style')) return; |
|||
var style = document.createElement('style'); |
|||
style.id = 'falling-style'; |
|||
style.textContent = |
|||
'@keyframes fall {' + |
|||
'0% { transform: translateY(-50px) rotate(0deg); opacity: 1; }' + |
|||
'100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }' + |
|||
'}'; |
|||
document.head.appendChild(style); |
|||
| ⚫ | |||
// 初始化函数 |
|||
function initFallingElements() { |
|||
addFallingCSS(); |
|||
// 每隔800ms创建新元素 |
|||
| ⚫ | |||
| ⚫ | |||
// 页面加载完成后启动 |
|||
if (document.readyState === 'loading') { |
|||
document.addEventListener('DOMContentLoaded', initFallingElements); |
|||
} else { |
|||
initFallingElements(); |
|||
} |
|||
| ⚫ | |||
Revision as of 07:36, 29 June 2025
/** InPageEdit Preferences */
(window.InPageEdit = window.InPageEdit || {}).myPreference = {
"doNotCollectMyInfo": false,
"editMinor": false,
"editSummary": "$section // Edit via InPageEdit",
"lockToolBox": true,
"redLinkQuickEdit": false,
"outSideClose": true,
"watchList": "preferences",
"noConfirmEdit": true,
"plugins": [
"toolbox.js",
"wiki-editor.js",
"quick-thank.js",
"color-preview.js",
"code-mirror/cm6.js",
"edit-any-page.js",
"fix-double-entrance.js"
]
}
mw.loader.load('https://cdn.jsdelivr.net/npm/mediawiki-inpageedit');
importScript('User:SaoMikoto/js/Usergroup.js'); // Backlink: [[User:SaoMikoto/js/Usergroup.js]]
importScript('User:SaoMikoto/js/CleanDeleteReasons.js'); // Backlink: [[User:SaoMikoto/js/CleanDeleteReasons.js]]
$(document).ready(function() {
var elements = ['🍀', '☘️', '🌸', '🌿'];
function createFallingElement() {
var element = $('<div class="falling-element">')
.text(elements[Math.floor(Math.random() * elements.length)])
.css({
'left': Math.random() * 100 + '%',
'animation-duration': (Math.random() * 3 + 2) + 's',
'animation-delay': Math.random() * 2 + 's'
});
$('body').append(element);
setTimeout(function() {
element.remove();
}, 8000);
}
setInterval(createFallingElement, 800);
});