jut_su_download_button

adding button on jut.su for downloading

Author
Иван Задорожный
Daily installs
0
Total installs
4
Ratings
0 0 0
Version
2024-03-17
Created
2024-05-17
Updated
2024-05-17
License
MIT
Applies to

Script Description

Purpose

This script dynamically adds a download button for a 1080p video source on a webpage. The button allows users to download the video file directly when clicked. The script waits for the specified video source element to be available in the DOM before adding the button.

How It Works

  1. Wait for Video Source: The script uses waitForKeyElements to monitor the DOM for the presence of a video source element with the label "1080p".
  2. Extract Video Name: Once the element is found, the script extracts the video name from the base URI.
  3. Create Download Link: The script creates a download link and a container div to hold the link. The download link is styled and has an event listener to handle the download action via JavaScript.
  4. Append to DOM: The script appends the download link container to a target element on the page, specified by the class name videoContent.

Detailed Explanation

  1. waitForKeyElements:

    • Monitors the DOM for the specified selector.
    • Calls the addButton function when the element is found.
  2. addButton:

    • Extracts the video source URL and name.
    • Selects the container where the download button will be added.
    • Creates and appends the download link using createDownloadLink.
  3. extractVideoName:

    • Splits the base URI to derive the video name.
  4. createDownloadLink:

    • Creates a div and a element styled for the download link.
    • Adds a click event listener to handle the download action.
  5. handleDownloadClick:

    • Prevents the default action.
    • Creates a temporary a element to trigger the download.
    • Initiates the download and removes the temporary element.

Usage

  • This script is intended to be used on web pages with video content on jut.su.
  • It adds functionality for users to easily download a 1080p video file with a single click.