🏠 Home 

Du skal logge ind eller oprette en konto for at kunne fortsætte.

Next Spaceflight Countdown

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


ติดตั้งสคริปต์นี้?
ผู้เขียน
Cochinver
จำนวนติดตั้งประจำวัน
0
จำนวนติดตั้งทั้งหมด
1
คะแนน
0 0 0
เวอร์ชัน
1.1
สร้างเมื่อ
26-02-2025
อัปเดตเมื่อ
26-02-2025
Size
1.93 กิโลไบต์
สัญญาอนุญาต
ไม่มี
ปรับใช้กับ

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.