forked from Tiny-Giant/myuserscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArcticCatInvoicePrintFix.user.js
40 lines (38 loc) · 1.17 KB
/
ArcticCatInvoicePrintFix.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// ==UserScript==
// @name Arctic Cat Invoice Print Fix
// @namespace http://github.com/Tiny-Giant
// @version 1.0.0.2
// @description Fixes Arctic Cat invoice printing
// @author @TinyGiant
// @match https://cattrackeronline.arcticcatinc.com/DP_Old_NWD/app/displayInvoice.do*
// @match https://cattrackeronline.arcticcatinc.com/DP_Old_NWD/app/loadElectronicInvoicing.do
// @grant none
// @run-at document-idle
// ==/UserScript==
if(/displayInvoice/.test(window.location.href)) {
document.body.insertAdjacentHTML('afterbegin', `
<form id="print">
<button type="submit">Print</button>
</form>
<style type="text/css">
@media print {
#print {
display: none;
}
}
</style>
`);
const form = document.getElementById('print')
form.addEventListener('submit', e => {
e.preventDefault()
window.print()
}, false)
} else {
document.head.insertAdjacentHTML('beforeend', `
<style type="text/css">
.icon-print {
display: none;
}
</style>
`)
}