DownloadTracker

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

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

作者
slyfox1186
日安装量
0
总安装量
4
评分
0 0 0
版本
1.1
创建于
2024-06-03
更新于
2024-06-03
大小
282.2 KB
许可证
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.