Display priority dates

Display priority dates on visa bulletin page for easy access and alerting when dates are current for filing I-485 application for adjustment of status to permanent resident in the US. This is for EB1, EB2 and EB3 categories.

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Display priority dates
// @namespace    https://navirlabs.com/
// @version      1.1
// @license      MIT
// @description  Display priority dates on visa bulletin page for easy access and alerting when dates are current for filing I-485 application for adjustment of status to permanent resident in the US. This is for EB1, EB2 and EB3 categories.
// @author       Rajesh Kanna
// @match        https://travel.state.gov/content/travel/en/legal/visa-law0/visa-bulletin/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=state.gov
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    const parsys = "div.tsg-rwd-content-page-parsysxxx.parsys";
    const rows = [2,3,4];
    const tables = [4,5];
    let eb = [];

    for (let i = 0; i < tables.length; i++) {
        let status = [];
        for (let j = 0; j < rows.length; j++) {
            const eb = document.querySelector(parsys + " > div:nth-child(" + tables[i] + ") tr:nth-child(" + rows[j] + ") > td:nth-child(4)").innerText;
            status.push(eb);
        }
        eb.push(status);
    }

    let table = document.createElement("table");
    table.border = "1";
    table.cellPadding = 3;
    table.style.borderCollapse = "collapse";
    let thead = document.createElement("thead");
    let tbody = document.createElement("tbody");
    let tr = document.createElement("tr");

    ["Type","EB1", "EB2", "EB3"].forEach(function (item) {
        let th = document.createElement("th");
        th.innerHTML = item;
        tr.appendChild(th);
    });

    thead.appendChild(tr);
    table.appendChild(thead);
    let rowTitles = ["FINAL ACTION DATES", "DATES FOR FILING"]

    for (let i = 0; i < eb.length; i++) {
        tr = document.createElement("tr");
        let td = document.createElement("td");
        td.innerHTML = rowTitles[i];
        tr.appendChild(td);
        for (let j = 0; j < eb[i].length; j++) {
            let td = document.createElement("td");
            td.innerHTML = eb[i][j];
            if (eb[i][j] === "C") {
                td.style.backgroundColor = "green";
            }
            tr.appendChild(td);
        }
        tbody.appendChild(tr);
    }

    table.appendChild(tbody);

    document.querySelector("div.tsg-rwd-page-subheader > h1").after(table);
})();