Created
February 10, 2020 16:09
-
-
Save rtucker-mozilla/adefbacbf0849e6727075de6f2694cc0 to your computer and use it in GitHub Desktop.
greasemonkey script to make it easier to fill in HP Warranty Serial Numbers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Check HP Warranty Data | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
//configure script include to run at https://support.hpe.com/hpsc/wc/public/find | |
var x = document.createElement("TEXTAREA"); | |
var b = document.createElement("BUTTON"); | |
b.innerHTML = "Fill fields"; | |
x.rows = 20; | |
x.cols = 100; | |
b.addEventListener ("click", function(e){ | |
var data = x.value; | |
var dataList = data.split("\n"); | |
var counter = 0; | |
var maxCounter = 20; | |
dataList.forEach(function(e){ | |
if(counter == maxCounter){ | |
alert("Exceeded Maximum Inputs. Next serial to paste is: " + e); | |
counter++ | |
} else { | |
var idString = "serialNumber" + counter; | |
document.getElementById(idString).value = e; | |
counter++; | |
} | |
}); | |
}); | |
document.body.appendChild(x); | |
document.body.appendChild(b); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment