<commit_before><template>
    <div class="kiwi-mediaviewer">
        <div class="kiwi-mediaviewer-controls">
            <a
                class="u-button u-button-warning kiwi-mediaviewer-controls-close"
                @click="closeViewer"
            >
                <i class="fa fa-window-close" aria-hidden="true"></i>
            </a>
        </div>
        <div :key="url">
            <iframe
                v-if="isIframe"
                class="kiwi-mediaviewer-iframe"
                :src="url"
            ></iframe>
            <a
                v-else
                v-bind:href="url"
                class="embedly-card"
                :data-card-key="embedlyKey"
                data-card-chrome="0"
                data-card-controls="0"
                data-card-recommend="0"
            >{{$t('media_loading', {url: url})}}</a>
        </div>
    </div>
</template>

<script>

import state from '@/libs/state';

let embedlyTagIncluded = false;

export default {
    data: function data() {
        return {
        };
    },
    props: ['url', 'isIframe'],
    computed: {
        embedlyKey: function embedlyKey() {
            return state.settings.embedly.key;
        },
    },
    methods: {
        updateEmbed: function updateEmbed() {
            let checkEmbedlyAndShowCard = () => {
                // If the embedly function doesn't exist it's probably still loading
                // the embedly script
                if (typeof window.embedly !== 'function' || typeof el === 'undefined') {
                    setTimeout(checkEmbedlyAndShowCard, 100);
                    return;
                }
                window.embedly('card', { selector: '.embedly-card' });
            };

            if (!embedlyTagIncluded) {
                let head = document.getElementsByTagName('head')[0];
                let script = document.createElement('script');
                script.type = 'text/javascript';
                script.src = '//cdn.embedly.com/widgets/platform.js';
                head.appendChild(script);
                embedlyTagIncluded = true;
            }
            checkEmbedlyAndShowCard();
        },
        closeViewer: function closeViewer() {
            state.settings.mediaviewerIframe = false;
            state.$emit('mediaviewer.hide');
        },
    },
    created: function created() {
        this.updateEmbed();
    },
    mounted: function mounted() {
        this.$nextTick(() => {
            state.$emit('mediaviewer.opened');<commit_msg>Removed extraneous line from MediaViewer.vue<commit_after><template>
    <div class="kiwi-mediaviewer">
        <div class="kiwi-mediaviewer-controls">
            <a
                class="u-button u-button-warning kiwi-mediaviewer-controls-close"
                @click="closeViewer"
            >
                <i class="fa fa-window-close" aria-hidden="true"></i>
            </a>
        </div>
        <div :key="url">
            <iframe
                v-if="isIframe"
                class="kiwi-mediaviewer-iframe"
                :src="url"
            ></iframe>
            <a
                v-else
                v-bind:href="url"
                class="embedly-card"
                :data-card-key="embedlyKey"
                data-card-chrome="0"
                data-card-controls="0"
                data-card-recommend="0"
            >{{$t('media_loading', {url: url})}}</a>
        </div>
    </div>
</template>

<script>

import state from '@/libs/state';

let embedlyTagIncluded = false;

export default {
    data: function data() {
        return {
        };
    },
    props: ['url', 'isIframe'],
    computed: {
        embedlyKey: function embedlyKey() {
            return state.settings.embedly.key;
        },
    },
    methods: {
        updateEmbed: function updateEmbed() {
            let checkEmbedlyAndShowCard = () => {
                // If the embedly function doesn't exist it's probably still loading
                // the embedly script
                if (typeof window.embedly !== 'function' || typeof el === 'undefined') {
                    setTimeout(checkEmbedlyAndShowCard, 100);
                    return;
                }
                window.embedly('card', { selector: '.embedly-card' });
            };

            if (!embedlyTagIncluded) {
                let head = document.getElementsByTagName('head')[0];
                let script = document.createElement('script');
                script.type = 'text/javascript';
                script.src = '//cdn.embedly.com/widgets/platform.js';
                head.appendChild(script);
                embedlyTagIncluded = true;
            }
            checkEmbedlyAndShowCard();
        },
        closeViewer: function closeViewer() {
            state.$emit('mediaviewer.hide');
        },
    },
    created: function created() {
        this.updateEmbed();
    },
    mounted: function mounted() {
        this.$nextTick(() => {
            state.$emit('mediaviewer.opened');
{'fraction_non_alphanumeric': 0.13244373630750847, 'fraction_numerical': 0.0027882891854212307, 'mean_word_length': 1.487369985141159, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2244530', 'n_tokens_mistral': 1436, 'n_tokens_neox': 1334, 'n_words': 247}