Next Spaceflight Countdown

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

目前為 2025-02-26 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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.