XVideos Upload Helper

try to take over the world!

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         XVideos Upload Helper
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.xvideos.com/account/uploads/new
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    let lastTitle = ''
    console.log('running');
    function addTags(tags) {
        if (tags.length === 0) return;
        document.querySelector('.tag-list [id^="tag-adder"]').value = tags[0]
        document.querySelector('.tag-list button').click()
        setTimeout(addTags, 50, tags.slice(1))
    }

    function check() {
        upload_form_category_category_centered_category_straight.checked = true
        upload_form_file_terms.checked = true

        const path = document.querySelector('.file-upload-recap').innerText;
        if (path.trim() === '') return;
        let title = path.match(/\\([^\\]+$)/)[1]
        title = title.replace(/(1Giay.Net|1giay.net|mkv|mp4|ts|MP4|TS)/g, ' ')
        title = title.replace(/(\.|\+)/g, ' ').trim()
        if (title === lastTitle) return;

        upload_form_networksites_networksites_centered_networksites_DEFAULT_ONLY.parentNode.click()

        if (!upload_form_titledesc_title.value) upload_form_titledesc_title.value = title
        if (!upload_form_titledesc_description.value) upload_form_titledesc_description.value = title
        const tags = title.split(' ').filter(s => s.length > 2)

        document.querySelector('.tag-list button').click()
        setTimeout(addTags, 50, tags)

        lastTitle = title;
    }

    setInterval(check, 500)

})();