Job Navigation Script

Navigate application sites with arrow keys and submit application with Enter key

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Job Navigation Script
// @namespace    http://tampermonkey.net/
// @version      0.5
// @description  Navigate application sites with arrow keys and submit application with Enter key
// @author       Your Name
// @match        *://*.wd1.myworkdayjobs.com/*
// @match        *://*.myworkdayjobs.com/*
// @match        *://*.myworkday.com/*
// @match        *://*.myworkdayjobs.com/*
// @match        *://*.wd1.myworkdayjobs.com/*
// @match        *://*.glassdoor.com/*
// @match        *://*.avature.net/*
// @match        *://*.greenhouse.io/*

// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    document.addEventListener('keydown', function(e) {
        // Check if the focus is on an input field or textarea to avoid interrupting typing
        if (e.target.tagName.toLowerCase() === 'input' || e.target.tagName.toLowerCase() === 'textarea') {
            return;
        }

        switch(e.key) {
            case 'ArrowRight':
                // Attempt to click a next button, if present
                var nextButton = document.querySelector(
                    'button[data-automation-id="bottom-navigation-next-button"], ' +
                    'button[data-automation-id="pageFooterNextButton"], ' +
                    '.next'
                );
                if (nextButton) {
                    nextButton.click();
                }
                break;
            case 'ArrowLeft':
                // Attempt to click a previous button, if present, or go back in history
                var previousButton = document.querySelector('.previous');
                if (previousButton) {
                    previousButton.click();
                } else {
                    window.history.back();
                }
                break;
            case 'Enter':
                // Attempt to click a submit button with specific class, if present
                var submitButton = document.querySelector('button[type="submit"].btn.btn--pill');
                if (submitButton) {
                    submitButton.click();
                }
                break;
            case '`':
                // Autofill fields with placeholder values that include 'No'
                var inputFields = document.querySelectorAll('input, textarea');
                inputFields.forEach(function(field) {
                    if (field.value.trim() === '' && (field.placeholder.toLowerCase().includes('no'))) {
                        field.value = field.placeholder; // Autofill with placeholder value
                    }
                });
                break;
        }
    });
})();