禁用动画

禁用网页上的动画效果

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         DisableAnimation
// @name:zh-CN   禁用动画
// @description  Disable animation on page
// @description:zh-CN  禁用网页上的动画效果
// @namespace    https://greasyfork.org/users/197529
// @version      0.7.2
// @author       kkocdko
// @license      Unlicense
// @match        *://*/*
// @run-at       document-start
// ==/UserScript==
'use strict'

runInGrobal(() => {
  window.requestAnimationFrame = callback => setTimeout(callback, 200)
})

document.head.insertAdjacentHTML('beforeend', `<style>

*,
*::before,
*::after {
  animation: none !important;
  transition: none !important;
}

</style>`)

function runInGrobal (callback) {
  const scriptEl = document.createElement('script')
  scriptEl.textContent = callback.toString()
  document.head.appendChild(scriptEl)
}