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

data-attributes support #17

Closed
wants to merge 1 commit into from
Closed

data-attributes support #17

wants to merge 1 commit into from

Conversation

n3t
Copy link

@n3t n3t commented Jun 16, 2022

Hi,

this PR adds ability to specify additional attributes of created iframe.
Syntax is

<div
    data-service="youtube" 
    data-id="dIP7wWY4Znw"
    data-attributes="json_encoded_attributes"
>
</div>

or in service definition

    window.addEventListener('load', function(){
        
        var manager = iframemanager();
        
        // Example with youtube embed
        manager.run({
            currLang: 'en',
            services : {
                youtube : {
                    embedUrl: 'https://www.youtube-nocookie.com/embed/{data-id}',
                    thumbnailUrl: 'https://i3.ytimg.com/vi/{data-id}/hqdefault.jpg',
                    iframe : {
                        allow : 'accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen;',
                        attributes : {
                            width: 600,
                            height: 360,
                        },
                    },
                    cookie : {
                        name : 'cc_youtube'
                    },
                    languages : {
                        en : {
                            notice: 'This content is hosted by a third party. By showing the external content you accept the <a rel="noreferrer" href="https://www.youtube.com/t/terms" title="Terms and conditions" target="_blank">terms and conditions</a> of youtube.com.',
                            loadBtn: 'Load video',
                            loadAllBtn: 'Don\'t ask again'
                        }
                    }
                }
            }
        });
    });

Please consider merging this, I thin it's missing feature of IFrameManager.

Thanks

Adds option to add additional attributes to created iframe
@n3t n3t mentioned this pull request Jun 16, 2022
@stale
Copy link

stale bot commented Nov 14, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Nov 14, 2022
@orestbida
Copy link
Owner

A similar approach is implemented in 1.1.0. The main difference is that it allows individual attributes rather than a json formatted value.

@orestbida orestbida closed this Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants