Skip to content

Commit

Permalink
Add quick search for SATO printers
Browse files Browse the repository at this point in the history
Select correct raw language if found
  • Loading branch information
tresf committed Aug 25, 2021
1 parent 227ebec commit ab945ae
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions sample.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,12 @@ <h3>Raw Printing</h3>
<a href="https://qz.io/wiki/What-is-Raw-Printing" target="new">What is Raw Printing?</a>

<span style="float: right;">
<a href="javascript:findPrinter('Zebra', true);">Zebra</a> |
<a href="javascript:findPrinter('ZDesigner', true);">ZDesigner</a> |
<a href="javascript:findPrinter('Epson', true);">Epson</a> |
<a href="javascript:findPrinter('Citizen', true);">Citizen</a> |
<a href="javascript:findPrinter('Star', true);">Star</a>
<a href="javascript:findPrinter('Zebra', true, 'ZPL');">Zebra</a> |
<a href="javascript:findPrinter('ZDesigner', true, 'ZPL');">ZDesigner</a> |
<a href="javascript:findPrinter('SATO', true, 'SBPL');">SATO</a> |
<a href="javascript:findPrinter('Epson', true, 'ESCPOS');">Epson</a> |
<a href="javascript:findPrinter('Citizen', true, 'ESCPOS');">Citizen</a> |
<a href="javascript:findPrinter('Star', true, 'ESCPOS');">Star</a>
</span>
</div>
</div>
Expand Down Expand Up @@ -1479,11 +1480,18 @@ <h4 class="panel-title">Options</h4>
}

/// Detection ///
function findPrinter(query, set) {
function findPrinter(query, set, radio) {
$("#printerSearch").val(query);
qz.printers.find(query).then(function(data) {
displayMessage("<strong>Found:</strong> " + data);
if (set) { setPrinter(data); }
if(radio) {
var input = document.querySelector("input[value='" + radio + "']");
if(input) {
input.checked = true;
$(input.parentElement).fadeOut(300).fadeIn(500);
}
}
}).catch(displayError);
}

Expand Down

0 comments on commit ab945ae

Please sign in to comment.