-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
62 lines (41 loc) · 1.75 KB
/
index.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
function checkBorde(){
document.getElementById("esconder-borde-impresion").hidden = (!document.getElementById("impresion-doble-cara").checked);
}
function rehacerComando(){
// Limpiamos el comando
document.getElementById("comando-consola").innerText = "";
document.getElementById("confirmacion-copiado").hidden = true;
document.getElementById("display-comando").hidden = false;
document.getElementById("copy-button").hidden = false;
let nombreArchivoPDF = document.getElementById("nombre-archivo-pdf").value;
let nuevoComando = "";
const nombreArchivoPS = document.getElementById("nombre-archivo-ps").value;
nuevoComando += `pdf2ps ${nombreArchivoPDF} ${nombreArchivoPS} && `;
// Volvemos a buscar los nombres
if(document.getElementById("impresion-doble-cara").checked) {
nuevoComando += "duplex "
if (document.getElementById("borde-impresion").value === 'corto') {
nuevoComando += "-l "
}
nuevoComando += `${nombreArchivoPS}|lpr`;
if (document.getElementById("lugar-impresion").value === "salita") {
nuevoComando += " -P hp-335"
}
}
else {
nuevoComando += "lpr ";
if (document.getElementById("lugar-impresion").value === "salita"){
nuevoComando += "-P hp-335 ";
}
nuevoComando += `${nombreArchivoPS}`;
}
document.getElementById("comando-consola").innerText = nuevoComando;
}
function copyToClipboard() {
// Get the text field
let copyText = document.getElementById("comando-consola");
// Copy the text inside the text field
navigator.clipboard.writeText(copyText.innerText);
// Alert the copied text
document.getElementById("confirmacion-copiado").hidden = false;
}