Next Spaceflight Countdown

Adds a countdown timer to upcoming space launches on NextSpaceflight.com

当前为 2025-02-26 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

作者
Cochinver
评分
0 0 0
版本
1.1
创建于
2025-02-26
更新于
2025-02-26
大小
1.9 KB
许可证
暂无
适用于

Next Spaceflight Countdown Userscript

Description

This userscript adds a countdown timer to elements on NextSpaceflight.com.

Functionality

  • The script selects all elements with the class mdl-card.
  • It searches for a span element inside each card where the id starts with "localized".
  • If found, it attempts to parse the textContent of this element as a date.
  • If the date is valid, the script calculates the time difference between the current time and the parsed date.
  • The script looks for an element with the class csscolumns inside the card:
    • If found, it checks if an element with the class countdown-tag already exists.
    • If not, it creates a new div element with this class and appends it to the csscolumns container.
  • The countdown timer is displayed in the format T-[days]d [hours]h [minutes]m [seconds]s and updates every second.

Execution

  • The script runs immediately when the page is loaded.
  • It updates the countdown every second using setTimeout to adjust for millisecond precision.

Page Matching

Permissions

  • The script does not request any special permissions (@grant none).

Notes

  • If the required elements are not found or the parsed date is invalid, the script does nothing.