您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds cool animations to buttons in Duolingo
当前为
- // ==UserScript==
- // @name Duolingo Button Animations
- // @namespace http://tampermonkey.net/
- // @description Adds cool animations to buttons in Duolingo
- // @author Your Name
- // @match https://www.duolingo.com/*
- // @grant GM_addStyle
- // @license Redistribution prohibited
- // @version 0.3
- // ==/UserScript==
- (function() {
- 'use strict';
- GM_addStyle(`
- .button-animation {
- transition: transform 0.2s ease-in-out;
- border-radius: 8px;
- padding: 10px 20px;
- cursor: pointer;
- position: relative;
- }
- .button-animation:hover::after {
- opacity: 1;
- }
- .button-animation.magnetic {
- transition: transform 0.1s ease-in-out;
- }
- `);
- document.addEventListener('mousemove', function(e) {
- const buttons = document.querySelectorAll('.button-animation');
- buttons.forEach(button => {
- const rect = button.getBoundingClientRect();
- const distance = Math.sqrt((e.clientX - rect.left - rect.width / 2) ** 2 + (e.clientY - rect.top - rect.height / 2) ** 2);
- if (distance < 100) { // Установите радиус притяжения
- const x = (e.clientX - rect.left - rect.width / 2) * 0.1;
- const y = (e.clientY - rect.top - rect.height / 2) * 0.1;
- button.style.transform = `translate(${x}px, ${y}px)`;
- } else {
- button.style.transform = '';
- }
- });
- });
- const observer = new MutationObserver(() => {
- const buttons = document.querySelectorAll('button');
- buttons.forEach(button => {
- if (!button.classList.contains('button-animation')) {
- button.classList.add('button-animation');
- }
- });
- });
- observer.observe(document.body, { childList: true, subtree: true });
- })();