Nowpick Aprimorado

Substitui a contagem de candidaturas 999+ por dados reais, adiciona funções de atualização com um clique e convite com um clique

Você precisará instalar uma extensão como Tampermonkey, Greasemonkey ou Violentmonkey para instalar este script.

Você precisará instalar uma extensão como Tampermonkey ou Violentmonkey para instalar este script.

Você precisará instalar uma extensão como Tampermonkey ou Violentmonkey para instalar este script.

Você precisará instalar uma extensão como Tampermonkey ou Userscripts para instalar este script.

Você precisará instalar uma extensão como o Tampermonkey para instalar este script.

Você precisará instalar um gerenciador de scripts de usuário para instalar este script.

(Eu já tenho um gerenciador de scripts de usuário, me deixe instalá-lo!)

Você precisará instalar uma extensão como o Stylus para instalar este estilo.

Você precisará instalar uma extensão como o Stylus para instalar este estilo.

Você precisará instalar uma extensão como o Stylus para instalar este estilo.

Você precisará instalar um gerenciador de estilos de usuário para instalar este estilo.

Você precisará instalar um gerenciador de estilos de usuário para instalar este estilo.

Você precisará instalar um gerenciador de estilos de usuário para instalar este estilo.

(Eu já possuo um gerenciador de estilos de usuário, me deixar fazer a instalação!)

// ==UserScript==
// @name         Nowpick Enhanced
// @description  Replaces 999+ application count with actual data, adds one-click refresh and one-click invitation features
// @name:zh-CN   牛客优聘增强
// @description:zh-CN   替换999+投递数为真实的数字,一键擦亮,一键邀约
// @name:ar          Nowpick المحسّن
// @description:ar    يستبدل عدد التقديمات 999+ بالبيانات الفعلية، ويضيف ميزات التحديث بنقرة واحدة والدعوة بنقرة واحدة
// @name:bg          Nowpick Подобрен
// @description:bg    Заменя броя на кандидатурите 999+ с действителни данни, добавя функции за обновяване с едно кликване и покана с едно кликване
// @name:cs          Nowpick Vylepšený
// @description:cs    Nahrazuje počet žádostí 999+ skutečnými daty, přidává funkce obnovení jedním kliknutím a pozvání jedním kliknutím
// @name:da          Nowpick Forbedret
// @description:da    Erstatter ansøgningstallet 999+ med faktiske data, tilføjer funktioner til opdatering med ét klik og invitation med ét klik
// @name:de          Nowpick Verbessert
// @description:de    Ersetzt die Bewerbungszahl 999+ durch tatsächliche Daten, fügt Funktionen für Ein-Klick-Aktualisierung und Ein-Klick-Einladung hinzu
// @name:el          Nowpick Ενισχυμένο
// @description:el    Αντικαθιστά τον αριθμό αιτήσεων 999+ με πραγματικά δεδομένα, προσθέτει λειτουργίες ανανέωσης με ένα κλικ και πρόσκλησης με ένα κλικ
// @name:eo          Nowpick Plibonigita
// @description:eo    Anstataŭigas la nombron de kandidatiĝoj 999+ per faktaj datumoj, aldonas funkciojn por unuklaka ĝisdatigo kaj unuklaka invito
// @name:es          Nowpick Mejorado
// @description:es    Reemplaza el conteo de solicitudes 999+ con datos reales, agrega funciones de actualización con un clic e invitación con un clic
// @name:fi          Nowpick Parannettu
// @description:fi    Korvaa hakemusten määrän 999+ todellisilla tiedoilla, lisää yhden napsautuksen päivitys- ja kutsutoiminnot
// @name:fr          Nowpick Amélioré
// @description:fr    Remplace le nombre de candidatures 999+ par des données réelles, ajoute des fonctions de rafraîchissement en un clic et d'invitation en un clic
// @name:fr-CA       Nowpick Amélioré
// @description:fr-CA    Remplace le nombre de candidatures 999+ par des données réelles, ajoute des fonctions de rafraîchissement en un clic et d'invitation en un clic
// @name:he          Nowpick משופר
// @description:he    מחליף את מספר הבקשות 999+ בנתונים ממשיים, מוסיף תכונות של רענון בלחיצה אחת והזמנה בלחיצה אחת
// @name:hr          Nowpick Poboljšan
// @description:hr    Zamjenjuje broj prijava 999+ stvarnim podacima, dodaje funkcije osvježavanja jednim klikom i poziva jednim klikom
// @name:hu          Nowpick Továbbfejlesztett
// @description:hu    Lecseréli a 999+ jelentkezési számot tényleges adatokra, hozzáad egykattintásos frissítési és meghívási funkciókat
// @name:id          Nowpick Ditingkatkan
// @description:id    Mengganti jumlah aplikasi 999+ dengan data aktual, menambahkan fitur penyegaran sekali klik dan undangan sekali klik
// @name:it          Nowpick Migliorato
// @description:it    Sostituisce il conteggio delle candidature 999+ con dati reali, aggiunge funzioni di aggiornamento con un clic e invito con un clic
// @name:ja          Nowpick 強化版
// @description:ja    応募数999+を実際のデータに置き換え、ワンクリック更新およびワンクリック招待機能を追加
// @name:ka          Nowpick გაუმჯობესებული
// @description:ka    ცვლის განაცხადების რაოდენობას 999+ ფაქტობრივი მონაცემებით, ამატებს ერთი დაწკაპუნებით განახლებისა და მოწვევის ფუნქციებს
// @name:ko          Nowpick 강화된
// @description:ko    지원 수 999+를 실제 데이터로 대체하고, 원클릭 새로고침 및 원클릭 초대 기능을 추가합니다
// @name:nb          Nowpick Forbedret
// @description:nb    Erstatter søknadstallet 999+ med faktiske data, legger til funksjoner for oppdatering med ett klikk og invitasjon med ett klikk
// @name:nl          Nowpick Verbeterd
// @description:nl    Vervangt het aantal sollicitaties 999+ door actuele gegevens, voegt functies toe voor vernieuwen met één klik en uitnodigen met één klik
// @name:pl          Nowpick Ulepszony
// @description:pl    Zastępuje liczbę aplikacji 999+ rzeczywistymi danymi, dodaje funkcje odświeżania jednym kliknięciem i zapraszania jednym kliknięciem
// @name:pt-BR       Nowpick Aprimorado
// @description:pt-BR    Substitui a contagem de candidaturas 999+ por dados reais, adiciona funções de atualização com um clique e convite com um clique
// @name:ro          Nowpick Îmbunătățit
// @description:ro    Înlocuiește numărul de aplicații 999+ cu date reale, adaugă funcții de reîmprospătare cu un clic și invitație cu un clic
// @name:ru          Nowpick Улучшенный
// @description:ru    Заменяет количество заявок 999+ на фактические данные, добавляет функции обновления одним кликом и приглашения одним кликом
// @name:sk          Nowpick Vylepšený
// @description:sk    Nahrádza počet žiadostí 999+ skutočnými údajmi, pridáva funkcie obnovenia jedným kliknutím a pozvania jedným kliknutím
// @name:sr          Nowpick Побољшан
// @description:sr    Замењује број пријава 999+ стварним подацима, додаје функције освежавања једним кликом и позива једним кликом
// @name:sv          Nowpick Förbättrad
// @description:sv    Ersätter ansökningssiffran 999+ med faktiska data, lägger till funktioner för uppdatering med ett klick och inbjudan med ett klick
// @name:th          Nowpick ปรับปรุง
// @description:th    แทนที่จำนวนการสมัคร 999+ ด้วยข้อมูลจริง เพิ่มฟีเจอร์การรีเฟรชด้วยคลิกเดียวและการเชิญด้วยคลิกเดียว
// @name:tr          Nowpick Geliştirilmiş
// @description:tr    Başvuru sayısını 999+ gerçek verilerle değiştirir, tek tıkla yenileme ve tek tıkla davet özelliklerini ekler
// @name:ug          Nowpick كۈچەيتىلگەن
// @description:ug    ئىلتىماس سانى 999+ نى ھەقىقىي سانلىق مەلۇماتلار بىلەن ئالماشتۇرىدۇ، بىر چەكلىمە ئارقىلىق يېڭىلاش ۋە بىر چەكلىمە ئارقىلىق تەكلىپ قىلىش ئىقتىدارلىرىنى قوشىدۇ
// @name:uk          Nowpick Покращений
// @description:uk    Замінює кількість заявок 999+ фактичними даними, додає функції оновлення одним кліком та запрошення одним кліком
// @name:vi          Nowpick Nâng cao
// @description:vi    Thay thế số lượng đơn đăng ký 999+ bằng dữ liệu thực tế, thêm tính năng làm mới bằng một cú nhấp chuột và mời bằng một cú nhấp chuột
// @name:zh          Nowpick增强
// @description:zh    替换999+投递数为真实的数字,添加一键擦亮和一键邀约功能
// @name:zh-HK       Nowpick增強
// @description:zh-HK    替換999+投遞數為真實的數字,添加一鍵擦亮和一鍵邀約功能
// @name:zh-SG       Nowpick增强
// @description:zh-SG    替换999+投递数为真实的数字,添加一键擦亮和一键邀约功能
// @name:zh-TW       Nowpick增強
// @description:zh-TW    替換999+投遞數為真實的數字,添加一鍵擦亮和一鍵邀約功能
// @namespace    http://tampermonkey.net/
// @version      1.0.6.1
// @author       aspen138
// @match        *://nowpick.nowcoder.com/*
// @grant        GM_xmlhttpRequest
// @grant        GM_addStyle
// @grant        GM_registerMenuCommand
// @require      https://update.greatest.deepsurf.us/scripts/462234/1322684/Message.js
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAG9klEQVR4nO2dTYscRRyHn5rZ2WjWEJVks9ldISp+gQieBFkSRBfxYC7Gl4sBQXMRT36FXPwCYi6GiCAiBtZTdlUiyAbyBcTEgJvsRGFjJNHsvJSHnUlme/5VX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J/qlxzWaIqfzI9qnxHRmhZ+SI9S5r6N+DhJjygihENdQGEGKqBIyfLm4eV/ILZyGmvGK8hnTaejG6tbOtvwoy/BL7ce+NJY7U52jov7me5gWUQDL+B/OqzyTx9k9eAAAAAElFTkSuQmCC
// @license      MIT
// ==/UserScript==


// @iconbackup         https://static.nowcoder.com/fe/common/share-logo.png


// key: "getDeliverNum",
// value: function(t) {
//     if (1 === t.showStatus)
//         return "- -";
//     var e = t.inviteSuccessCnt + t.initiativeDeliverCnt;
//     return e > 999 ? "999+" : e
// }





// Replace 999+ with actual number
(function () {
    'use strict';

    // Function to execute the main functionality
    async function executeMainFunctionality() {
        if (window.location.href === "https://nowpick.nowcoder.com/w/hrconsole/job-manage") {
            window.QMSG_GLOBALS = {
                DEFAULTS: {
                    showClose: true,
                    autoClose: false,
                    timeout: 3600 * 1000 // ms
                }
            };

            const name = "JobUpdater";

            function toast(s, error = false) {
                if (error) {
                    Qmsg.error(`[${name}] ${s}`);
                    console.error(`[${name}] ${s}`);
                } else {
                    Qmsg.success(`[${name}] ${s}`);
                    console.log(`[${name}] ${s}`);
                }
            }

            // Function to show a toast message
            function showToast(message) {
                toast(" " + message, false); // Display
            }

            // Function to escape special characters in CSS selectors
            function escapeCSSSelector(selector) {
                return selector.replace(/([!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~])/g, '\\$1');
            }

            // Function to replace the '999+' value with actual data
            async function replaceValues(jobName, unProcessCount) {
                const jobTitleElements = document.querySelectorAll('.job-title-name');
                const updateTasks = Array.from(jobTitleElements).map(async (el) => {
                    if (el.textContent.trim() === jobName) {
                        const jobInfoParent = el.closest('.job-info').parentElement.parentElement;
                        const unProcessElement = jobInfoParent.querySelector('.tw-font-semibold');
                        if (unProcessElement && unProcessElement.textContent.trim() === '999+') {
                            unProcessElement.textContent = unProcessCount;
                            showToast(`Updated job "${jobName}" with deliverNum: ${unProcessCount}`);
                        }
                    }
                });
                await Promise.all(updateTasks);
            }

            // Function to delay the update (parallelized for faster updates)
            async function delayUpdate(summaryDetailList) {
                await new Promise(resolve => setTimeout(resolve, 0.0001*1000)); // 1 second delay //why we need the delay here???

                const updateTasks = summaryDetailList.map(async (job) => {
                    const deliverNum = job.unProcessCount + job.successCount + job.failCount + job.unDetermined + job.writtenInterviewCount;
                    await replaceValues(job.jobName, deliverNum);
                });

                await Promise.all(updateTasks);
            }

            // Function to fetch data and initiate update (parallelized)
            async function fetchDataAndInitiateUpdate() {
                try {
                    const response = await fetch("https://nowpick.nowcoder.com/h/resume-deliver/summary");
                    if (response.ok) {
                        const jsonResponse = await response.json();
                        if (jsonResponse.data && jsonResponse.data.summaryDetailList) {
                            const summaryDetailList = jsonResponse.data.summaryDetailList;
                            await delayUpdate(summaryDetailList);
                        } else {
                            showToast("Unexpected response format");
                        }
                    } else {
                        showToast("Error: " + response.statusText);
                    }
                } catch (e) {
                    showToast("Request failed: " + e.message);
                }
            }

            // Execute only if we are on the specific URL
            await fetchDataAndInitiateUpdate();
        }
    }

    // Execute the main functionality on page load
    executeMainFunctionality();

    // Listen for hash change or pop state to detect URL changes
    window.addEventListener('hashchange', executeMainFunctionality);
    window.addEventListener('popstate', executeMainFunctionality);

    // Use a MutationObserver to detect URL changes if the page uses JavaScript-based navigation
    const observer = new MutationObserver(() => {
        executeMainFunctionality();
    });

    observer.observe(document, { childList: true, subtree: true });
})();






// OLD 一键擦亮 (DISABLED - replaced with auto version below)
/*
(function() {
    'use strict';

    // Function to click buttons sequentially with delay
    function clickAllPolishButtons() {
        const buttons = Array.from(document.querySelectorAll('button[data-v-55eaa2d2] span'))
            .filter(span => span.textContent.trim() === '一键擦亮')
            .map(span => span.closest('button'))
            .filter(button => !button.classList.contains('is-clicked')); // Exclude already clicked buttons

        function clickNextButton(index) {
            if (index < buttons.length) {
                const button = buttons[index];
                button.click();
                button.classList.add('is-clicked'); // Mark as clicked
                setTimeout(() => clickNextButton(index + 1), 100); // 0.1s delay
            }
        }

        if (buttons.length > 0) {
            clickNextButton(0); // Start clicking only if there are unclicked buttons
        }
    }

    // Add click event listener to trigger the sequence only once
    document.addEventListener('click', function(event) {
        const target = event.target.closest('button[data-v-55eaa2d2]');
        if (target && target.querySelector('span')?.textContent.trim() === '一键擦亮' && !target.classList.contains('is-clicked')) {
            target.classList.add('is-clicked'); // Mark the clicked button immediately
            // Trigger the sequence for remaining unclicked buttons
            setTimeout(clickAllPolishButtons, 100); // Start after a short delay to allow the first click
        }
    }, { once: true }); // Ensure the listener runs only once to prevent multiple triggers
})();
*/

//一键擦亮 - Auto Click All Polish Buttons (NEW VERSION) - Daily Limit
(function() {
    'use strict';

    let autoClickExecuted = false;
    let processedButtons = new Set(); // Track processed buttons by their position

    // Check if the functionality has already been executed today
    function hasExecutedToday() {
        const today = new Date().toDateString();
        const lastExecuted = localStorage.getItem('polishButtonsLastExecuted');
        return lastExecuted === today;
    }

    // Mark today's execution
    function markExecutedToday() {
        const today = new Date().toDateString();
        localStorage.setItem('polishButtonsLastExecuted', today);
    }

    // Function to find all "一键擦亮" buttons using multiple selectors
    function findPolishButtons() {
        const buttons = [];

        // Method 1: Find by span text content
        const spanButtons = Array.from(document.querySelectorAll('span'))
            .filter(span => span.textContent.trim() === '一键擦亮')
            .map(span => span.closest('button'))
            .filter(button => button && !processedButtons.has(button));

        // Method 2: Find by button with specific classes and span containing "一键擦亮"
        const classButtons = Array.from(document.querySelectorAll('button.el-button'))
            .filter(button => {
                const span = button.querySelector('span');
                return span && span.textContent.trim() === '一键擦亮' && !processedButtons.has(button);
            });

        // Method 3: Find by data-v attribute and span content
        const dataButtons = Array.from(document.querySelectorAll('button[data-v-55eaa2d2]'))
            .filter(button => {
                const span = button.querySelector('span');
                return span && span.textContent.trim() === '一键擦亮' && !processedButtons.has(button);
            });

        // Combine all methods and remove duplicates
        const allButtons = [...new Set([...spanButtons, ...classButtons, ...dataButtons])];

        return allButtons.filter(button => button !== null);
    }

    // Function to click buttons sequentially with delay
    function clickAllPolishButtons() {
        // Check daily limit first
        if (hasExecutedToday()) {
            console.log('[一键擦亮] Already executed today, skipping...');
            return;
        }

        const buttons = findPolishButtons();

        if (buttons.length === 0) {
            console.log('[一键擦亮] No new "一键擦亮" buttons found to click');
            return;
        }

        console.log(`[一键擦亮] Found ${buttons.length} "一键擦亮" buttons to click`);

        // Mark as executed for today before starting
        markExecutedToday();

        function clickNextButton(index) {
            if (index < buttons.length) {
                const button = buttons[index];
                try {
                    // Mark button as processed to prevent re-clicking
                    processedButtons.add(button);
                    button.click();
                    console.log(`[一键擦亮] Clicked button ${index + 1}/${buttons.length}`);
                } catch (error) {
                    console.error(`[一键擦亮] Error clicking button ${index + 1}:`, error);
                }

                // Continue with next button after delay
                setTimeout(() => clickNextButton(index + 1), 300); // 0.3s delay for stability
            } else {
                console.log('[一键擦亮] All buttons clicked successfully - Daily limit reached');
            }
        }

        // Start clicking sequence
        clickNextButton(0);
    }

    // Function to automatically detect and click buttons
    function autoDetectAndClick() {
        // Check daily limit before even trying
        if (hasExecutedToday()) {
            console.log('[一键擦亮] Auto-click already executed today, skipping initialization');
            return;
        }

        setTimeout(() => {
            clickAllPolishButtons();
        }, 2000); // 2 second delay
    }

    // Execute on page load
    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', autoDetectAndClick);
    } else {
        autoDetectAndClick();
    }

    // Monitor for dynamic content changes
    let observerTimeout = null;
    const observer = new MutationObserver((mutations) => {
        // Skip if already executed today
        if (hasExecutedToday()) {
            return;
        }

        clearTimeout(observerTimeout);
        observerTimeout = setTimeout(() => {
            const newButtons = findPolishButtons();
            if (newButtons.length > 0) {
                console.log('[一键擦亮] New buttons detected, starting auto-click');
                clickAllPolishButtons();
            }
        }, 1000);
    });

    // Start observing for changes
    if (document.body) {
        observer.observe(document.body, {
            childList: true,
            subtree: true
        });
    }

    // Manual trigger for debugging
    window.triggerPolishButtons = clickAllPolishButtons;

    // Manual function to check daily limit status
    window.checkPolishButtonsStatus = function() {
        const hasExecuted = hasExecutedToday();
        const lastExecuted = localStorage.getItem('polishButtonsLastExecuted');
        console.log(`[一键擦亮] Status: ${hasExecuted ? 'Already executed today' : 'Available for execution'}`);
        console.log(`[一键擦亮] Last executed: ${lastExecuted || 'Never'}`);
        return { hasExecuted, lastExecuted };
    };

    // Manual function to reset daily limit (for testing)
    window.resetPolishButtonsLimit = function() {
        localStorage.removeItem('polishButtonsLastExecuted');
        console.log('[一键擦亮] Daily limit reset');
    };

    const hasExecuted = hasExecutedToday();
    console.log(`[一键擦亮] Auto-click system initialized - Status: ${hasExecuted ? 'Already executed today' : 'Ready for execution'}`);
})();



// 右键菜单里选择"一键邀约" 和 一键擦亮状态
(function() {
    'use strict';

    // Function to click all matching buttons
    function clickAllInviteButtons() {
        const buttons = document.querySelectorAll('button.el-button.invite-wrap.txt-center.fs-14.el-button--primary');
        buttons.forEach(button => {
            button.click();
        });
    }

    // Function to check polish buttons status
    function checkPolishStatus() {
        if (window.checkPolishButtonsStatus) {
            const status = window.checkPolishButtonsStatus();
            alert(`一键擦亮状态:\n${status.hasExecuted ? '今日已执行' : '今日未执行'}\n上次执行: ${status.lastExecuted || '从未执行'}`);
        } else {
            alert('一键擦亮功能未初始化');
        }
    }

    // Function to reset polish buttons limit
    function resetPolishLimit() {
        if (window.resetPolishButtonsLimit) {
            if (confirm('确定要重置一键擦亮的每日限制吗?')) {
                window.resetPolishButtonsLimit();
                alert('一键擦亮每日限制已重置');
            }
        } else {
            alert('一键擦亮功能未初始化');
        }
    }

    // Register context menu items
    GM_registerMenuCommand('一键邀约', clickAllInviteButtons, 'c');
    // Add Ctrl+I keyboard shortcut
    document.addEventListener('keydown', function(event) {
        if (event.ctrlKey && event.key.toLowerCase() === 'i') {
            event.preventDefault(); // Prevent default browser behavior
            clickAllInviteButtons();
        }
    });


    GM_registerMenuCommand('查看一键擦亮状态', checkPolishStatus, 's');
    GM_registerMenuCommand('重置一键擦亮限制', resetPolishLimit, 'r');
})();