// ==UserScript== // @name Email Button // @version 1 // @grant none // ==/UserScript== // To be used in conjunction with Dr. Robertson's "email to Patient Eform" window.addEventListener("load", function() { var demoStr = /demographic_no=(\d*)[&$]/g; var demoNo = demoStr.exec(document.URL); var apptStr = /appointment=(\d*)[&$]/g; var apptNo = apptStr.exec(document.URL); var emailButton = document.createElement("input"); emailButton.type = "button"; emailButton.value = "Email"; emailButton.id = "EmailButton"; emailButton.name = "EmailButton"; emailButton.onclick = function(){ // EDIT FID below for Dr. Robertson's "email to Patient Eform" id in your EMR var theEmailForm ="../eform/efmformadd_data.jsp?fid=180"; theEmailForm+="&demographic_no="+demoNo; theEmailForm+="&appointment"+apptNo; window.open(theEmailForm); } // This is where the buttons are going on the webpage var destination = document.getElementById("appt_table"); destination.appendChild(emailButton); }, false);