DownloadTracker

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

질문, 리뷰하거나, 이 스크립트를 신고하세요.
개발자
slyfox1186
일일 설치수
0
총 설치수
1
평점
0 0 0
버전
1.1
생성
2024-06-03
갱신
2024-06-03
라이선스
MIT
동작 사이트
모든 사이트

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.