Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modified jquery.prettyembed.js to allow multiple instances #22

Closed
wants to merge 1 commit into from

Conversation

sethbrasile
Copy link

Added:

$(this).attr('id', thisVideoID);

Just after:

if ( $(this).attr('data-pe-videoid') !== undefined ) { thisVideoID = $(this).attr('data-pe-videoid'); }
        else if ( $(this).attr('href') !== undefined ) { thisVideoID = youtube_parser( $(this).attr('href') ); }
        else { thisVideoID = options.videoID; }

Changed:

$(this)

To:

$(e.target)

In:

 $('body').on('click', '.pretty-embed', function(e) {
        e.preventDefault();

        clickEventRunner( $(this) );
    });

Because it seemed like this was working in the wrong context.


Changed:

else if ( options.videoID !== undefined ) { thisVideoID = options.videoID; }

To:

else if ( obj.attr('id') !== undefined ) { thisVideoID = obj.attr('id'); }

In:

if ( obj.attr('data-pe-videoid') !== undefined ) { thisVideoID = obj.attr('data-pe-videoid'); }
        else if ( options.videoID !== undefined ) { thisVideoID = options.videoID; }
        else {
            thisVideoID = undefined;
            console.error('PrettyEmbed.js Error:  Misformed or missing video ID.');
        }

To set video id from 'id' attribute that was added earlier.

I did not check for other use cases (such as the "HTML5 Driven Application" example).

@olets
Copy link

olets commented Sep 30, 2015

Thanks for doing this!

@sethbrasile sethbrasile closed this Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants