diff --git a/README.md b/README.md index 37c847a..8e34959 100644 --- a/README.md +++ b/README.md @@ -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)) diff --git a/ZplPrinter/js/background.js b/ZplPrinter/js/background.js index d924f00..b90add3 100644 --- a/ZplPrinter/js/background.js +++ b/ZplPrinter/js/background.js @@ -21,8 +21,7 @@ chrome.runtime.onInstalled.addListener(function (details) { port: '9100', saveLabels: false, filetype: '1', - path: null, - counter: 0 + path: null }); } }); \ No newline at end of file diff --git a/ZplPrinter/js/main.js b/ZplPrinter/js/main.js index d661639..84a68fd 100644 --- a/ZplPrinter/js/main.js +++ b/ZplPrinter/js/main.js @@ -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 {0} saved in folder {1}'.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 {0} saved in folder {1}'.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); }); diff --git a/ZplPrinter/main.html b/ZplPrinter/main.html index 92ca7a3..0fc6515 100644 --- a/ZplPrinter/main.html +++ b/ZplPrinter/main.html @@ -156,7 +156,6 @@
Path -
diff --git a/ZplPrinter/manifest.json b/ZplPrinter/manifest.json index d3e2243..92900dc 100644 --- a/ZplPrinter/manifest.json +++ b/ZplPrinter/manifest.json @@ -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": {