function convertedGif(sourceURL)
    {
        debugLog('convertedGif:', sourceURL);

        // UI changes for stopped recording
        recordingStoppedInterfaceUpdate();

        // Set recording state to false
        recordingVideo = false;

        // Sanity check
        if (!sourceURL)
        {
            console.log('Error converting video to gif!');
            alert('Error converting video to gif!');

            // Clear reference to selected video thumbnail
            selectedThumbnail = null;
            return;
        }

        // Check that video thumbnail exists still
        if (!selectedThumbnail) 
        {
            console.log('Could not find video element on page. Attempting to download!');
            alert('Could not find video element on page. Attempting to download!');

            // Try to download
            chrome.runtime.sendMessage({
                request: 'downloadContent',
                filename: 'screencapture - ' + formatDate(new Date()) + '.gif',
                contentURL: sourceURL,
            });

            return;
        }

        // Switch out video with img pointed to gif
        selectedThumbnail.find('.' + CLASS_DOWNLOAD_TARGET).attr('src', sourceURL);

        // Get rid of progress bar
        selectedThumbnail.find(THUMBNAIL_PROGRESS_BAR).fadeOut('fast', function() {
            $(this).remove();
        });

        // TODO: Fix this
        // Replace download button action due to weird bug, extension crashes when trying
        //  to initiate a download
        selectedThumbnail.find('.' + CLASS_BUTTON_DOWNLOAD)
            .off('click')
            .click(function (event) 
            {
                var $target = $(this).parent().find('.' + CLASS_DOWNLOAD_TARGET);

                // Sanity Check
                if (!$target.length) 
                {
                    console.log('ERROR: no target download found!');
                    alert("Couldn't find target download!");
                    return;
                }

                alert('To download the GIF, right click and select Save Image.');
            });


        // Clear reference
        selectedThumbnail = null;
    }
// Update thumbnail with converted gif from video
Update thumbnail with converted gif from video
Update thumbnail with converted gif from video
function convertedGif(sourceURL)
    {
        debugLog('convertedGif:', sourceURL);
        recordingStoppedInterfaceUpdate();
        recordingVideo = false;
        if (!sourceURL)
        {
            console.log('Error converting video to gif!');
            alert('Error converting video to gif!');
            selectedThumbnail = null;
            return;
        }
        if (!selectedThumbnail) 
        {
            console.log('Could not find video element on page. Attempting to download!');
            alert('Could not find video element on page. Attempting to download!');
            chrome.runtime.sendMessage({
                request: 'downloadContent',
                filename: 'screencapture - ' + formatDate(new Date()) + '.gif',
                contentURL: sourceURL,
            });
            return;
        }
        selectedThumbnail.find('.' + CLASS_DOWNLOAD_TARGET).attr('src', sourceURL);
        selectedThumbnail.find(THUMBNAIL_PROGRESS_BAR).fadeOut('fast', function() {
            $(this).remove();
        });
        selectedThumbnail.find('.' + CLASS_BUTTON_DOWNLOAD)
            .off('click')
            .click(function (event) 
            {
                var $target = $(this).parent().find('.' + CLASS_DOWNLOAD_TARGET);
                if (!$target.length) 
                {
                    console.log('ERROR: no target download found!');
                    alert("Couldn't find target download!");
                    return;
                }
                alert('To download the GIF, right click and select Save Image.');
            });
        selectedThumbnail = null;
    }
function convertedGif ( sourceURL ) { debugLog ( 'convertedGif:' , sourceURL ) ; recordingStoppedInterfaceUpdate ( ) ; recordingVideo = false ; if ( ! sourceURL ) { console . log ( 'Error converting video to gif!' ) ; alert ( 'Error converting video to gif!' ) ; selectedThumbnail = null ; return ; } if ( ! selectedThumbnail ) { console . log ( 'Could not find video element on page. Attempting to download!' ) ; alert ( 'Could not find video element on page. Attempting to download!' ) ; chrome . runtime . sendMessage ( { request : 'downloadContent' , filename : 'screencapture - ' + formatDate ( new Date ( ) ) + '.gif' , contentURL : sourceURL , } ) ; return ; } selectedThumbnail . find ( '.' + CLASS_DOWNLOAD_TARGET ) . attr ( 'src' , sourceURL ) ; selectedThumbnail . find ( THUMBNAIL_PROGRESS_BAR ) . fadeOut ( 'fast' , function ( ) { $ ( this ) . remove ( ) ; } ) ; selectedThumbnail . find ( '.' + CLASS_BUTTON_DOWNLOAD ) . off ( 'click' ) . click ( function ( event ) { var $target = $ ( this ) . parent ( ) . find ( '.' + CLASS_DOWNLOAD_TARGET ) ; if ( ! $target . length ) { console . log ( 'ERROR: no target download found!' ) ; alert ( "Couldn't find target download!" ) ; return ; } alert ( 'To download the GIF, right click and select Save Image.' ) ; } ) ; selectedThumbnail = null ; }
Update thumbnail with converted gif from video
Update thumbnail with converted gif from video
// UI changes for stopped recording // Set recording state to false // Sanity check // Clear reference to selected video thumbnail // Check that video thumbnail exists still // Try to download // Switch out video with img pointed to gif // Get rid of progress bar // TODO: Fix this // Replace download button action due to weird bug, extension crashes when trying //  to initiate a download // Sanity Check // Clear reference