erai-raws sub preview Image

Show image preview next to the anime subtitles.

目前為 2023-09-29 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         erai-raws sub preview Image
// @namespace    http://tampermonkey.net/
// @version      1.2
// @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","eng"..ex 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
            var fileName = element.textContent;

            // Check if the file name contains ".spa.ass" but not "5.spa"
if (fileName.includes(".spa.ass") && !fileName.includes("5.spa") && !fileName.includes("la.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);
            }
//***spa Latin_America
if (element.textContent.includes("5.spa")|| element.textContent.includes("la.spa")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/mx.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);
            }
//***jpn
if (element.textContent.includes(".jpn")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/jp.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);
            }
//***heb
if (element.textContent.includes(".heb")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/il.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);
            }
//***ind
if (element.textContent.includes(".ind")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/id.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);
            }
//***tha
if (element.textContent.includes(".tha")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/th.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);
            }
//***vie
if (element.textContent.includes(".vie")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/vn.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);
            }
//***ukr
if (element.textContent.includes(".ukr")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/ua.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);
            }
//***may
if (element.textContent.includes(".may")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/my.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);
            }
//***fil
if (element.textContent.includes(".fil")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/ph.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);
            }
//***hrv
if (element.textContent.includes(".hrv")) {
                // Create an icon element
                var icon = document.createElement("img");
                icon.src = "https://www.erai-raws.info/wp-content/themes/generatepress_child/flags/4x3/hr.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();
})();