DownloadTracker

Log download links and current website URL with hotkeys for displaying and deleting logs

Autor
slyfox1186
Dziennych instalacji
0
Wszystkich instalacji
2
Oceny
0 0 0
Wersja
1.1
Utworzono
03-06-2024
Zaktualizowano
03-06-2024
Licencja
MIT
Dotyczy
Wszystkie strony

DownloadTracker

DownloadTracker is a user script that logs information about downloads, including the current URL, download URL, and any redirect URLs encountered during the download process. It stores this information in the browser's local storage and provides hotkey shortcuts to display, clear, or save the log to the user's PC.

Features

  • Logs download information (current URL, download URL, redirect URLs) to the browser's local storage
  • Handles dynamically added download links using MutationObserver
  • Provides hotkey shortcuts for displaying, clearing, and saving the download log
  • Allows saving the download log as a text file on the user's PC

Usage

  1. Install a user script manager extension for your browser (e.g., Tampermonkey, Violentmonkey).
  2. Install the DownloadTracker user script.
  3. Navigate to a website where you want to log download information.
  4. Click on any download link, and the script will log the relevant information to the browser's local storage.
  5. Use the following hotkey shortcuts:
    • Ctrl + Alt + 5: Display the download log
    • Alt + 5: Clear the download log
  6. When displaying the log, you will be prompted to save the log as a text file on your PC if desired.

How It Works

  1. The script listens for click events on download links (<a> tags with an href attribute).
  2. When a download link is clicked, the script logs the current URL, download URL, and any redirect URLs encountered during the download process.
  3. The script uses the fetch API with the HEAD method to capture redirect URLs.
  4. The logged information is stored in the browser's local storage using the GM_setValue function provided by the user script manager.
  5. The MutationObserver is used to handle dynamically added download links and attach event listeners to them.
  6. Hotkey shortcuts are implemented using the keydown event listener.
  7. When the display hotkey is pressed, the script retrieves the logged information from local storage and displays it in an alert. The user is then prompted to save the log as a text file on their PC if desired.
  8. When the clear hotkey is pressed, the script gives the option to save the log as a text file before clearing the local storage.

Note: This script is designed to work with user script manager extensions and may not function correctly if used in a different context.