Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.4 kB
2
Indexable
<script>
            var TIME_TO_SHOW_THINGS = 793; // in seconds
            var HIDDEN_CONTENT_ID = 'hiddenContent';
            var EMBED_CODE_ID = 'vidalytics_embed_3eyLEko6uSpriuyw'; // Replace XXXXXX with your embed code ID
            var EMBED_CODE_RETURNING_KEY = EMBED_CODE_ID + '_returning'
            if (!localStorage.getItem(EMBED_CODE_RETURNING_KEY)) {
                function checkVideoTime() {
                    var embeds = (_vidalytics || {}).embeds || {};
                    if (embeds[EMBED_CODE_ID]) {
                        var player = embeds[EMBED_CODE_ID].player || {};
                        if (player.getCurrentVideoTime) {
                            var currentTime = player.getCurrentVideoTime();
                            if (currentTime >= TIME_TO_SHOW_THINGS) {
                                showHiddenItem();
                                return;
                            }
                        }
                    }
                    setTimeout(checkVideoTime, 1000);
                }
                checkVideoTime();
                localStorage.setItem(EMBED_CODE_RETURNING_KEY, true);
            } else {
                showHiddenItem();
            }
            function showHiddenItem() {
                    document.getElementById(HIDDEN_CONTENT_ID).style.display = 'block';
            }
    </script>