https://github.com/dcts/remove-css-animations
simple script to remove all CSS transformations, transitions and animations.
https://github.com/dcts/remove-css-animations
Last synced: over 1 year ago
JSON representation
simple script to remove all CSS transformations, transitions and animations.
- Host: GitHub
- URL: https://github.com/dcts/remove-css-animations
- Owner: dcts
- Created: 2019-10-25T10:22:21.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-25T12:57:10.000Z (over 6 years ago)
- Last Synced: 2025-03-06T11:13:17.059Z (over 1 year ago)
- Language: CSS
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Remove CSS Animations (for faster scraping)
This repo is a shortcut to remove css transitions, transformations and animations from a webpage for a faster scraping experience. To recap:
- **transistions**: transform css properties (width, color etc.)
- **transformations**: functions like `scale`, `skew`, `rotate` etc..
- **animations**: keyframe animations etc.
# Usage
### Chrome Console
First test if this script works locally in your browser (chrome, firefox, etc). Open the page you want to disable animations and css transitions and then execute the following code inside the console:
```js
let filePath = "https://dl.dropboxusercontent.com/s/ep1nzckmvgjq7jr/remove_transitions_from_page.css";
let html = ``;
document.querySelector("html > head").insertAdjacentHTML("beforeend", html);
```
### Ruby Selenium
Once the script successfully runs in your browser, you can try to automate it from within your webscraper. This snipped assumes you have `selenium-webdriver` successfully installed and running and shows you how to remove fancy animations to improve the scraping speed.
**Example Page**: [CSS clock that uses transitions and animations](https://dcts.github.io/javascript30-codingChallenges/days/02/)
```ruby
# 1. require selenium webdriver gem
require 'selenium-webdriver'
# 2. initialize webdriver
@driver = Selenium::WebDriver.for :chrome
# 3. go to website with some css animations
@driver.get("https://dcts.github.io/javascript30-codingChallenges/days/02/")
# 4. disable animations (JAASCRPT ONELINER SAVED AS RUBY STRING)
@driver.script("document.querySelector('html > head').insertAdjacentHTML(\"beforeend\", \"\");");
```