Skip to content

“This JS snippet enhances your English study on the New York Times by providing light/dark theme toggling, translation, note-taking areas, PDF saving, audio downloading, and additional features.”

License

Notifications You must be signed in to change notification settings

Mending-Electronics/Web-Browser-JS-Snippet-New-York-Times-Article-Cleaner

Repository files navigation

New York Times Article Cleaner JS Snippet

Goal

The New York Times Article Cleaner JS Snippet is designed to enhance your English language study experience by streamlining the reading process. It achieves this by:

What the snippet does:

  1. Removing Ads and Non-Essential Elements: It eliminates distracting ads and other unnecessary content, leaving only the article text and relevant images.

  2. Customizable Themes: It adds a button that lets you toggle between light and dark themes for comfortable reading.

  3. Text Formatting: It justifies paragraphs and uses a legible font for improved readability.

  4. Text Size: It adds a range slider to allow you to adjust the text size as desired.

  5. Note Area: It adds a button that lets you toggle between adding or removing empty areas below each paragraph to take notes.

  6. Translate: It includes the Google Translate service in the webpage to translate the article.

  7. Audio Isolation: If the New York Times provides an audio reader, the snippet isolates the article audio, allowing you to adjust sound levels and download it as an MP3.

  8. PDF Export: It adds a button to save the cleaned article as a PDF directly from your web browser's PDF reader.

(Tip: Save the article in two PDF files, first in English (US) and the second in your native language to compare.)

What Is a Snippet?

A snippet is a script embedded into your web browser that can be executed on demand to interact with the current page. In the case of our JavaScript snippet, it's written in ES5 (ECMAScript 5) and allows you to manipulate the content of the New York Times article dynamically.

Warning: Be cautious when using snippets from untrusted sources, as they could potentially include backdoors or malicious code.

Installation

To use the snippet:

  1. Access the Web Browser DevTools: Open your web browser (such as Chrome or Firefox), navigate to the page with the New York Times article, and open the developer console (usually F12 or Ctrl+Shift+I).

  2. Navigate to the "Sources" Tab: In the developer console, switch to the "Sources" tab.

  3. Create a New Snippet: Within the "Sources" tab, find the "Snippets" sub-tab. Create a new snippet by clicking the "+" icon.

  4. Allow Snippet Creation (First Use): If prompted, allow snippet creation. This ensures you can create and save your custom snippet.

  5. Rename Your Snippet: Give your snippet a descriptive name for easy identification.

  6. Write or Paste Code: In the snippet editor view, write your JavaScript code or paste an existing snippet.

  7. Save the Snippet: Press Ctrl+S (or Cmd+S on macOS) to save your snippet.

  8. Execute the Snippet: Right-click on your snippet and select "Run" to execute it. The snippet will clean up the New York Times article on the current page.

Feel free to customize the snippet further based on your preferences!

Capture

Web Browser DevTools - Snippet menu

Web Browser DevTools - Snippet menu

Article Header

Before (original)

Article Header Before

After (with light mode)

Article Header After

After (with Dark mode)

Article Header After

Article

Before (original)

Article Before

After (with dark mode)

Article After

Article Translation

(with dark mode)

Article Translation

Article Note Area

(with dark mode)

Article Note Area

Show / Hide Header

(with dark mode)

Show Hide Header

Article PDF

(with dark mode)

PDF Dark

(with light mode)

PDF White

About

“This JS snippet enhances your English study on the New York Times by providing light/dark theme toggling, translation, note-taking areas, PDF saving, audio downloading, and additional features.”

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published