Minor fixes
This commit is contained in:
parent
a2d86aed96
commit
06ce1a4c13
@ -8,6 +8,10 @@ Printer emulator for zpl rendering engine. The emulator is based on the [labelar
|
||||
|
||||
## Release notes
|
||||
|
||||
### Version 1.4.1
|
||||
|
||||
* **Fix** Minor fixes
|
||||
|
||||
### Version 1.4
|
||||
|
||||
* **New** Ability to save labels as image (PNG) or as PDF. (Thanks to [Derek Preston](https://plus.google.com/116997222122087717848/posts))
|
||||
|
||||
@ -21,8 +21,7 @@ chrome.runtime.onInstalled.addListener(function (details) {
|
||||
port: '9100',
|
||||
saveLabels: false,
|
||||
filetype: '1',
|
||||
path: null,
|
||||
counter: 0
|
||||
path: null
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -71,12 +71,18 @@ function getSize(width, height) {
|
||||
}
|
||||
|
||||
function saveLabel(blob, ext) {
|
||||
chrome.fileSystem.getWritableEntry(pathEntry, function (entry) {
|
||||
var fileName = 'LBL' + pad(configs['counter']++, 6) + '.' + ext;
|
||||
entry.getFile(fileName, { create: true }, function (entry) {
|
||||
entry.createWriter(function (writer) {
|
||||
writer.write(blob);
|
||||
notify('Label <b>{0}</b> saved in folder <b>{1}</b>'.format(fileName, $('#txt-path').val()), 'floppy-saved', 'info', 1000);
|
||||
chrome.storage.local.get('counter', function (items) {
|
||||
chrome.fileSystem.getWritableEntry(pathEntry, function (entry) {
|
||||
var counter = parseInt(items.counter);
|
||||
var fileName = 'LBL' + pad(counter, 6) + '.' + ext;
|
||||
chrome.storage.local.set({ 'counter': ++counter }, function () {
|
||||
entry.getFile(fileName, { create: true }, function (entry) {
|
||||
entry.createWriter(function (writer) {
|
||||
writer.write(blob);
|
||||
notify('Label <b>{0}</b> saved in folder <b>{1}</b>'.format(fileName, $('#txt-path').val()), 'floppy-saved', 'info', 1000);
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -239,7 +245,7 @@ function initEvents() {
|
||||
}, function (entry) {
|
||||
if (chrome.runtime.lastError) {
|
||||
console.info(chrome.runtime.lastError.message);
|
||||
} else {
|
||||
} else {
|
||||
initPath(entry);
|
||||
pathEntry = entry;
|
||||
retainEntry = chrome.fileSystem.retainEntry(entry);
|
||||
@ -296,12 +302,16 @@ function initConfigs() {
|
||||
initDropDown('filetype', configs[key]);
|
||||
} else if (key == 'saveLabels') {
|
||||
$('#ckb-saveLabels').prop('checked', configs[key]);
|
||||
var disabled = !configs[key];
|
||||
$('#btn-filetype').prop('disabled', disabled);
|
||||
$('#btn-path').prop('disabled', disabled);
|
||||
$('#txt-path').prop('disabled', disabled);
|
||||
} else if (key == 'isOn' && configs[key]) {
|
||||
toggleSwitch('.btn-toggle');
|
||||
startTcpServer();
|
||||
} else if (key == 'path' && configs[key]) {
|
||||
retainEntry = configs[key];
|
||||
chrome.fileSystem.restoreEntry(configs[key], function(entry){
|
||||
chrome.fileSystem.restoreEntry(configs[key], function (entry) {
|
||||
pathEntry = entry;
|
||||
initPath(entry);
|
||||
});
|
||||
|
||||
@ -156,7 +156,6 @@
|
||||
<div class="input-group" style="padding-right: 10px;">
|
||||
<span class="input-group-addon">Path</span>
|
||||
<input id="txt-path" name="path" class="form-control" type="text" required disabled>
|
||||
<input id="counter" name="counter" type="hidden" />
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"manifest_version": 2,
|
||||
"name": "Zpl Printer",
|
||||
"short_name": "Zpl Printer",
|
||||
"version": "1.4",
|
||||
"version": "1.4.1",
|
||||
"description": "Printer emulator for zpl rendering engine.",
|
||||
"author": "Simon Binkert",
|
||||
"app": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user