Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name [my & egov].uscis.gov - status changes
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description quickly check USCIS case tracker for updates
- // @author a VJ user
- // @match https://egov.uscis.gov/casestatus/displayLogon.do
- // @match https://egov.uscis.gov/casestatus/logon.do
- // @match https://egov.uscis.gov/casestatus/portfolioCustomerRetrieve.do
- // @match https://my.uscis.gov/account/applicant
- // @grant none
- // ==/UserScript==
- window._settings = {
- // user & pass can be left blank - write
- // them and press submit button manually
- username: "john_doe_88",
- password: "secret123",
- // exactly as they appear in the egov.uscis.gov column "LAST UPDATED (MM/DD/YYYY)"
- egov_dates: "04/20/2018;04/20/2018;05/22/2018",
- // as they appear on my.uscis.gov
- my_statuses: [
- "May 25, 2018",
- "We reviewed your biometrics and are still processing your case",
- "April 20, 2018",
- "We received your case",
- "May 25, 2018",
- "We reviewed your biometrics and are still processing your case"
- ]
- }
- function show_my_uscis_stuff () {
- $("h3.inline-block").not(":nth(0)").click();
- var $dates = $("p.panel-pre-title");
- var $titles = $("h2.panel-title");
- var announcement = false;
- for (var i = 0; i < _settings.my_statuses.length / 2; i++) {
- var date = _settings.my_statuses[i * 2];
- var title = _settings.my_statuses[i * 2 + 1];
- var currDate = $dates.eq(i).text();
- var currTitle = $titles.eq(i).text();
- currStatuses[i * 2] = currDate;
- currStatuses[i * 2 + 1] = currTitle;
- if (date.trim().toLowerCase() != currDate.trim().toLowerCase() ||
- title.trim().toLowerCase() != currTitle.trim().toLowerCase()) {
- announcement = "⚠️⚠️⚠️ UPDATED ⚠️⚠️⚠️<br><br>" + currDate + "<br>" + currTitle;
- }
- }
- var theCss = {
- "color": "red",
- "fontFamily": "impact",
- "fontSize": "4em",
- "lineHeight": "1em"
- };
- if (!announcement) {
- announcement = "Nothing changed";
- theCss.color = "green";
- } else {
- var toPrint = "my_statuses: [\n";
- for (var i = 0; i < currStatuses.length; i++) {
- toPrint += '\t"' + currStatuses[i] + '"';
- if (i < currStatuses.length - 1) {
- toPrint += ",";
- if (i % 2 == 1)
- toPrint += "\n";
- }
- toPrint += "\n";
- }
- toPrint += '];';
- console.log(toPrint);
- }
- $(".uscis-card-content.home-banner-container h2")
- .css(theCss)
- .html(announcement);
- }
- function plz_wait () {
- if ($("h2.panel-title").length == 3)
- show_my_uscis_stuff();
- else
- setTimeout(plz_wait, 100);
- }
- (function() {
- var loc = window.location.href
- // egov.uscis.gov login page
- if (!!loc.match(/egov\.uscis.*[lL]ogon.*/)) {
- var $myCases = $(".top-link-right a")
- if ($myCases.length > 0 && !!$myCases.prop("href").match(/\/casestatus\/portfolioCustomerRetrieve\.do/)) {
- $myCases.get(0).click()
- } else if ($("#username, #password, #loginBtn").length == 3) {
- if (_settings.username && _settings.password) {
- $("#username").val(_settings.username)
- $("#password").val(_settings.password)
- $("#loginBtn").click()
- }
- }
- // egov.uscis.gov case list (the SIMPLE one)
- } else if (!!loc.match(/egov\.uscis.*portfolioCustomerRetrieve.*/)) {
- var dates = $("tr td.textalign-center:nth-child(3) nobr").text().trim().replace(/\s+/g, ";");
- console.log(dates);
- var same = (dates == _settings.egov_dates);
- $(".logo-sec").remove();
- $(".rows.text-center h2").css({"color":(same?"green":"red"),"font-family":"impact"})
- .text(same?"Nothing changed":"⚠️ ⚠️ UPDATED ⚠️ ⚠️");
- // my.uscis.gov case list (the longer one)
- } else if (!!loc.match(/my.uscis.gov\/account\/applicant.*/)) {
- window.currStatuses = [];
- plz_wait();
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement