lbtest

test

Dette scriptet burde ikke installeres direkte. Det er et bibliotek for andre script å inkludere med det nye metadirektivet // @require https://update.greasyfork.org/scripts/522876/1515300/lbtest.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

(function() {
    var listPageDocument = document; // 缓存列表页的 `document`
    
    // 保存该 `document` 为一个全局变量
    window.listPageDocument = listPageDocument;
    // 初始化一个局部函数来操作列表页的 DOM
    function operateOnListPage(data) {
        console.log('dqdocument',window.listPageDocument)
        const listItems = document.querySelectorAll('.list-item');
        listItems.forEach(item => {
            if (item.textContent.includes(data.itemName)) {
                item.style.display = 'none';  // 根据数据隐藏对应项
            }
        });
    }

    // 监听来自其他页面的数据传递
    window.addEventListener('message', function(event) {
        if (event.data && event.data.type === 'dataFromDetailPage') {
            console.log('Received data from detail page:', event.data);
            operateOnListPage(event.data);  // 处理列表页的 DOM
        }
    });

    // 监听页面获取焦点时,确保操作的是列表页的 document
    window.addEventListener('focus', function() {
        console.log('List page is focused. Now operating on list page document.');
    });
})();