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