NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Mir Auto Formatter // @namespace http://tampermonkey.net/ // @version 0.97b // @description Mir Auto Formatter // @author 76561198102993358 // @match https://ondemand.mir3.com/qvc/inquickalert2/?inqa=qvc&indomain=in.mir3.com // @grant none // @copyright 2020, xSh0uTx (https://openuserjs.org/users/xSh0uTx) // @license MIT // @downloadURL https://openuserjs.org/install/xSh0uTx/Mir_Auto_Formatter.user.js // @updateURL https://openuserjs.org/meta/xSh0uTx/Mir_Auto_Formatter.meta.js // ==/UserScript== function copyToClip(str) { function listener(e) { e.clipboardData.setData("text/html", str); e.clipboardData.setData("text/plain", str); e.preventDefault(); } document.addEventListener("copy", listener); document.execCommand("copy"); document.removeEventListener("copy", listener); }; function myFunc() { let tempSched = document.getElementById("recipient_input"); let tempText1 = document.getElementById("myText1"); let tempTitle = document.getElementById("notifTitle") let tempMsg = document.getElementById("notifMessage") if(tempSched.innerHTML == ""){ alert("Please select schedule") return } else{ tempTitle.value = `${tempText1.value} - SD - ${tempSched.childNodes[0].childNodes[1].innerHTML}`; } let tempDrop = document.getElementById("myDrop1"); tempMsg.value = `${document.getElementById("myText2").value} ${(tempText1.value.split('').join(' '))} `; let tempResp = document.getElementsByName("responseOption0")[0]; let tempAlias = document.getElementsByName("initiatorAlias")[0]; tempResp.value="I will respond"; tempAlias.value="Service Desk"; if(!document.getElementById("myDrop1").disabled){ tempMsg.focus(); document.getElementById("notifMessage").value += ` Bridge ${tempDrop.options[tempDrop.selectedIndex].value} has been opened for this matter: https://hsni.webex.com/meet/${tempDrop.options[tempDrop.selectedIndex].value}`; tempMsg.focus(); } tempTitle.focus(); $("#notifTitle").trigger("change"); tempMsg.focus(); $("#notifMessage").trigger("change"); tempResp.focus(); $('#responseOption0').change(); tempAlias.focus(); $('input[name="initiatorAlias"]').change(); notifDetail.verbiage.text = tempMsg.value; } function myFunc2() { if(document.getElementById("myDrop1").disabled){ document.getElementById("myDrop1").disabled=false; } else{ document.getElementById("myDrop1").disabled=true; } } function copyTeams(){ let tempSched = document.getElementById("recipient_input"); let tempDrop = document.getElementById("myDrop1"); if(tempSched.innerHTML == ""){ alert("Please select schedule") return } else{ let tempText1 = document.getElementById("myText1"); let tempCopy = `<strong>P2 - ${tempText1.value} -</strong> ${document.getElementById("myText2").value}<br><strong>${tempSched.childNodes[0].childNodes[1].innerHTML}</strong> has been paged`; if(!(document.getElementById("myDrop1").disabled)){ tempCopy = `<strong><a href="https://hsni.webex.com/meet/${tempDrop.options[tempDrop.selectedIndex].value}">${tempDrop.options[tempDrop.selectedIndex].value}</a> - </strong>${tempCopy}`; } copyToClip(tempCopy) } } document.getElementsByClassName("tab")[1].innerHTML = "<span>Auto Formatter</span>"; //var col = document.getElementById("column").innerHTML; document.getElementById("mbox_18").innerHTML = ` <textarea id="myText1" rows="1" style="width: 190px; margin: 0px; height: 15px; margin-top: 6px;" maxlength="20" placeholder="Ticket Number"></textarea> <textarea id="myText2" rows="1" style="width: 190px; margin: 0px; height: 60px; margin-top: 6px;" maxlength="200" placeholder="Ticket Short Description"></textarea> <input type="checkbox" id="myCheck1" ><select id="myDrop1" style="width: 80px; margin: 4px; height: 20px; margin-top: 6px;" disabled> <option value="ALPHA">ALPHA</option> <option value="BRAVO">BRAVO</option> <option value="CHARLIE">CHARLIE</option> <option value="DELTA">DELTA</option> <option value="ECHO">ECHO</option> <option value="FOXTROT">FOXTROT</option> <option value="GOLF">GOLF</option> <option value="HOTEL">HOTEL</option> <option value="INDIA">INDIA</option> <option value="JULIET">JULIET</option> <option value="KILO">KILO</option> <option value="LIMA">LIMA</option> <option value="MIKE">MIKE</option> <option value="NOVEMBER">NOVEMBER</option> <option value="OSCAR">OSCAR</option> <option value="PAPA">PAPA</option> <option value="QUEBEC">QUEBEC</option> <option value="ROMEO">ROMEO</option> <option value="SIERRA">SIERRA</option> <option value="TANGO">TANGO</option> <option value="UNIFORM">UNIFORM</option> <option value="VICTOR">VICTOR</option> <option value="WHISKEY">WHISKEY</option> <option value="XRAY">XRAY</option> <option value="YANKEE">YANKEE</option> <option value="ZULU">ZULU</option> </select> <button id="myButton1" type="button" style="width: 70px; margin: 8px; height: 20px; margin-left: 5px;"> Fill </button> <input type="text" id="myText3" value="" class="field left" placeholder="Ticket Assignment Group" style="margin-top: 25px;margin-left: 24px;" readonly> <button id="myButton2" type="button" style="margin-left: 26px; height: 22px;margin-top: 30px;"> Copy Teams Message </button> `; document.getElementById("myButton1").addEventListener ("click", myFunc , false); document.getElementById("myCheck1").addEventListener ("change", myFunc2 , false); document.getElementById("myButton2").addEventListener ("click", copyTeams , false); if(window.opener != null){ window.addEventListener("message", function(message){ if(message.origin == "https://qvcprod.service-now.com"){ $('#myText1')[0].value = message.data[0]; $('#myText2')[0].value = message.data[1]; $('#myText3')[0].value = message.data[2]; } }); setTimeout(function(){ window.opener.postMessage('rdy', "https://qvcprod.service-now.com") }, 500); }