• 🚀 Đăng ký ngay để không bỏ lỡ những nội dung chất lượng! 💯 Hoàn toàn miễn phí!

Script để tự động chuyển hình ảnh và videos vào tag Spoiler

đéo có hình chó nó tin

Cái nồi có lắp
Cambodia
Script này là để chuyển nội dung hình ảnh và videos vào tag Spoiler, nhằm hạn chế nội dung từ mấy thằng mắc dịch đang trong box Điểm báo thì tụi nó post hình và videos porn.

Và cái này là tao nhờ con ChatGPT viết và kết hợp Grok sửa lỗi/tối ưu, có gì tụi bây chửi nó chứ tao ko biết gì đâu.

Script này chạy được trên mobile Android luôn, tụi bây cài Firefox hoặc Iceraven rồi cài Violentmonkey vào, copy & paste script vào là chạy.


Hướng dẫn sử dụng:
  • Cài đặt extension:
    • Cài Tampermonkey hoặc Violentmonkey trên trình duyệt.
  • Thêm script:
    • Mở extension Tampermonkey/Violentmonkey.
    • Nhấn nút "Create a new script" hoặc biểu tượng "+" để tạo script mới.
    • Copy toàn bộ code trên và paste vào editor.
    • Nhấn Ctrl+S hoặc File > Save để lưu.
  • Kiểm tra hoạt động:
    • Truy cập xamvn.nl.
    • Script sẽ tự động chạy và bọc bất kỳ hình ảnh hoặc video nào từ anh.moe vào tag spoiler.
    • Người dùng sẽ phải nhấn nút "Spoiler" để xem nội dung.


JavaScript:
// ==UserScript==
// @name         XamVN Spoiler Customizable
// @namespace    https://xamvn.nl/
// @version      2.0
// @description  Bọc tất cả ảnh và video từ danh sách domain tuỳ chỉnh vào tag Spoiler trên các website tuỳ chỉnh (XenForo)
// @author       Bạn
// @match        *://*/*
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_registerMenuCommand
// ==/UserScript==

(function() {
    'use strict';

    // Lấy danh sách domain ảnh/video và website từ settings (hoặc mặc định)
    let blockedMediaDomains = GM_getValue('blockedMediaDomains', ['anh.moe', 'cdn.anh.moe', 'imgur.com']);
    let affectedWebsites = GM_getValue('affectedWebsites', ['xamvn.nl']);

    function saveSettings() {
        GM_setValue('blockedMediaDomains', blockedMediaDomains);
        GM_setValue('affectedWebsites', affectedWebsites);
    }

    function showSettings() {
        const overlay = document.createElement('div');
        overlay.style.cssText = `
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.5); z-index: 9999; display: flex;
            justify-content: center; align-items: center;
        `;

        const settingsBox = document.createElement('div');
        settingsBox.style.cssText = `
            background: white; padding: 20px; border-radius: 5px;
            width: 400px; max-width: 90%;
        `;

        settingsBox.innerHTML = `
            <h3>Cài đặt Spoiler</h3>
            <label>Danh sách domain hình/video (cách nhau bởi dấu phẩy):</label><br>
            <textarea id="mediaDomains" rows="3" style="width: 100%;">${blockedMediaDomains.join(',')}</textarea><br><br>
            <label>Danh sách website áp dụng (cách nhau bởi dấu phẩy):</label><br>
            <textarea id="websites" rows="3" style="width: 100%;">${affectedWebsites.join(',')}</textarea><br><br>
            <button id="saveSettings">Lưu</button>
            <button id="cancelSettings" style="margin-left: 10px;">Hủy</button>
        `;

        overlay.appendChild(settingsBox);
        document.body.appendChild(overlay);

        document.getElementById('saveSettings').onclick = () => {
            const newMediaDomains = document.getElementById('mediaDomains').value;
            const newWebsites = document.getElementById('websites').value;

            blockedMediaDomains = newMediaDomains.split(',').map(d => d.trim()).filter(d => d);
            affectedWebsites = newWebsites.split(',').map(d => d.trim()).filter(d => d);

            saveSettings();
            document.body.removeChild(overlay);
            alert('Cài đặt đã được lưu. Hãy reload trang để áp dụng thay đổi.');
        };

        document.getElementById('cancelSettings').onclick = () => {
            document.body.removeChild(overlay);
        };
    }

    GM_registerMenuCommand('⚙ Cài đặt Spoiler', showSettings);

    if (!affectedWebsites.some(site => location.hostname.includes(site))) return;

    function wrapInSpoiler(mediaElement) {
        if (mediaElement.closest('.spoiler-container')) return;

        const spoiler = document.createElement('div');
        spoiler.className = 'spoiler-container';

        const button = document.createElement('button');
        const mediaType = mediaElement.tagName.toLowerCase() === 'video' ? 'video' : 'image';
        button.textContent = `Ẩn (${mediaType})`;
        button.style.cssText = `
            display: block;
            margin: 5px 0;
            font-size: 14px;
            font-weight: bold;
            background-color: #800080;
            color: white;
            padding: 5px 10px;
            border: none;
            border-radius: 3px;
            box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
            cursor: pointer;
            touch-action: manipulation; /* Cải thiện tương tác trên di động */
        `;

        let isHidden = true;
        const toggleMedia = (event) => {
            event.preventDefault();
            event.stopPropagation();
            if (isHidden) {
                mediaElement.style.display = 'block';
                isHidden = false;
            } else {
                mediaElement.style.display = 'none';
                isHidden = true;
            }
        };

        // Hỗ trợ cả click và touch trên di động
        button.addEventListener('click', toggleMedia);
        button.addEventListener('touchstart', toggleMedia, { passive: false });

        mediaElement.style.display = 'none';
        mediaElement.removeAttribute('autoplay');
        mediaElement.removeAttribute('muted');

        mediaElement.parentNode.insertBefore(spoiler, mediaElement);
        spoiler.appendChild(button);
        spoiler.appendChild(mediaElement);
    }

    function processMedia() {
        document.querySelectorAll('img.bbImage, video, source').forEach(media => {
            let src = media.src || (media.parentNode.tagName.toLowerCase() === 'video' ? media.parentNode.currentSrc : '');
            if (media.closest('.message-signature')) return;
          
            if (src && blockedMediaDomains.some(domain => src.includes(domain))) {
                wrapInSpoiler(media.tagName.toLowerCase() === 'source' ? media.parentNode : media);
            }
        });
    }

    // Chạy lần đầu
    processMedia();

    // Theo dõi nội dung động
    const observer = new MutationObserver(() => processMedia());
    observer.observe(document.body, { childList: true, subtree: true });
})();

Link download : https://www.mediafire.com/file/uods...ideo_cho_Xenforo_%28PC_%26_mobile%29.txt/file

Nút Cài đặt Spoiler ở trong Settings là để tụi bây tự thêm đường dẫn vào ví dụ như *anh.moe*, *anhmoecdn*, *imgur*..... và website sẽ áp dụng ví dụ như xam.nl xong rồi bấm Lưu lại.
 
Sửa lần cuối:
Hình và video sau khi cho vào tag Spoiler của 1 thằng chuyên post clip sex gây ức chế cho nhiều đứa


0f8wkhZU.png
 
Script này là để chuyển nội dung hình ảnh và videos vào tag Spoiler, nhằm hạn chế nội dung từ mấy thằng mắc dịch đang trong box Điểm báo thì tụi nó post hình và videos porn.

Và cái này là tao nhờ con ChatGPT viết và kết hợp Grok sửa lỗi/tối ưu, có gì tụi bây chửi nó chứ tao ko biết gì đâu.

Script này chạy được trên mobile Android luôn, tụi bây cài Iceraven rồi cài Violentmonkey vào, copy & paste script vào là chạy.


Hướng dẫn sử dụng:
  • Cài đặt extension:
    • Cài Tampermonkey hoặc Violentmonkey trên trình duyệt.
  • Thêm script:
    • Mở extension Tampermonkey/Violentmonkey.
    • Nhấn nút "Create a new script" hoặc biểu tượng "+" để tạo script mới.
    • Copy toàn bộ code trên và paste vào editor.
    • Nhấn Ctrl+S hoặc File > Save để lưu.
  • Kiểm tra hoạt động:
    • Truy cập xamvn.nl.
    • Script sẽ tự động chạy và bọc bất kỳ hình ảnh hoặc video nào từ anh.moe vào tag spoiler.
    • Người dùng sẽ phải nhấn nút "Spoiler" để xem nội dung.


JavaScript:
// ==UserScript==
// @name         XamVN Spoiler Customizable
// @namespace    https://xamvn.nl/
// @version      1.9
// @description  Bọc tất cả ảnh và video từ danh sách domain tuỳ chỉnh vào tag Spoiler trên các website tuỳ chỉnh (XenForo)
// @author       Bạn
// @match        *://*/*
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_registerMenuCommand
// ==/UserScript==

(function() {
    'use strict';

    // Lấy danh sách domain ảnh/video và website từ settings (hoặc mặc định)
    let blockedMediaDomains = GM_getValue('blockedMediaDomains', ['anh.moe', 'cdn.anh.moe', 'imgur.com']);
    let affectedWebsites = GM_getValue('affectedWebsites', ['xamvn.nl']);

    function saveSettings() {
        GM_setValue('blockedMediaDomains', blockedMediaDomains);
        GM_setValue('affectedWebsites', affectedWebsites);
    }

    function showSettings() {
        const overlay = document.createElement('div');
        overlay.style.cssText = `
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.5); z-index: 9999; display: flex;
            justify-content: center; align-items: center;
        `;

        const settingsBox = document.createElement('div');
        settingsBox.style.cssText = `
            background: white; padding: 20px; border-radius: 5px;
            width: 400px; max-width: 90%;
        `;

        settingsBox.innerHTML = `
            <h3>Cài đặt Spoiler</h3>
            <label>Danh sách domain hình/video (cách nhau bởi dấu phẩy):</label><br>
            <textarea id="mediaDomains" rows="3" style="width: 100%;">${blockedMediaDomains.join(',')}</textarea><br><br>
            <label>Danh sách website áp dụng (cách nhau bởi dấu phẩy):</label><br>
            <textarea id="websites" rows="3" style="width: 100%;">${affectedWebsites.join(',')}</textarea><br><br>
            <button id="saveSettings">Lưu</button>
            <button id="cancelSettings" style="margin-left: 10px;">Hủy</button>
        `;

        overlay.appendChild(settingsBox);
        document.body.appendChild(overlay);

        document.getElementById('saveSettings').onclick = () => {
            const newMediaDomains = document.getElementById('mediaDomains').value;
            const newWebsites = document.getElementById('websites').value;

            blockedMediaDomains = newMediaDomains.split(',').map(d => d.trim()).filter(d => d);
            affectedWebsites = newWebsites.split(',').map(d => d.trim()).filter(d => d);

            saveSettings();
            document.body.removeChild(overlay);
            alert('Cài đặt đã được lưu. Hãy reload trang để áp dụng thay đổi.');
        };

        document.getElementById('cancelSettings').onclick = () => {
            document.body.removeChild(overlay);
        };
    }

    GM_registerMenuCommand('⚙ Cài đặt Spoiler', showSettings);

    if (!affectedWebsites.some(site => location.hostname.includes(site))) return;

    function wrapInSpoiler(mediaElement) {
        if (mediaElement.closest('.spoiler-container')) return;

        const spoiler = document.createElement('div');
        spoiler.className = 'spoiler-container';

        const button = document.createElement('button');
        const mediaType = mediaElement.tagName.toLowerCase() === 'video' ? 'video' : 'image';
        button.textContent = `Ẩn (${mediaType})`;
        button.style.cssText = `
            display: block;
            margin: 5px 0;
            font-size: 14px;
            font-weight: bold;
            background-color: #800080;
            color: white;
            padding: 5px 10px;
            border: none;
            border-radius: 3px;
            box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
            cursor: pointer;
        `;

        let isHidden = true;
        button.onclick = () => {
            if (isHidden) {
                mediaElement.style.display = 'block';
            } else {
                mediaElement.style.display = 'none';
            }
            isHidden = !isHidden;
        };

        mediaElement.style.display = 'none';
        mediaElement.removeAttribute('autoplay');
        mediaElement.removeAttribute('muted');

        mediaElement.parentNode.insertBefore(spoiler, mediaElement);
        spoiler.appendChild(button);
        spoiler.appendChild(mediaElement);
    }

    function processMedia() {
        document.querySelectorAll('img.bbImage, video, source').forEach(media => {
            let src = media.src || (media.parentNode.tagName.toLowerCase() === 'video' ? media.parentNode.currentSrc : '');
            // Kiểm tra nếu media nằm trong chữ ký thì không xử lý
            if (media.closest('.message-signature')) return;

            if (src && blockedMediaDomains.some(domain => src.includes(domain))) {
                wrapInSpoiler(media.tagName.toLowerCase() === 'source' ? media.parentNode : media);
            }
        });
    }

    processMedia();

    const observer = new MutationObserver(() => processMedia());
    observer.observe(document.body, { childList: true, subtree: true });
})();


Nút Cài đặt Spoiler ở góc phải hình bánh răng là để tụi bây tự thêm đường dẫn vào ví dụ như *anh.moe*, *anhmoecdn*, *imgur*..... và website sẽ áp dụng như xam.nl xong rồi bấm Lưu lại.
@Thích Vét Máng @Hoàng Tử DiNa ko thích điều này 🤣
 
Nó phiền là ngồi pc

Ở android thì có kiwi browser support extension, thằng nào test xem chứ tao lười
Điện thoại thì sao mày, cái extension kia có dùng được trên đt ko?
Extension Violentmonkey có trên app Firefox của Android.

Tụi bây cài Firefox, vào Tiện ích cài Violentmonkey, rồi thêm cái script như tao post là được.
 
Script này là để chuyển nội dung hình ảnh và videos vào tag Spoiler, nhằm hạn chế nội dung từ mấy thằng mắc dịch đang trong box Điểm báo thì tụi nó post hình và videos porn.

Và cái này là tao nhờ con ChatGPT viết và kết hợp Grok sửa lỗi/tối ưu, có gì tụi bây chửi nó chứ tao ko biết gì đâu.

Script này chạy được trên mobile Android luôn, tụi bây cài Iceraven rồi cài Violentmonkey vào, copy & paste script vào là chạy.


Hướng dẫn sử dụng:
  • Cài đặt extension:
    • Cài Tampermonkey hoặc Violentmonkey trên trình duyệt.
  • Thêm script:
    • Mở extension Tampermonkey/Violentmonkey.
    • Nhấn nút "Create a new script" hoặc biểu tượng "+" để tạo script mới.
    • Copy toàn bộ code trên và paste vào editor.
    • Nhấn Ctrl+S hoặc File > Save để lưu.
  • Kiểm tra hoạt động:
    • Truy cập xamvn.nl.
    • Script sẽ tự động chạy và bọc bất kỳ hình ảnh hoặc video nào từ anh.moe vào tag spoiler.
    • Người dùng sẽ phải nhấn nút "Spoiler" để xem nội dung.


JavaScript:
// ==UserScript==
// @name         XamVN Spoiler Customizable
// @namespace    https://xamvn.nl/
// @version      1.9
// @description  Bọc tất cả ảnh và video từ danh sách domain tuỳ chỉnh vào tag Spoiler trên các website tuỳ chỉnh (XenForo)
// @author       Bạn
// @match        *://*/*
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_registerMenuCommand
// ==/UserScript==

(function() {
    'use strict';

    // Lấy danh sách domain ảnh/video và website từ settings (hoặc mặc định)
    let blockedMediaDomains = GM_getValue('blockedMediaDomains', ['anh.moe', 'cdn.anh.moe', 'imgur.com']);
    let affectedWebsites = GM_getValue('affectedWebsites', ['xamvn.nl']);

    function saveSettings() {
        GM_setValue('blockedMediaDomains', blockedMediaDomains);
        GM_setValue('affectedWebsites', affectedWebsites);
    }

    function showSettings() {
        const overlay = document.createElement('div');
        overlay.style.cssText = `
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.5); z-index: 9999; display: flex;
            justify-content: center; align-items: center;
        `;

        const settingsBox = document.createElement('div');
        settingsBox.style.cssText = `
            background: white; padding: 20px; border-radius: 5px;
            width: 400px; max-width: 90%;
        `;

        settingsBox.innerHTML = `
            <h3>Cài đặt Spoiler</h3>
            <label>Danh sách domain hình/video (cách nhau bởi dấu phẩy):</label><br>
            <textarea id="mediaDomains" rows="3" style="width: 100%;">${blockedMediaDomains.join(',')}</textarea><br><br>
            <label>Danh sách website áp dụng (cách nhau bởi dấu phẩy):</label><br>
            <textarea id="websites" rows="3" style="width: 100%;">${affectedWebsites.join(',')}</textarea><br><br>
            <button id="saveSettings">Lưu</button>
            <button id="cancelSettings" style="margin-left: 10px;">Hủy</button>
        `;

        overlay.appendChild(settingsBox);
        document.body.appendChild(overlay);

        document.getElementById('saveSettings').onclick = () => {
            const newMediaDomains = document.getElementById('mediaDomains').value;
            const newWebsites = document.getElementById('websites').value;

            blockedMediaDomains = newMediaDomains.split(',').map(d => d.trim()).filter(d => d);
            affectedWebsites = newWebsites.split(',').map(d => d.trim()).filter(d => d);

            saveSettings();
            document.body.removeChild(overlay);
            alert('Cài đặt đã được lưu. Hãy reload trang để áp dụng thay đổi.');
        };

        document.getElementById('cancelSettings').onclick = () => {
            document.body.removeChild(overlay);
        };
    }

    GM_registerMenuCommand('⚙ Cài đặt Spoiler', showSettings);

    if (!affectedWebsites.some(site => location.hostname.includes(site))) return;

    function wrapInSpoiler(mediaElement) {
        if (mediaElement.closest('.spoiler-container')) return;

        const spoiler = document.createElement('div');
        spoiler.className = 'spoiler-container';

        const button = document.createElement('button');
        const mediaType = mediaElement.tagName.toLowerCase() === 'video' ? 'video' : 'image';
        button.textContent = `Ẩn (${mediaType})`;
        button.style.cssText = `
            display: block;
            margin: 5px 0;
            font-size: 14px;
            font-weight: bold;
            background-color: #800080;
            color: white;
            padding: 5px 10px;
            border: none;
            border-radius: 3px;
            box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
            cursor: pointer;
        `;

        let isHidden = true;
        button.onclick = (event) => {
            event.preventDefault(); // Ngăn sự kiện mặc định (như phóng lớn ảnh)
            event.stopPropagation(); // Ngăn sự kiện lan truyền lên các phần tử khác
            if (isHidden) {
                mediaElement.style.display = 'block';
                isHidden = false;
            } else {
                mediaElement.style.display = 'none';
                isHidden = true;
            }
        };

        mediaElement.style.display = 'none';
        mediaElement.removeAttribute('autoplay');
        mediaElement.removeAttribute('muted');

        mediaElement.parentNode.insertBefore(spoiler, mediaElement);
        spoiler.appendChild(button);
        spoiler.appendChild(mediaElement);
    }

    function processMedia() {
        document.querySelectorAll('img.bbImage, video, source').forEach(media => {
            let src = media.src || (media.parentNode.tagName.toLowerCase() === 'video' ? media.parentNode.currentSrc : '');
            if (media.closest('.message-signature')) return;
           
            if (src && blockedMediaDomains.some(domain => src.includes(domain))) {
                wrapInSpoiler(media.tagName.toLowerCase() === 'source' ? media.parentNode : media);
            }
        });
    }

    processMedia();

    const observer = new MutationObserver(() => processMedia());
    observer.observe(document.body, { childList: true, subtree: true });
})();


Nút Cài đặt Spoiler ở góc phải hình bánh răng là để tụi bây tự thêm đường dẫn vào ví dụ như *anh.moe*, *anhmoecdn*, *imgur*..... và website sẽ áp dụng như xam.nl xong rồi bấm Lưu lại.
Hình như chạm nhẹ anh @Thích Vét Máng

Script này là để chuyển nội dung hình ảnh và videos vào tag Spoiler, nhằm hạn chế nội dung từ mấy thằng mắc dịch đang trong box Điểm báo thì tụi nó post hình và videos porn.

Và cái này là tao nhờ con ChatGPT viết và kết hợp Grok sửa lỗi/tối ưu, có gì tụi bây chửi nó chứ tao ko biết gì đâu.

Script này chạy được trên mobile Android luôn, tụi bây cài Iceraven rồi cài Violentmonkey vào, copy & paste script vào là chạy.


Hướng dẫn sử dụng:
  • Cài đặt extension:
    • Cài Tampermonkey hoặc Violentmonkey trên trình duyệt.
  • Thêm script:
    • Mở extension Tampermonkey/Violentmonkey.
    • Nhấn nút "Create a new script" hoặc biểu tượng "+" để tạo script mới.
    • Copy toàn bộ code trên và paste vào editor.
    • Nhấn Ctrl+S hoặc File > Save để lưu.
  • Kiểm tra hoạt động:
    • Truy cập xamvn.nl.
    • Script sẽ tự động chạy và bọc bất kỳ hình ảnh hoặc video nào từ anh.moe vào tag spoiler.
    • Người dùng sẽ phải nhấn nút "Spoiler" để xem nội dung.


JavaScript:
// ==UserScript==
// @name         XamVN Spoiler Customizable
// @namespace    https://xamvn.nl/
// @version      1.9
// @description  Bọc tất cả ảnh và video từ danh sách domain tuỳ chỉnh vào tag Spoiler trên các website tuỳ chỉnh (XenForo)
// @author       Bạn
// @match        *://*/*
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_registerMenuCommand
// ==/UserScript==

(function() {
    'use strict';

    // Lấy danh sách domain ảnh/video và website từ settings (hoặc mặc định)
    let blockedMediaDomains = GM_getValue('blockedMediaDomains', ['anh.moe', 'cdn.anh.moe', 'imgur.com']);
    let affectedWebsites = GM_getValue('affectedWebsites', ['xamvn.nl']);

    function saveSettings() {
        GM_setValue('blockedMediaDomains', blockedMediaDomains);
        GM_setValue('affectedWebsites', affectedWebsites);
    }

    function showSettings() {
        const overlay = document.createElement('div');
        overlay.style.cssText = `
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.5); z-index: 9999; display: flex;
            justify-content: center; align-items: center;
        `;

        const settingsBox = document.createElement('div');
        settingsBox.style.cssText = `
            background: white; padding: 20px; border-radius: 5px;
            width: 400px; max-width: 90%;
        `;

        settingsBox.innerHTML = `
            <h3>Cài đặt Spoiler</h3>
            <label>Danh sách domain hình/video (cách nhau bởi dấu phẩy):</label><br>
            <textarea id="mediaDomains" rows="3" style="width: 100%;">${blockedMediaDomains.join(',')}</textarea><br><br>
            <label>Danh sách website áp dụng (cách nhau bởi dấu phẩy):</label><br>
            <textarea id="websites" rows="3" style="width: 100%;">${affectedWebsites.join(',')}</textarea><br><br>
            <button id="saveSettings">Lưu</button>
            <button id="cancelSettings" style="margin-left: 10px;">Hủy</button>
        `;

        overlay.appendChild(settingsBox);
        document.body.appendChild(overlay);

        document.getElementById('saveSettings').onclick = () => {
            const newMediaDomains = document.getElementById('mediaDomains').value;
            const newWebsites = document.getElementById('websites').value;

            blockedMediaDomains = newMediaDomains.split(',').map(d => d.trim()).filter(d => d);
            affectedWebsites = newWebsites.split(',').map(d => d.trim()).filter(d => d);

            saveSettings();
            document.body.removeChild(overlay);
            alert('Cài đặt đã được lưu. Hãy reload trang để áp dụng thay đổi.');
        };

        document.getElementById('cancelSettings').onclick = () => {
            document.body.removeChild(overlay);
        };
    }

    GM_registerMenuCommand('⚙ Cài đặt Spoiler', showSettings);

    if (!affectedWebsites.some(site => location.hostname.includes(site))) return;

    function wrapInSpoiler(mediaElement) {
        if (mediaElement.closest('.spoiler-container')) return;

        const spoiler = document.createElement('div');
        spoiler.className = 'spoiler-container';

        const button = document.createElement('button');
        const mediaType = mediaElement.tagName.toLowerCase() === 'video' ? 'video' : 'image';
        button.textContent = `Ẩn (${mediaType})`;
        button.style.cssText = `
            display: block;
            margin: 5px 0;
            font-size: 14px;
            font-weight: bold;
            background-color: #800080;
            color: white;
            padding: 5px 10px;
            border: none;
            border-radius: 3px;
            box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
            cursor: pointer;
        `;

        let isHidden = true;
        button.onclick = (event) => {
            event.preventDefault(); // Ngăn sự kiện mặc định (như phóng lớn ảnh)
            event.stopPropagation(); // Ngăn sự kiện lan truyền lên các phần tử khác
            if (isHidden) {
                mediaElement.style.display = 'block';
                isHidden = false;
            } else {
                mediaElement.style.display = 'none';
                isHidden = true;
            }
        };

        mediaElement.style.display = 'none';
        mediaElement.removeAttribute('autoplay');
        mediaElement.removeAttribute('muted');

        mediaElement.parentNode.insertBefore(spoiler, mediaElement);
        spoiler.appendChild(button);
        spoiler.appendChild(mediaElement);
    }

    function processMedia() {
        document.querySelectorAll('img.bbImage, video, source').forEach(media => {
            let src = media.src || (media.parentNode.tagName.toLowerCase() === 'video' ? media.parentNode.currentSrc : '');
            if (media.closest('.message-signature')) return;
           
            if (src && blockedMediaDomains.some(domain => src.includes(domain))) {
                wrapInSpoiler(media.tagName.toLowerCase() === 'source' ? media.parentNode : media);
            }
        });
    }

    processMedia();

    const observer = new MutationObserver(() => processMedia());
    observer.observe(document.body, { childList: true, subtree: true });
})();


Nút Cài đặt Spoiler ở góc phải hình bánh răng là để tụi bây tự thêm đường dẫn vào ví dụ như *anh.moe*, *anhmoecdn*, *imgur*..... và website sẽ áp dụng như xam.nl xong rồi bấm Lưu lại.
Hình như chạm nhẹ anh @Thích Vét Máng
 
Script này là để chuyển nội dung hình ảnh và videos vào tag Spoiler, nhằm hạn chế nội dung từ mấy thằng mắc dịch đang trong box Điểm báo thì tụi nó post hình và videos porn.

Và cái này là tao nhờ con ChatGPT viết và kết hợp Grok sửa lỗi/tối ưu, có gì tụi bây chửi nó chứ tao ko biết gì đâu.

Script này chạy được trên mobile Android luôn, tụi bây cài Iceraven rồi cài Violentmonkey vào, copy & paste script vào là chạy.


Hướng dẫn sử dụng:
  • Cài đặt extension:
    • Cài Tampermonkey hoặc Violentmonkey trên trình duyệt.
  • Thêm script:
    • Mở extension Tampermonkey/Violentmonkey.
    • Nhấn nút "Create a new script" hoặc biểu tượng "+" để tạo script mới.
    • Copy toàn bộ code trên và paste vào editor.
    • Nhấn Ctrl+S hoặc File > Save để lưu.
  • Kiểm tra hoạt động:
    • Truy cập xamvn.nl.
    • Script sẽ tự động chạy và bọc bất kỳ hình ảnh hoặc video nào từ anh.moe vào tag spoiler.
    • Người dùng sẽ phải nhấn nút "Spoiler" để xem nội dung.


JavaScript:
// ==UserScript==
// @name         XamVN Spoiler Customizable
// @namespace    https://xamvn.nl/
// @version      1.9
// @description  Bọc tất cả ảnh và video từ danh sách domain tuỳ chỉnh vào tag Spoiler trên các website tuỳ chỉnh (XenForo)
// @author       Bạn
// @match        *://*/*
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_registerMenuCommand
// ==/UserScript==

(function() {
    'use strict';

    // Lấy danh sách domain ảnh/video và website từ settings (hoặc mặc định)
    let blockedMediaDomains = GM_getValue('blockedMediaDomains', ['anh.moe', 'cdn.anh.moe', 'imgur.com']);
    let affectedWebsites = GM_getValue('affectedWebsites', ['xamvn.nl']);

    function saveSettings() {
        GM_setValue('blockedMediaDomains', blockedMediaDomains);
        GM_setValue('affectedWebsites', affectedWebsites);
    }

    function showSettings() {
        const overlay = document.createElement('div');
        overlay.style.cssText = `
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.5); z-index: 9999; display: flex;
            justify-content: center; align-items: center;
        `;

        const settingsBox = document.createElement('div');
        settingsBox.style.cssText = `
            background: white; padding: 20px; border-radius: 5px;
            width: 400px; max-width: 90%;
        `;

        settingsBox.innerHTML = `
            <h3>Cài đặt Spoiler</h3>
            <label>Danh sách domain hình/video (cách nhau bởi dấu phẩy):</label><br>
            <textarea id="mediaDomains" rows="3" style="width: 100%;">${blockedMediaDomains.join(',')}</textarea><br><br>
            <label>Danh sách website áp dụng (cách nhau bởi dấu phẩy):</label><br>
            <textarea id="websites" rows="3" style="width: 100%;">${affectedWebsites.join(',')}</textarea><br><br>
            <button id="saveSettings">Lưu</button>
            <button id="cancelSettings" style="margin-left: 10px;">Hủy</button>
        `;

        overlay.appendChild(settingsBox);
        document.body.appendChild(overlay);

        document.getElementById('saveSettings').onclick = () => {
            const newMediaDomains = document.getElementById('mediaDomains').value;
            const newWebsites = document.getElementById('websites').value;

            blockedMediaDomains = newMediaDomains.split(',').map(d => d.trim()).filter(d => d);
            affectedWebsites = newWebsites.split(',').map(d => d.trim()).filter(d => d);

            saveSettings();
            document.body.removeChild(overlay);
            alert('Cài đặt đã được lưu. Hãy reload trang để áp dụng thay đổi.');
        };

        document.getElementById('cancelSettings').onclick = () => {
            document.body.removeChild(overlay);
        };
    }

    GM_registerMenuCommand('⚙ Cài đặt Spoiler', showSettings);

    if (!affectedWebsites.some(site => location.hostname.includes(site))) return;

    function wrapInSpoiler(mediaElement) {
        if (mediaElement.closest('.spoiler-container')) return;

        const spoiler = document.createElement('div');
        spoiler.className = 'spoiler-container';

        const button = document.createElement('button');
        const mediaType = mediaElement.tagName.toLowerCase() === 'video' ? 'video' : 'image';
        button.textContent = `Ẩn (${mediaType})`;
        button.style.cssText = `
            display: block;
            margin: 5px 0;
            font-size: 14px;
            font-weight: bold;
            background-color: #800080;
            color: white;
            padding: 5px 10px;
            border: none;
            border-radius: 3px;
            box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
            cursor: pointer;
        `;

        let isHidden = true;
        button.onclick = (event) => {
            event.preventDefault(); // Ngăn sự kiện mặc định (như phóng lớn ảnh)
            event.stopPropagation(); // Ngăn sự kiện lan truyền lên các phần tử khác
            if (isHidden) {
                mediaElement.style.display = 'block';
                isHidden = false;
            } else {
                mediaElement.style.display = 'none';
                isHidden = true;
            }
        };

        mediaElement.style.display = 'none';
        mediaElement.removeAttribute('autoplay');
        mediaElement.removeAttribute('muted');

        mediaElement.parentNode.insertBefore(spoiler, mediaElement);
        spoiler.appendChild(button);
        spoiler.appendChild(mediaElement);
    }

    function processMedia() {
        document.querySelectorAll('img.bbImage, video, source').forEach(media => {
            let src = media.src || (media.parentNode.tagName.toLowerCase() === 'video' ? media.parentNode.currentSrc : '');
            if (media.closest('.message-signature')) return;
           
            if (src && blockedMediaDomains.some(domain => src.includes(domain))) {
                wrapInSpoiler(media.tagName.toLowerCase() === 'source' ? media.parentNode : media);
            }
        });
    }

    processMedia();

    const observer = new MutationObserver(() => processMedia());
    observer.observe(document.body, { childList: true, subtree: true });
})();


Nút Cài đặt Spoiler ở góc phải hình bánh răng là để tụi bây tự thêm đường dẫn vào ví dụ như *anh.moe*, *anhmoecdn*, *imgur*..... và website sẽ áp dụng như xam.nl xong rồi bấm Lưu lại.
Hay! Để tao nghiên cứu, lên ủng hộ m !
 

Có thể bạn quan tâm

Top