wastereduction / Whitehouse Petitions Auto-fill

// ==UserScript==
// @name         Whitehouse Petitions Auto-fill
// @namespace    https://openuserjs.org/users/wastereduction
// @version      0.1
// @description  Auto filling information for Whitehouse Petitions
// @author       wastereduction
// @match        https://petitions.whitehouse.gov/petition/*
// @grant        GM_getValue
// @grant        GM_setValue
// @require      https://code.jquery.com/jquery-2.1.4.min.js
// @require      https://userscripts-mirror.org/scripts/source/107941.user.js
// @copyright 2019, wastereduction (https://openuserjs.org/users/wastereduction)
// @license MIT
// ==/UserScript==

(function () {
  'use strict';

  ['first-name', 'last-name', 'email'].forEach(function (idx, key) {
    var value = GM_SuperValue.get(idx, null);
    while (value == null || value == idx) {
      value = prompt(`Please enter your ${idx}`, idx);
    }

    GM_SuperValue.set(idx, value);
    $(`input#edit-${idx}`).val(value);
  });
})();