{"size": 1324, "ext": "js", "max_stars_repo_path": "src/action.js", "max_stars_repo_name": "XMYSTERlOUSX/chrome-extension-zoom.us-video-downloader", "max_stars_repo_stars_event_min_datetime": "2020-05-22T07:31:11.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-11T02:28:26.000Z", "max_issues_repo_path": "src/action.js", "max_issues_repo_name": "XMYSTERlOUSX/chrome-extension-zoom.us-video-downloader", "max_issues_repo_issues_event_min_datetime": "2020-05-22T07:30:52.000Z", "max_issues_repo_issues_event_max_datetime": "2020-06-11T11:18:49.000Z", "max_forks_repo_path": "src/action.js", "max_forks_repo_name": "mrzlab630/chrome-extension-zoom.us-video-downloader", "max_forks_repo_forks_event_min_datetime": "2020-05-10T19:29:47.000Z", "max_forks_repo_forks_event_max_datetime": "2021-07-28T16:58:09.000Z"}
{"max_stars_count": 10, "max_issues_count": 3, "max_forks_count": 5, "avg_line_length": 21.3548387097, "max_line_length": 143, "alphanum_fraction": 0.5770392749}
/**
 *
 * by mrZ
 * Email: mrZ@mrZLab630pw
 * Date: 05.05.2020
 * Time: 9:04
 * About: zoom download link
 *
 */
'use strict'



const action = function () {
try{


    console.log('Freedom of Information!')

    const downloadIcon = chrome.runtime.getURL('assets/icons/download.svg')

    const videoBlockArr = document.getElementsByTagName('video')


        if(!videoBlockArr[0]){
            throw new Error(`can't find the video block`)
        }

    const videoLink = videoBlockArr[0].src

    if(!videoLink){
        throw new Error(`can't find the video link`)
    }

    const divDownloadLink =  document.createElement('div')

    divDownloadLink.className = 'downloadLink';

    divDownloadLink.innerHTML = `
                                <div class="tooltip">
                                <a href="${videoLink}" id="downloadLinkButton"><img src="${downloadIcon}" alt="download link" width="30" /></a>
                                  <span class="tooltiptext">Right click and Save link as</span>
                                </div>
                                `


    document.getElementsByClassName('player-view-wrapper')[0].prepend(divDownloadLink)






}catch (e) {
    console.error(e)
}
}
document.addEventListener('readystatechange', () => document.readyState === 'complete' && action());



