Job Navigation Script

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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;
        }
    });
})();