<commit_before>import { InfLoadWatch } from '../utils';

const FilterFeed = class FilterFeed extends InfLoadWatch {
    constructor() {
        super('.mod-feed');
        this.filteredReasons = [
            'wip_meta',
            'wip_game',
            'community_spotlight_custom_picks',
            'community_spotlight_editors_picks',
            'community_spotlight_custom_filter',
            'community_spotlight_metatag',
            'community_spotlight_hashtag',
        ];
            // 'replay_by_follow'
            // 'replay_by_me'
        this.feedAction(document.querySelectorAll('.feed-item'));
    }

    feedAction(feedItems) {
        feedItems.forEach((feedItem) => {
            const feedItemConf = JSON.parse(feedItem.dataset.conf);
            const feedItemReason = feedItemConf.reason;
            if (this.filteredReasons.includes(feedItemReason)) {
                const video = feedItem.querySelector('video');
                // Hack to make sure that the video is stopped before removing it
                video.pause();
                video.src = '';
                video.load();
                feedItem.remove();
            }
        });
        window.scrollY += 1;
    }
};

export default function () {
    const filterFeed = new FilterFeed();
    filterFeed.startWatch();
}<commit_msg>buggy reimplementtaion of autoplay<commit_after>import { InfLoadWatch } from '../utils';

const FilterFeed = class FilterFeed extends InfLoadWatch {
    constructor() {
        super('.mod-feed');
        this.filteredReasons = [
            'wip_meta',
            'wip_game',
            'community_spotlight_custom_picks',
            'community_spotlight_editors_picks',
            'community_spotlight_custom_filter',
            'community_spotlight_metatag',
            'community_spotlight_hashtag',
        ];
            // 'replay_by_follow'
            // 'replay_by_me'

        this.initialVideoPlayed = false;

        this.feedAction(document.querySelectorAll('.feed-item'));
    }


    feedAction(feedItems) {
        feedItems.forEach((feedItem) => {
            const feedItemConf = JSON.parse(feedItem.dataset.conf);
            const feedItemReason = feedItemConf.reason;
            const video = feedItem.querySelector('video');
            if (this.filteredReasons.includes(feedItemReason)) {
                // Hack to make sure that the video is stopped before removing it
                video.pause();
                video.src = '';
                video.load();
                feedItem.remove();
            } else if (!this.initialVideoPlayed) {
                if (!video.paused && video.currentTime > 0) {
                    this.initialVideoPlayed = true;
                } else {
                    this.initialVideoPlayed = true;
                    
                    console.log(this.initialVideoPlayed);
                    video.play();
                    feedItem.querySelector('.ui-player').classList.add('playing');
                    feedItem.querySelector('.ui-player').setAttribute('init', true);
                }
            }
        });
        window.scrollY += 1;
    }
};

export default function () {
    const filterFeed = new FilterFeed();
    filterFeed.startWatch();
}
{'fraction_non_alphanumeric': 0.10825688073394496, 'fraction_numerical': 0.0009174311926605505, 'mean_word_length': 1.7909556313993173, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '1956352', 'n_tokens_mistral': 876, 'n_tokens_neox': 836, 'n_words': 146}