Skip to content

Commit

Permalink
Create WorkOrderNote_Stripper.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian-Samuel authored Aug 5, 2018
1 parent 481e093 commit b2678ef
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions WorkOrderNote_Stripper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Make sure you wrap the script in a script tag
// Insert this after the <h1 class="receiptTypeTitle"> in the Sales template

document.addEventListener("DOMContentLoaded", function(event) {
let regx1 = /([\s\S]+?\b[ap]m\b)[\s\S]+/ig;
let regx2 = /([\s\S]+#\d{0,})[\s\S]+/ig;
var div = document.querySelectorAll('.line_note');
div.forEach(function(div) {
var content = div.innerHTML;
var search = content.includes("Work order");
if (search === true) {
if (regx1.test(content)) {
new_str = content.replace(regx1, "$1");
} else {
new_str = content.replace(regx2, "$1");
}
div.innerHTML = new_str;
let targetBreak = document.querySelector('.line_note br');
targetBreak.style.cssText="display: none";
}
});

});

0 comments on commit b2678ef

Please sign in to comment.