Greasy Fork

Greasy Fork is available in English.

LinkedIn Job Filter Pro

Advanced filters to toggle promoted, normal, and viewed job listings on LinkedIn job search pages.

当前为 2025-03-27 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         LinkedIn Job Filter Pro
// @namespace    http://tampermonkey.net/
// @version      2.5
// @description  Advanced filters to toggle promoted, normal, and viewed job listings on LinkedIn job search pages.
// @author       yange.xyz
// @match        https://www.linkedin.com/jobs/search/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    const FILTERS = {
        SHOW_ALL: 'SHOW_ALL',
        SHOW_PROMOTED: 'SHOW_PROMOTED',
        SHOW_NORMAL: 'SHOW_NORMAL'
    };

    let activeFilter = FILTERS.SHOW_ALL;
    let onlyUnviewed = false;

    // Inject floating filter panel
    const filterPanel = document.createElement('div');
    filterPanel.style.position = 'fixed';
    filterPanel.style.top = '20px';
    filterPanel.style.right = '20px';
    filterPanel.style.zIndex = '10000';
    filterPanel.style.background = 'white';
    filterPanel.style.padding = '12px';
    filterPanel.style.border = '1px solid #ccc';
    filterPanel.style.borderRadius = '10px';
    filterPanel.style.boxShadow = '0 2px 10px rgba(0,0,0,0.2)';
    filterPanel.style.fontFamily = 'Arial, sans-serif';
    filterPanel.style.display = 'flex';
    filterPanel.style.flexDirection = 'column';
    filterPanel.style.gap = '6px';
    document.body.appendChild(filterPanel);

    function createButton(label, onClick, isToggle = false) {
        const btn = document.createElement('button');
        btn.innerText = label;
        btn.style.padding = '8px 10px';
        btn.style.fontSize = '13px';
        btn.style.cursor = 'pointer';
        btn.style.border = '1px solid #0073b1';
        btn.style.borderRadius = '6px';
        btn.style.background = '#0073b1';
        btn.style.color = 'white';
        btn.style.fontWeight = 'bold';
        btn.style.minWidth = '140px';

        btn.addEventListener('click', () => {
            onClick(btn);
        });

        if (isToggle) {
            btn.setAttribute('data-toggle', 'off');
        }

        return btn;
    }

    // Filter buttons
    filterPanel.appendChild(createButton('👁 Show All', () => {
        activeFilter = FILTERS.SHOW_ALL;
        applyFilter();
    }));

    filterPanel.appendChild(createButton('💼 Promoted Only', () => {
        activeFilter = FILTERS.SHOW_PROMOTED;
        applyFilter();
    }));

    filterPanel.appendChild(createButton('🔍 Normal Only', () => {
        activeFilter = FILTERS.SHOW_NORMAL;
        applyFilter();
    }));

    // Unviewed toggle
    const unviewedBtn = createButton('🕵️ Only Unviewed: OFF', (btn) => {
        onlyUnviewed = !onlyUnviewed;
        btn.innerText = onlyUnviewed ? '🕵️ Only Unviewed: ON' : '🕵️ Only Unviewed: OFF';
        applyFilter();
    }, true);

    filterPanel.appendChild(unviewedBtn);

    // Main filter logic
    function applyFilter() {
        const cards = document.querySelectorAll('li');

        cards.forEach(card => {
            const text = card.innerText.toLowerCase();
            const isPromoted = text.includes('promoted');
            const isViewed = text.includes('viewed');

            let visible = true;

            if (onlyUnviewed && isViewed) {
                visible = false;
            }

            switch (activeFilter) {
                case FILTERS.SHOW_ALL:
                    visible = visible && true;
                    break;
                case FILTERS.SHOW_PROMOTED:
                    visible = visible && isPromoted;
                    break;
                case FILTERS.SHOW_NORMAL:
                    visible = visible && !isPromoted;
                    break;
            }

            card.style.display = visible ? '' : 'none';
        });
    }

    // Mutation observer for dynamic content
    const observer = new MutationObserver(applyFilter);
    observer.observe(document.body, { childList: true, subtree: true });

    applyFilter(); // Initial run
})();