erai-raws sub preview Image

Show image preview next to the anime subtitles.

נכון ליום 26-09-2023. ראה הגרסה האחרונה.

// ==UserScript==
// @name         erai-raws sub preview Image
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Show image preview next to the anime subtitles.
// @author       dr.bobo0
// @match        https://www.erai-raws.info/subs/*
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAMFBMVEVHcEy3ISG3ISG3ISG3ISG3ISG3ISG3ISG3ISG3ISG3ISG3ISG3ISG3ISG3ISG3ISFbcynrAAAAD3RSTlMA1OaywnKHOhgNXPQmnEsN6GgJAAACVUlEQVRYhe1WSYKEIAyUfZf//3YgLAbEbpzrTJ1EKbJVIsfxj78Ck/BLqj4lI9TF6Ci3r8mW0YjBX7EliTeIbfo5sAkPQQaWHjbp6qKTYH07NEa6x5eNzawuB6YzfHIghi1+qBmztXI21UBleqRbtVRAD7qtxRXOnhZ49h1tbXS6K4NUejmtc0DnJv04UgU8XvvAgtVPuxcQ2dvfKh/AS/2F8otjjLJCJlh//9bRdZBbiBLCawBKcoc+fdI1OiJD5sbit854ELa2gbpx57lgx7UwtRh70FHCGcdNTa3y2mh/ZsHOiTiRIcrkCVkUzZ3i1xW5mgRz2G7IsavwtTNc8JAYhghkWPUWdkHhY8EssTWxw0wiOI0t72RWfIqKqWPF97gONfiF4o2ATIkbP2u+vyh8oo4nnPe6B5TR4v8HZak7HzhV6xqK9KHhPGwYXjFsUqxl6V0NUedKOGxA0aGkKQPu3nhnc9HAbiQ6mK9YEmQV/xUjCOTKb5mvQyPMMyhb5d0GPLXyatHkivXCsAFAmcQQF9gjUsB/toudmWk7zqGpVqAu02So9Mlhk3cLaD3je+uz7kpgmM3FveD13+HQIKEQta0CpuUzYUKtx+3saJ13IMD8P8sldUtmw/A7b1cRUGgEh8dKLuFF4GkApznUX9GLlrMgn6hP4Kjcdq32j4BZ1qxCNO/4YpQ7/Z6EEaUA1/ptElABLofeJIHMdVPvkgAJHFrc4J78CjUmsPvE1tvvoPF+I5OlHbauKmol3JLWuHWAnxNQ3jJKw+ZdybLXN/t//HX8ACejMFAROu21AAAAAElFTkSuQmCC
// @grant        none
// ==/UserScript==
(function() {
    'use strict';

    // Function to add the smaller icon
    function addSmallerIconBeforeFileName() {
        // Select the <span> elements with class "file-name"
        var fileNameElements = document.querySelectorAll("span.file-name");

        // Loop through each element and check if it contains "ara" in its text
        fileNameElements.forEach(function(element) {
//***ara            
if (element.textContent.includes(".ara")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/sa.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed

                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***eng            
if (element.textContent.includes(".eng")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/us.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed

                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***por
if (element.textContent.includes(".por")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/br.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***spa
if (element.textContent.includes(".spa")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/es.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***fre
if (element.textContent.includes(".fre")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/fr.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***ita
if (element.textContent.includes(".ita")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/it.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***rus
if (element.textContent.includes(".rus")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/ru.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***ger
if (element.textContent.includes(".ger")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/de.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***pol
if (element.textContent.includes(".pol")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/pl.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***dut
if (element.textContent.includes(".dut")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/nl.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***nob
if (element.textContent.includes(".nob")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/no.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***fin
if (element.textContent.includes(".fin")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/fi.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***tur
if (element.textContent.includes(".tur")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/tr.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***swe
if (element.textContent.includes(".swe")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/se.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***gre
if (element.textContent.includes(".gre")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/gr.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***rum
if (element.textContent.includes(".rum")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/ro.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***kor
if (element.textContent.includes(".kor")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/kr.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***dan
if (element.textContent.includes(".dan")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/dk.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***chi
if (element.textContent.includes(".chi")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/cn.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***hun
if (element.textContent.includes(".hun")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/hu.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***cze
if (element.textContent.includes(".cze")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/cz.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }
//***slo
if (element.textContent.includes(".slo")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/sk.svg?x27661";
                icon.style.width = "20px"; // Adjust the width as needed
                icon.style.height = "20px"; // Adjust the height as needed
                icon.style.marginRight = "5px"; // Adjust the margin as needed
                // Insert the smaller icon before the text inside the <span> element
                element.insertBefore(icon, element.firstChild);
            }


        });
    }

    // Run the function on page load
    addSmallerIconBeforeFileName();
})();