From 0c7476a37c9f90aedbec6967cc4095808bf036bc Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 16 Nov 2022 02:46:44 +0100 Subject: [PATCH] refs #3971 Function keyword removed --- forms/account/conf/index.js | 10 +- forms/admin/items/index.js | 2 +- forms/admin/photos/index.js | 32 +++--- forms/admin/queries/index.js | 10 +- forms/admin/users/index.js | 6 +- forms/admin/visits/index.js | 2 +- forms/agencies/packages/index.js | 2 +- forms/cms/contact/index.js | 8 +- forms/cms/location/index.js | 12 +- forms/ecomerce/catalog/index.js | 46 ++++---- forms/ecomerce/checkout/index.js | 48 ++++---- forms/ecomerce/confirm/index.js | 18 +-- forms/ecomerce/invoices/index.js | 2 +- forms/ecomerce/orders/index.js | 14 +-- forms/ecomerce/ticket/index.js | 14 +-- forms/news/new/index.js | 18 +-- forms/news/news/index.js | 10 +- forms/reports/items-form/items-form.js | 4 +- forms/reports/shelves/shelves.js | 6 +- js/db/connection.js | 10 +- js/db/db-lot.js | 30 ++--- js/db/form.js | 18 +-- js/db/iterator.js | 22 ++-- js/db/model.js | 140 +++++++++++------------ js/db/query.js | 26 ++--- js/db/result-set.js | 16 +-- js/db/result.js | 10 +- js/db/simple-iterator.js | 14 +-- js/hedera/app.js | 44 +++---- js/hedera/basket-checker.js | 4 +- js/hedera/form.js | 16 +-- js/hedera/gui.js | 74 ++++++------ js/hedera/login.js | 24 ++-- js/hedera/module.js | 14 +-- js/hedera/report.js | 14 +-- js/hedera/social-bar.js | 14 +-- js/hedera/tpv.js | 14 +-- js/htk/assistant-bar/index.js | 22 ++-- js/htk/assistant/index.js | 28 ++--- js/htk/button/index.js | 16 +-- js/htk/calendar/index.js | 26 ++--- js/htk/check/index.js | 8 +- js/htk/column/index.js | 14 +-- js/htk/columns/button/index.js | 10 +- js/htk/columns/check/index.js | 6 +- js/htk/columns/date/index.js | 8 +- js/htk/columns/image/index.js | 4 +- js/htk/columns/link/index.js | 2 +- js/htk/columns/radio/index.js | 8 +- js/htk/columns/spin/index.js | 8 +- js/htk/columns/text/index.js | 10 +- js/htk/date-chooser/index.js | 10 +- js/htk/dialog/index.js | 16 +-- js/htk/entry/index.js | 20 ++-- js/htk/field/index.js | 44 +++---- js/htk/full-image/index.js | 12 +- js/htk/grid/index.js | 56 ++++----- js/htk/html/index.js | 4 +- js/htk/icon/index.js | 16 +-- js/htk/image-editor/index.js | 10 +- js/htk/image/index.js | 40 +++---- js/htk/label/index.js | 8 +- js/htk/loader/index.js | 14 +-- js/htk/popup/index.js | 36 +++--- js/htk/radio/index.js | 24 ++-- js/htk/radio/radio-group.js | 10 +- js/htk/repeater/index.js | 46 ++++---- js/htk/search-entry/index.js | 8 +- js/htk/select/index.js | 44 +++---- js/htk/spin/index.js | 8 +- js/htk/spinner/index.js | 6 +- js/htk/step/index.js | 10 +- js/htk/table/index.js | 14 +-- js/htk/text-area/index.js | 8 +- js/htk/text/index.js | 8 +- js/htk/toast/index.js | 24 ++-- js/sql/delete.js | 2 +- js/sql/dml.js | 6 +- js/sql/field.js | 2 +- js/sql/filter-item.js | 6 +- js/sql/filter.js | 4 +- js/sql/function.js | 6 +- js/sql/holder.js | 2 +- js/sql/insert.js | 2 +- js/sql/join-item.js | 2 +- js/sql/join.js | 6 +- js/sql/list-holder.js | 8 +- js/sql/list.js | 16 +-- js/sql/multi-stmt.js | 6 +- js/sql/object.js | 16 +-- js/sql/operation.js | 6 +- js/sql/select.js | 4 +- js/sql/stmt.js | 6 +- js/sql/string.js | 6 +- js/sql/table.js | 2 +- js/sql/update.js | 2 +- js/sql/value.js | 34 +++--- js/vn/browser.js | 12 +- js/vn/builder.js | 18 +-- js/vn/compiler-element.js | 6 +- js/vn/compiler-object.js | 12 +- js/vn/compiler-text.js | 4 +- js/vn/compiler.js | 30 ++--- js/vn/component.js | 46 ++++---- js/vn/date.js | 6 +- js/vn/form.js | 14 +-- js/vn/hash.js | 24 ++-- js/vn/ie.js | 12 +- js/vn/iterator-iface.js | 8 +- js/vn/iterator.js | 18 +-- js/vn/json-connection.js | 38 +++--- js/vn/json-exception.js | 2 +- js/vn/locale.js | 14 +-- js/vn/lot-iface.js | 14 +-- js/vn/lot-query.js | 22 ++-- js/vn/lot.js | 20 ++-- js/vn/model-iface.js | 22 ++-- js/vn/model-proxy.js | 12 +- js/vn/model.js | 48 ++++---- js/vn/node-builder.js | 8 +- js/vn/param-iface.js | 22 ++-- js/vn/param.js | 32 +++--- js/vn/scope.js | 14 +-- js/vn/spec.js | 8 +- js/vn/url.js | 6 +- js/vn/value.js | 8 +- js/vn/vn.js | 46 ++++---- reports/shelves-report/shelves-report.js | 26 ++--- 128 files changed, 1075 insertions(+), 1075 deletions(-) diff --git a/forms/account/conf/index.js b/forms/account/conf/index.js index 020a711f..0eb209b0 100644 --- a/forms/account/conf/index.js +++ b/forms/account/conf/index.js @@ -4,7 +4,7 @@ export default new Class({ Extends: Hedera.Form, Template: require('./ui.xml'), - activate: function() { + activate() { this.$.userModel.setInfo('c', 'myClient', 'hedera'); this.$.userModel.setInfo('u', 'myUser', 'account'); @@ -12,7 +12,7 @@ export default new Class({ this.onPassChangeClick(); } - ,onPassChangeClick: function() { + ,onPassChangeClick() { this.$.oldPassword.value = ''; this.$.newPassword.value = ''; this.$.repeatPassword.value = ''; @@ -27,7 +27,7 @@ export default new Class({ this.$.oldPassword.focus(); } - ,onPassModifyClick: function() { + ,onPassModifyClick() { try { var oldPassword = this.$.oldPassword.value; var newPassword = this.$.newPassword.value; @@ -58,7 +58,7 @@ export default new Class({ } } - ,_onPassChange: function(json, error) { + ,_onPassChange(json, error) { if (!error) { this.$.changePassword.hide(); this.hash.unset('verificationToken'); @@ -74,7 +74,7 @@ export default new Class({ } } - ,onPassInfoClick: function() { + ,onPassInfoClick() { this.$.passwordInfo.show(); } }); diff --git a/forms/admin/items/index.js b/forms/admin/items/index.js index 461a6406..39a6049c 100644 --- a/forms/admin/items/index.js +++ b/forms/admin/items/index.js @@ -4,7 +4,7 @@ export default new Class({ Extends: Hedera.Form, Template: require('./ui.xml'), - activate: function() { + activate() { this.$.items.setInfo('i', 'item', 'vn', ['id']); } }); diff --git a/forms/admin/photos/index.js b/forms/admin/photos/index.js index 13dfac20..b56e5392 100644 --- a/forms/admin/photos/index.js +++ b/forms/admin/photos/index.js @@ -17,11 +17,11 @@ export default new Class({ ,uploadQueue: [] ,isUploading: false - ,activate: function() { + ,activate() { this.$.schema.value = 'catalog'; } - ,addFiles: function(files) { + ,addFiles(files) { if (!files) return; @@ -29,7 +29,7 @@ export default new Class({ this.addFile(files[i]); } - ,addFile: function(file) { + ,addFile(file) { var doc = document; var li = doc.createElement('div'); @@ -77,7 +77,7 @@ export default new Class({ this.setImageStatus(fileData, Status.NONE, 'add', _('Pending upload')); } - ,onUploadClick: function() { + ,onUploadClick() { var filesData = this.filesData; var count = 0; @@ -99,7 +99,7 @@ export default new Class({ this.uploadNextFile(); } - ,uploadNextFile: function() { + ,uploadNextFile() { if (this.isUploading) return; @@ -119,7 +119,7 @@ export default new Class({ this.onFileUpload.bind(this, fileData)); } - ,onFileUpload: function(fileData, data, error) { + ,onFileUpload(fileData, data, error) { this.isUploading = false; if (data) { @@ -143,7 +143,7 @@ export default new Class({ this.uploadNextFile(); } - ,setImageStatus: function(fileData, status, icon, title) { + ,setImageStatus(fileData, status, icon, title) { fileData.status = status; var statusNode = fileData.statusNode; @@ -154,7 +154,7 @@ export default new Class({ statusNode.title = title ? title : ''; } - ,onFileRemove: function(fileData) { + ,onFileRemove(fileData) { this.$.fileList.removeChild(fileData.li); for (var i = 0; i < this.filesData.length; i++) @@ -164,37 +164,37 @@ export default new Class({ } } - ,onClearClick: function() { + ,onClearClick() { this.filesData = []; Vn.Node.removeChilds(this.$.fileList); } - ,onDropzoneClick: function() { + ,onDropzoneClick() { this.$.file.click(); } - ,onFileChange: function() { + ,onFileChange() { this.addFiles(this.$.file.files); } - ,onDragEnter: function() { + ,onDragEnter() { this.$.dropzone.classList.add('dragover'); } - ,onDragLeave: function() { + ,onDragLeave() { this.$.dropzone.classList.remove('dragover'); } - ,onDragOver: function(event) { + ,onDragOver(event) { event.preventDefault(); } - ,onDragEnd: function(event) { + ,onDragEnd(event) { this.$.dropzone.classList.remove('dragover'); event.dataTransfer.clearData(); } - ,onDrop: function(event) { + ,onDrop(event) { event.preventDefault(); this.addFiles(event.dataTransfer.files); } diff --git a/forms/admin/queries/index.js b/forms/admin/queries/index.js index 337a3a90..2b87e0ac 100644 --- a/forms/admin/queries/index.js +++ b/forms/admin/queries/index.js @@ -4,11 +4,11 @@ export default new Class({ Extends: Hedera.Form, Template: require('./ui.xml') - ,activate: function() { + ,activate() { this.$.resultIndex.value = 0; } - ,clean: function() { + ,clean() { if (this._grid) { this.$.gridHolder.removeChild(this._grid.node); this._grid.unref(); @@ -16,7 +16,7 @@ export default new Class({ } } - ,onExecuteClick: function() { + ,onExecuteClick() { this.clean(); var model = new Db.Model({ @@ -28,11 +28,11 @@ export default new Class({ model.on('status-changed', this.onModelChange, this); } - ,onCleanClick: function() { + ,onCleanClick() { this.clean(); } - ,onModelChange: function(model, status) { + ,onModelChange(model, status) { if (status !== Db.Model.Status.LOADING) { model.disconnect('status-changed', this.onModelChange, this); model.unref(); diff --git a/forms/admin/users/index.js b/forms/admin/users/index.js index 949d3336..708c9f42 100644 --- a/forms/admin/users/index.js +++ b/forms/admin/users/index.js @@ -4,7 +4,7 @@ export default new Class({ Extends: Hedera.Form, Template: require('./ui.xml') - ,rendererFunc: function(scope, form) { + ,rendererFunc(scope, form) { var isEnabled = form.$.active scope.$.disabled.style.display = isEnabled ? 'none' : 'block'; @@ -12,12 +12,12 @@ export default new Class({ 'block' : 'none'; } - ,onChangeUserClick: function(userName) { + ,onChangeUserClick(userName) { this.gui.supplantUser(userName, this.onUserSupplant.bind(this)); } - ,onUserSupplant: function() { + ,onUserSupplant() { this.hash.setAll({form: 'ecomerce/orders'}); } }); diff --git a/forms/admin/visits/index.js b/forms/admin/visits/index.js index 4d7ad97a..78f093d8 100644 --- a/forms/admin/visits/index.js +++ b/forms/admin/visits/index.js @@ -4,7 +4,7 @@ export default new Class({ Extends: Hedera.Form, Template: require('./ui.xml') - ,activate: function() { + ,activate() { if (!this.hash.$.to) this.hash.assign({ from: new Date(), diff --git a/forms/agencies/packages/index.js b/forms/agencies/packages/index.js index 239f4bc0..8c8d3238 100644 --- a/forms/agencies/packages/index.js +++ b/forms/agencies/packages/index.js @@ -4,7 +4,7 @@ export default new Class({ Extends: Hedera.Form, Template: require('./ui.xml'), - onShowClick: function(column, agencyId) { + onShowClick(column, agencyId) { this.hash.setAll({ form: 'agencies/provinces', agency: agencyId diff --git a/forms/cms/contact/index.js b/forms/cms/contact/index.js index c34b7e5d..31b1c93c 100644 --- a/forms/cms/contact/index.js +++ b/forms/cms/contact/index.js @@ -4,7 +4,7 @@ export default new Class({ Extends: Hedera.Form, Template: require('./ui.xml') - ,activate: function() { + ,activate() { var self = this; this.$.contactForm.onsubmit = function() { self._onSubmit(); return false; @@ -13,7 +13,7 @@ export default new Class({ this.refreshCaptcha(); } - ,refreshCaptcha: function() { + ,refreshCaptcha() { params = { srv: 'rest:misc/captcha', stamp: new Date().getTime() @@ -21,12 +21,12 @@ export default new Class({ this.$.captchaImg.src = '?'+ Vn.Url.makeUri(params); } - ,_onSubmit: function() { + ,_onSubmit() { this.conn.sendForm(this.$.contactForm, this._onResponse.bind(this)); } - ,_onResponse: function(json) { + ,_onResponse(json) { var form = this.$.contactForm; if (json) { diff --git a/forms/cms/location/index.js b/forms/cms/location/index.js index a4bad7c8..5fd24122 100644 --- a/forms/cms/location/index.js +++ b/forms/cms/location/index.js @@ -8,7 +8,7 @@ export default new Class({ ,locations: null - ,activate: function() { + ,activate() { this.gui.loaderPush(); var sql = 'SELECT lat, lng, title, address, postcode, city, province, phone, language FROM location'; @@ -25,18 +25,18 @@ export default new Class({ this.gmapsLoaded(); } - ,onLocationsDone: function(resultSet) { + ,onLocationsDone(resultSet) { this.locations = resultSet.fetchData(); this.allLoaded(); } - ,gmapsLoaded: function() { + ,gmapsLoaded() { this.gui.loaderPop(); gmapsIsLoaded = true; this.allLoaded(); } - ,allLoaded: function() { + ,allLoaded() { if (!this.locations || !gmapsIsLoaded) return; @@ -53,7 +53,7 @@ export default new Class({ this.createMarker(location, gmap); } - ,createMarker: function(location, gmap) { + ,createMarker(location, gmap) { var div = document.createElement('div'); div.className = 'marker'; @@ -100,7 +100,7 @@ export default new Class({ this.openInfoWindow(infoWindow, gmap, marker); } - ,openInfoWindow: function(infoWindow, gmap, marker) { + ,openInfoWindow(infoWindow, gmap, marker) { if (this.openedWindow) this.openedWindow.close(); diff --git a/forms/ecomerce/catalog/index.js b/forms/ecomerce/catalog/index.js index 759f33ba..20ab3b83 100644 --- a/forms/ecomerce/catalog/index.js +++ b/forms/ecomerce/catalog/index.js @@ -5,7 +5,7 @@ export default new Class({ ,_menuShown: false - ,open: function() { + ,open() { this.close(); this.isOpen = true; @@ -18,12 +18,12 @@ export default new Class({ } } - ,onBasketCheck: function(isOk) { + ,onBasketCheck(isOk) { if (isOk) this.loadUi(); } - ,activate: function() { + ,activate() { document.body.appendChild(this.$.rightPanel); this.$.items.setInfo('i', 'item', 'vn', ['id']); @@ -35,7 +35,7 @@ export default new Class({ this.onFilterChange(); } - ,deactivate: function() { + ,deactivate() { this.hideMenu(); this.gui.$.topBar.style.backgroundColor = ''; Vn.Node.remove(this.$.rightPanel); @@ -81,7 +81,7 @@ export default new Class({ return lot; } - ,onFilterChange: function() { + ,onFilterChange() { const $ = this.$; const params = $.params.$; @@ -110,7 +110,7 @@ export default new Class({ if (lot) this.hideMenu(); } - ,refreshTitle: function() { + ,refreshTitle() { const hash = this.hash.$; const types = this.$.types; const realms = this.$.realms; @@ -143,7 +143,7 @@ export default new Class({ Vn.Node.setText(this.$.subtitle, subtitle); } - ,setView: function(view) { + ,setView(view) { if (view === Hedera.Catalog.View.GRID) { this.$.viewButton.setProperties({ icon: 'view_list', @@ -165,19 +165,19 @@ export default new Class({ localStorage.setItem('hederaView', this.view); } - ,onSwitchViewClick: function() { + ,onSwitchViewClick() { this.setView(this.view === Hedera.Catalog.View.LIST ? Hedera.Catalog.View.GRID : Hedera.Catalog.View.LIST); } - ,onItemsChange: function(model, status) { + ,onItemsChange(model, status) { if (status !== Db.Model.Status.CLEAN) this.$.order.style.display = 'block'; else this.$.order.style.display = 'none'; } - ,onOrderChange: function(e) { + ,onOrderChange(e) { var value = e.target.value; var sortField = value.substr(2); var sortWay = value.charAt(0) === 'A' ? @@ -189,7 +189,7 @@ export default new Class({ this.hideMenu(); } - ,realmRenderer: function(builder, form) { + ,realmRenderer(builder, form) { var link = builder.$.link; link.href = this.hash.make({ form: this.hash.$.form, @@ -197,11 +197,11 @@ export default new Class({ }); } - ,onRightPanelClick: function(event) { + ,onRightPanelClick(event) { event.stopPropagation(); } - ,onShowMenuClick: function(event) { + ,onShowMenuClick(event) { this._menuShown = true; event.stopPropagation(); this.gui.showBackground(); @@ -210,7 +210,7 @@ export default new Class({ document.addEventListener('click', this.hideMenuCallback); } - ,hideMenu: function() { + ,hideMenu() { if (!this._menuShown) return; @@ -220,7 +220,7 @@ export default new Class({ this.hideMenuCallback = null; } - ,isGuest: function() { + ,isGuest() { if (localStorage.getItem('hederaGuest')) { Htk.Toast.showError(_('YouMustBeLoggedIn')); return true; @@ -229,21 +229,21 @@ export default new Class({ return false; } - ,onBasketClick: function() { + ,onBasketClick() { if (this.isGuest()) return; this.hash.setAll({form: 'ecomerce/basket'}); } - ,onConfigureClick: function() { + ,onConfigureClick() { if (this.isGuest()) return; this.hash.setAll({form: 'ecomerce/checkout'}); } - ,onAddItemClick: function(event, form) { + ,onAddItemClick(event, form) { if (event.defaultPrevented) return; event.preventDefault(); if (this.isGuest()) return; @@ -254,7 +254,7 @@ export default new Class({ this.$.cardPopup.show(event.currentTarget); } - ,onAddLotClick: function(column, value, row) { + ,onAddLotClick(column, value, row) { var model = this.$.itemLots; var grouping = model.get(row, 'grouping'); var warehouse = model.get(row, 'warehouseFk'); @@ -277,7 +277,7 @@ export default new Class({ Htk.Toast.showError(_('NoMoreAmountAvailable')); } - ,onConfirmClick: function() { + ,onConfirmClick() { var sql = ''; var query = new Sql.String({query: 'CALL myBasket_addItem(#warehouse, #item, #amount);'}); var amountSum = 0; @@ -305,18 +305,18 @@ export default new Class({ this.$.cardPopup.hide(); } - ,onEraseClick: function() { + ,onEraseClick() { this.$.amount.value = 0; this.items = {}; } - ,onPopupClose: function() { + ,onPopupClose() { this.onEraseClick(); this.$.$card.row = -1; this.$.cardLot.value = undefined; } - ,onCardLoad: function() { + ,onCardLoad() { this.$.cardPopup.reset(); } }); diff --git a/forms/ecomerce/checkout/index.js b/forms/ecomerce/checkout/index.js index 10a526f5..865e0ed0 100644 --- a/forms/ecomerce/checkout/index.js +++ b/forms/ecomerce/checkout/index.js @@ -4,7 +4,7 @@ export default new Class({ Extends: Hedera.Form, Template: require('./ui.xml'), - activate: function() { + activate() { this.autoStepLocked = true; this.$.assistant.stepsIndex = this.agencySteps; @@ -12,7 +12,7 @@ export default new Class({ this.today.setHours(0, 0, 0, 0); }, - onValuesReady: function() { + onValuesReady() { const orderForm = this.$.orderForm; const defaultsForm = this.$.defaults; @@ -52,11 +52,11 @@ export default new Class({ this.autoStepLocked = false; }, - disableButtons: function(disable) { + disableButtons(disable) { this.$.assistantBar.disabled = disable; }, - onConfirmClick: function() { + onConfirmClick() { this.disableButtons(true); const query = 'CALL myBasket_configure(#date, #method, #agency, #address)'; @@ -64,7 +64,7 @@ export default new Class({ this.onBasketConfigured.bind(this), this.$.lot.$); }, - onBasketConfigured: function(resultSet) { + onBasketConfigured(resultSet) { this.disableButtons(false); if (!resultSet.fetchResult()) @@ -78,7 +78,7 @@ export default new Class({ this.hash.setAll({form: 'ecomerce/catalog'}); }, - onCancelClick: function() { + onCancelClick() { if (this.$.orderForm.numRows > 0) window.history.back(); else @@ -88,77 +88,77 @@ export default new Class({ agencySteps: ['method', 'date', 'address', 'agency', 'confirm-delivery'], pickupSteps: ['method', 'date', 'address', 'pickup', 'confirm-pickup'], - isDelivery: function() { + isDelivery() { return this.$.rgMethod.value != 'PICKUP'; }, - onMethodChange: function() { + onMethodChange() { this.$.assistant.stepsIndex = this.isDelivery() ? this.agencySteps : this.pickupSteps; this.onFieldChange(); }, - methodValidate: function() { + methodValidate() { if (!this.$.rgMethod.isSelected()) throw new Error(_('Please select an option')); }, - dateShow: function() { + dateShow() { Vn.Node.setText(this.$.dateQuestion, this.isDelivery() ? _('OrderDateDeliveryQuestion'): _('OrderDatePickupQuestion')); this.$.calendar.goToSelectedMonth(); }, - dateValidate: function() { + dateValidate() { if (!this.$.calendar.value) throw new Error(_('Please select a date')); }, - addressShow: function() { + addressShow() { Vn.Node.setText(this.$.addressQuestion, this.isDelivery() ? _('AddressQuestion'): _('AddressQuestionPickup')); }, - addressValidate: function() { + addressValidate() { if (this.$.addressForm.row == -1) throw new Error(_('Please select an address')); }, - agencyShow: function() { + agencyShow() { this.$.agencies.refresh(); }, - agencyValidate: function() { + agencyValidate() { if (this.$.agencyCombo.row == -1 && this.isDelivery()) throw new Error(_('Please select an agency')); }, - pickupShow: function() { + pickupShow() { this.$.warehouses.refresh(); }, - pickupValidate: function() { + pickupValidate() { if (this.$.warehouseCombo.row == -1) throw new Error(_('Please select a store')); }, - onFieldChange: function() { + onFieldChange() { if (!this.autoStepLocked) this.$.assistant.moveNext(); }, - goNextStep: function() { + goNextStep() { this.$.assistant.moveNext(); }, - onAddressClick: function(addressId) { + onAddressClick(addressId) { this.$.lot.set('address', addressId); this.goNextStep(); }, - onAddressChange: function() { + onAddressChange() { if (this.selectedNode) Vn.Node.removeClass(this.selectedNode, 'selected'); @@ -174,7 +174,7 @@ export default new Class({ this.$.addressForm.row = row; }, - onAgenciesReady: function(model) { + onAgenciesReady(model) { if (!model.ready) return; if (model.numRows > 0) { @@ -204,12 +204,12 @@ export default new Class({ Htk.Toast.showError(_('NoAgeciesAvailableForDate')); }, - onWarehousesReady: function(model) { + onWarehousesReady(model) { if (model.ready && model.numRows == 0) Htk.Toast.showError(_('NoWarehousesAvailableForDate')); }, - calendarRestrict: function(date) { + calendarRestrict(date) { return date.getTime() >= this.today.getTime(); } }); diff --git a/forms/ecomerce/confirm/index.js b/forms/ecomerce/confirm/index.js index 9784d4ae..813daa2d 100644 --- a/forms/ecomerce/confirm/index.js +++ b/forms/ecomerce/confirm/index.js @@ -4,7 +4,7 @@ export default new Class({ Extends: Hedera.Form, Template: require('./ui.xml'), - open: function() { + open() { this.close(); this.isOpen = true; @@ -12,12 +12,12 @@ export default new Class({ this.onBasketCheck.bind(this)); }, - onBasketCheck: function(isOk) { + onBasketCheck(isOk) { if (isOk) this.loadUi(); }, - onOrderReady: function(form) { + onOrderReady(form) { if (form.row < 0) return; @@ -84,7 +84,7 @@ export default new Class({ this.$.payMethod.value = selectedMethod; }, - onPayMethodChange: function(payMethod) { + onPayMethodChange(payMethod) { var id = this.displayedInfo; if (id) @@ -113,28 +113,28 @@ export default new Class({ Vn.Node.addClass(this.$[id], 'selected'); }, - disableButtons: function(disable) { + disableButtons(disable) { this.$.modify.disabled = disable; this.$.confirm.disabled = disable; }, - onModifyClick: function() { + onModifyClick() { window.history.back(); }, - onConfirmClick: function() { + onConfirmClick() { this.disableButtons(true); this.$.confirmQuery.execute(); }, - onConfirm: function(query, resultSet) { + onConfirm(query, resultSet) { this.disableButtons(false); if (resultSet.fetchResult()) this.$.successDialog.show(); }, - onDialogResponse: function() { + onDialogResponse() { if (this.$.payMethod.value === 'CARD') { if (this.$.payAmount.value === 'EXCEEDED') var payAmount = this.$.excessAmount.value; diff --git a/forms/ecomerce/invoices/index.js b/forms/ecomerce/invoices/index.js index 69e27a74..5c0960b9 100644 --- a/forms/ecomerce/invoices/index.js +++ b/forms/ecomerce/invoices/index.js @@ -4,7 +4,7 @@ export default new Class({ Extends: Hedera.Form, Template: require('./ui.xml'), - donwloadRenderer: function(column, invoice) { + donwloadRenderer(column, invoice) { var invoiceId = invoice.$.id; if (invoice.$.hasPdf && invoiceId) { diff --git a/forms/ecomerce/orders/index.js b/forms/ecomerce/orders/index.js index a9d6b378..d1b3d2e0 100644 --- a/forms/ecomerce/orders/index.js +++ b/forms/ecomerce/orders/index.js @@ -4,7 +4,7 @@ export default new Class({ Extends: Hedera.Form, Template: require('./ui.xml'), - activate: function() { + activate() { this.tpv = new Hedera.Tpv({ conn: this.conn, hash: this.hash @@ -12,16 +12,16 @@ export default new Class({ this.tpv.check(this._onTpvCheck.bind(this)); }, - _onTpvCheck: function(tpv, tpvOrder, tpvStatus) { + _onTpvCheck(tpv, tpvOrder, tpvStatus) { if (tpvStatus === 'ko') this.$.errorDialog.show(); }, - onBasketClick: function() { + onBasketClick() { this.hash.setAll({form: 'ecomerce/basket'}); }, - repeaterFunc: function(res, form) { + repeaterFunc(res, form) { res.$.link.href = this.hash.make({ form: 'ecomerce/ticket', ticket: form.$.id @@ -30,14 +30,14 @@ export default new Class({ // TPV - balanceConditionalFunc: function(field, value) { + balanceConditionalFunc(field, value) { if (value >= 0) Vn.Node.removeClass(this.$.balance, 'negative'); else Vn.Node.addClass(this.$.balance, 'negative'); }, - onPayButtonClick: function() { + onPayButtonClick() { var amount = -this.$.debt.value; amount = amount <= 0 ? null : amount; @@ -54,7 +54,7 @@ export default new Class({ } }, - onDialogResponse: function(dialog, response) { + onDialogResponse(dialog, response) { if (response == Htk.Dialog.Button.RETRY) this.tpv.retryPay(); } diff --git a/forms/ecomerce/ticket/index.js b/forms/ecomerce/ticket/index.js index 50c787ce..430734f2 100644 --- a/forms/ecomerce/ticket/index.js +++ b/forms/ecomerce/ticket/index.js @@ -4,7 +4,7 @@ export default new Class({ Extends: Hedera.Form, Template: require('./ui.xml'), - onTicketChange: function(ticket) { + onTicketChange(ticket) { if (!ticket.value) return; @@ -12,7 +12,7 @@ export default new Class({ this.conn.execQuery('CALL myTicket_logAccess(#ticket)', null, params); }, - onPrintClick: function() { + onPrintClick() { let params = Vn.Url.makeUri({ access_token: this.conn.token, recipientId: this.gui.user.id, @@ -21,25 +21,25 @@ export default new Class({ window.open(`/api/Tickets/${this.hash.$.ticket}/delivery-note-pdf?${params}`); }, - repeaterFunc: function(scope, form) { + repeaterFunc(scope, form) { scope.$.discount.style.display = form.$.discount ? 'inline' : 'none'; }, - discountSubtotal: function(line) { + discountSubtotal(line) { return line.quantity * line.price; }, - subtotal: function(line) { + subtotal(line) { var discount = line.discount; return this.discountSubtotal(line) * ((100 - discount) / 100); }, - onServicesChanged: function(model) { + onServicesChanged(model) { this.$.services.node.style.display = model.numRows > 0 ? 'block' : 'none'; }, - onPackagesChanged: function(model) { + onPackagesChanged(model) { this.$.packages.node.style.display = model.numRows > 0 ? 'block' : 'none'; }, diff --git a/forms/news/new/index.js b/forms/news/new/index.js index a8316815..730687c1 100644 --- a/forms/news/new/index.js +++ b/forms/news/new/index.js @@ -7,7 +7,7 @@ export default new Class({ ,editor: null - ,activate: function() { + ,activate() { this.$.model.mode = Db.Model.Mode.ON_DEMAND; this.$.model.setDefault('userFk', 'news', new Sql.Function({schema: 'account', name: 'myUser_getId'})); @@ -32,17 +32,17 @@ export default new Class({ }); }, - deactivate: function() { + deactivate() { this.editor.destroy(); }, - _onEditorInit: function(editor) { + _onEditorInit(editor) { this.editor = editor; editor.getDoc().body.style.fontSize = '1em'; this.setEditorText(); }, - setEditorText: function() { + setEditorText() { if (!this.editor) return; @@ -50,26 +50,26 @@ export default new Class({ this.editor.setContent(row ? row.text : ''); }, - onStatusChange: function() { + onStatusChange() { if (!this.hash.$.new) this.$.iter.insertRow(); }, - onOperationsDone: function() { + onOperationsDone() { Htk.Toast.showMessage(_('NewChangedSuccessfully')); this.onReturnClick(); }, - onBodyChange: function() { + onBodyChange() { this.setEditorText(); }, - onAcceptClick: function() { + onAcceptClick() { this.$.iter.set('text', this.editor.getContent()); this.$.iter.performOperations(); }, - onReturnClick: function() { + onReturnClick() { this.hash.setAll({form: 'news/news'}); } }); diff --git a/forms/news/news/index.js b/forms/news/news/index.js index adbfaf7a..fcc0f392 100644 --- a/forms/news/news/index.js +++ b/forms/news/news/index.js @@ -4,27 +4,27 @@ export default new Class({ Extends: Hedera.Form, Template: require('./ui.xml') - ,activate: function() { + ,activate() { this.$.newsModel.setInfo('n', 'news', 'hedera', ['id'], 'id'); } - ,editNew: function(newId) { + ,editNew(newId) { this.hash.setAll({ form: 'news/new', new: newId }); } - ,onEditClick: function(newId) { + ,onEditClick(newId) { this.editNew(newId); } - ,onDeleteClick: function(form) { + ,onDeleteClick(form) { if (confirm(_('ReallyDelete'))) form.deleteRow(); } - ,onAddClick: function() { + ,onAddClick() { this.editNew(0); } }); diff --git a/forms/reports/items-form/items-form.js b/forms/reports/items-form/items-form.js index 63c33713..083d3736 100644 --- a/forms/reports/items-form/items-form.js +++ b/forms/reports/items-form/items-form.js @@ -2,14 +2,14 @@ export default new Class({ Extends: Hedera.Form - ,activate: function() { + ,activate() { this.$.lot.assign({ warehouse: 7, realm: null }); } - ,onPreviewClick: function() { + ,onPreviewClick() { this.$.lot.set('rate', this.$.rate.value); this.gui.openReport('items-report', this.$.lot); } diff --git a/forms/reports/shelves/shelves.js b/forms/reports/shelves/shelves.js index 61eac75a..f93d7c90 100644 --- a/forms/reports/shelves/shelves.js +++ b/forms/reports/shelves/shelves.js @@ -2,18 +2,18 @@ export default new Class({ Extends: Hedera.Form - ,activate: function() { + ,activate() { this.$.lot.assign({ date: new Date(), useIds: false }); } - ,onConfigChange: function() { + ,onConfigChange() { this.$.lot.assignLot(this.$.config); } - ,onPreviewClick: function() { + ,onPreviewClick() { this.gui.openReport('shelves-report', this.$.lot); } }); diff --git a/js/db/connection.js b/js/db/connection.js index 90b16d67..7419895f 100644 --- a/js/db/connection.js +++ b/js/db/connection.js @@ -41,7 +41,7 @@ Connection.implement({ * @param {String} sql The SQL statement * @param {Function} callback The function to call when operation is done */ - ,execSql: function(sql, callback) { + ,execSql(sql, callback) { this.send('core/query', {'sql': sql}, this._onExec.bind(this, callback)); } @@ -53,7 +53,7 @@ Connection.implement({ * @param {Function} callback The function to call when operation is done * @param {Object} params The query params */ - ,execStmt: function(stmt, callback, params) { + ,execStmt(stmt, callback, params) { this.execSql(stmt.render(params), callback); } @@ -64,21 +64,21 @@ Connection.implement({ * @param {Function} callback The function to call when operation is done * @param {Object} params The query params */ - ,execQuery: function(query, callback, params) { + ,execQuery(query, callback, params) { this.execStmt(new Sql.String({query: query}), callback, params); } /* * Parses a value to date. */ - ,valueToDate: function(value) { + ,valueToDate(value) { return fixTz(new Date(value)); } /* * Called when a query is executed. */ - ,_onExec: function(callback, json, error) { + ,_onExec(callback, json, error) { const results = []; if (json) diff --git a/js/db/db-lot.js b/js/db/db-lot.js index 67a3b3c6..4b79dcc5 100644 --- a/js/db/db-lot.js +++ b/js/db/db-lot.js @@ -11,10 +11,10 @@ module.exports = new Class({ */ conn: { type: Connection - ,set: function(x) { + ,set(x) { this.model.conn = x; } - ,get: function() { + ,get() { return this.model.conn; } }, @@ -23,10 +23,10 @@ module.exports = new Class({ */ query: { type: String - ,set: function(x) { + ,set(x) { this.model.query = x; } - ,get: function() { + ,get() { return this.model.query; } }, @@ -35,10 +35,10 @@ module.exports = new Class({ */ stmt: { type: Sql.Stmt - ,set: function(x) { + ,set(x) { this.model.stmt = x; } - ,get: function() { + ,get() { return this.model.stmt; } }, @@ -47,31 +47,31 @@ module.exports = new Class({ */ lot: { type: Vn.Lot - ,set: function(x) { + ,set(x) { this.model.lot = x; } - ,get: function() { + ,get() { return this.model.lot; } } } - ,initialize: function(props) { + ,initialize(props) { this.model = new Model(); Vn.Form.prototype.initialize.call(this, props); } - ,appendChild: function(child) { + ,appendChild(child) { if (child.nodeType === Node.TEXT_NODE) this.query = child.textContent; } - ,refresh: function() { + ,refresh() { if (this._model) this._model.refresh(); } - ,performOperations: function() { + ,performOperations() { if (this._model) this._model.performOperations(); } @@ -82,7 +82,7 @@ module.exports = new Class({ * @param {string} columnName The column name * @return {integer} The column index or -1 if column not exists */ - ,getColumnIndex: function(columnName) { + ,getColumnIndex(columnName) { return this._model ? this._model.getColumnIndex(columnName) : -1; } @@ -93,7 +93,7 @@ module.exports = new Class({ * @param {string} columnName The column index * @return {Object} The value */ - ,getByIndex: function(column) { + ,getByIndex(column) { return this._model.getByIndex(this._row, column); } @@ -103,7 +103,7 @@ module.exports = new Class({ * @param {string} columnName The column index * @param {Object} value The new value */ - ,setByIndex: function(column, value) { + ,setByIndex(column, value) { return this._model.setByIndex(this._row, column, value); } }); diff --git a/js/db/form.js b/js/db/form.js index 5df50d51..379a8648 100644 --- a/js/db/form.js +++ b/js/db/form.js @@ -12,13 +12,13 @@ module.exports = new Class({ */ model: { type: Model - ,set: function(x) { + ,set(x) { this.link({_model: x}, { 'status-changed': this.onModelChange ,'row-updated': this.onRowUpdate }); } - ,get: function() { + ,get() { return this._model; } }, @@ -27,7 +27,7 @@ module.exports = new Class({ */ row: { type: Number - ,set: function(x) { + ,set(x) { if (!this._model || this._model.numRows <= x || x < -1) x = -1; if (x == this._row) @@ -36,7 +36,7 @@ module.exports = new Class({ this._row = x; this.iterChanged(); } - ,get: function() { + ,get() { return this._row; } }, @@ -45,7 +45,7 @@ module.exports = new Class({ */ numRows: { type: Number - ,get: function() { + ,get() { if (this._model) return this._model.numRows; @@ -57,7 +57,7 @@ module.exports = new Class({ */ ready: { type: Boolean - ,get: function() { + ,get() { return this._ready; } }, @@ -66,7 +66,7 @@ module.exports = new Class({ */ $: { type: Object - ,get: function() { + ,get() { return this._model && this._model.getObject(this._row); } } @@ -77,7 +77,7 @@ module.exports = new Class({ ,_row: -1 ,_ready: false - ,onModelChange: function() { + ,onModelChange() { var ready = this._model && this._model.ready; if (ready != this._ready) { @@ -97,7 +97,7 @@ module.exports = new Class({ } } - ,onRowUpdate: function(model, row) { + ,onRowUpdate(model, row) { if (row == this._row) this.iterChanged(); } diff --git a/js/db/iterator.js b/js/db/iterator.js index 98f3078e..80161459 100644 --- a/js/db/iterator.js +++ b/js/db/iterator.js @@ -38,7 +38,7 @@ module.exports = new Class({ ,_model: null ,_row: -1 - ,refresh: function() { + ,refresh() { if (this._model) this._model.refresh(); } @@ -46,7 +46,7 @@ module.exports = new Class({ /** * Emits the 'change' signal on the form. */ - ,iterChanged: function() { + ,iterChanged() { this.emit('change'); } @@ -56,19 +56,19 @@ module.exports = new Class({ * @param {String} columnName The column name * @return {integer} The column index or -1 if column not exists */ - ,getColumnIndex: function(columnName) { + ,getColumnIndex(columnName) { if (this._model) return this._model.getColumnIndex(columnName); return -1; } - ,insertRow: function() { + ,insertRow() { if (this._model) this.row = this._model.insertRow(); } - ,performOperations: function() { + ,performOperations() { if (this._model) this._model.performOperations(); } @@ -76,7 +76,7 @@ module.exports = new Class({ /** * Removes the current row. */ - ,deleteRow: function() { + ,deleteRow() { if (this._row >= 0) this._model.deleteRow(this._row); } @@ -86,7 +86,7 @@ module.exports = new Class({ * * @return {Object} The row */ - ,getObject: function() { + ,getObject() { return this._model.getObject(this._row); } @@ -95,7 +95,7 @@ module.exports = new Class({ * * @param {String} columnName The column name */ - ,get: function(columnName) { + ,get(columnName) { if (!this._model) return undefined; return this._model.get(this._row, columnName); } @@ -106,7 +106,7 @@ module.exports = new Class({ * @param {String} columnName The column name * @param {Object} value The new value */ - ,set: function(columnName, value) { + ,set(columnName, value) { return this._model.set(this._row, columnName, value); } @@ -116,7 +116,7 @@ module.exports = new Class({ * @param {String} columnName The column index * @return {Object} The value */ - ,getByIndex: function(column) { + ,getByIndex(column) { return this._model.getByIndex(this._row, column); } @@ -126,7 +126,7 @@ module.exports = new Class({ * @param {String} columnName The column index * @param {Object} value The new value */ - ,setByIndex: function(column, value) { + ,setByIndex(column, value) { return this._model.setByIndex(this._row, column, value); } }); diff --git a/js/db/model.js b/js/db/model.js index 92d245ee..834575bf 100644 --- a/js/db/model.js +++ b/js/db/model.js @@ -52,11 +52,11 @@ Model.implement({ */ conn: { type: Connection - ,set: function(x) { + ,set(x) { this._conn = x; this._autoLoad(); } - ,get: function() { + ,get() { return this._conn; } }, @@ -65,10 +65,10 @@ Model.implement({ */ resultIndex: { type: Number - ,set: function(x) { + ,set(x) { this._resultIndex = x; } - ,get: function() { + ,get() { return this._resultIndex; } }, @@ -77,11 +77,11 @@ Model.implement({ */ lot: { type: Vn.LotIface - ,set: function(x) { + ,set(x) { this.link({_lot: x}, {'change': this._onLotChange}); this._onLotChange(); } - ,get: function() { + ,get() { return this._lot; } }, @@ -90,11 +90,11 @@ Model.implement({ */ stmt: { type: Sql.Stmt - ,set: function(x) { + ,set(x) { this._stmt = x; this._autoLoad(); } - ,get: function() { + ,get() { return this._stmt; } }, @@ -103,10 +103,10 @@ Model.implement({ */ query: { type: String - ,set: function(x) { + ,set(x) { this.stmt = new Sql.String({query: x}); } - ,get: function() { + ,get() { if (this._stmt) return this._stmt.render(null); else @@ -118,12 +118,12 @@ Model.implement({ */ mainTable: { type: String - ,set: function(x) { + ,set(x) { this._mainTable = null; this._requestedMainTable = x; this._refreshMainTable(); } - ,get: function() { + ,get() { return this._mainTable; } }, @@ -132,12 +132,12 @@ Model.implement({ */ updatable: { type: Boolean - ,set: function(x) { + ,set(x) { this._updatable = false; this._requestedUpdatable = x; this._refreshUpdatable(); } - ,get: function() { + ,get() { return this._updatable; } }, @@ -146,7 +146,7 @@ Model.implement({ */ numRows: { type: Number - ,get: function() { + ,get() { if (this.data) return this.data.length; @@ -158,7 +158,7 @@ Model.implement({ */ status: { type: Number - ,get: function() { + ,get() { return this._status; } }, @@ -167,7 +167,7 @@ Model.implement({ */ ready: { type: Boolean - ,get: function() { + ,get() { return this._status == Status.READY; } }, @@ -213,18 +213,18 @@ Model.implement({ ,_defaults: [] ,_requestedMainTable: null - ,initialize: function(props) { + ,initialize(props) { Vn.Object.prototype.initialize.call(this, props); this._cleanData(); this._setStatus(Status.CLEAN); } - ,appendChild: function(child) { + ,appendChild(child) { if (child.nodeType === Node.TEXT_NODE) this.query = child.textContent; } - ,loadXml: function(builder, node) { + ,loadXml(builder, node) { Vn.Object.prototype.loadXml.call(this, builder, node); var query = node.firstChild.nodeValue; @@ -251,7 +251,7 @@ Model.implement({ return holders; } - ,_getHolderValues: function() { + ,_getHolderValues() { let holders = this._getHolders(this._stmt); if (!holders) return null; @@ -264,7 +264,7 @@ Model.implement({ return params; } - ,_getHolderParams: function() { + ,_getHolderParams() { let holders = this._getHolders(this._stmt); if (!holders) return null; @@ -276,7 +276,7 @@ Model.implement({ return params; } - ,_onLotChange: function() { + ,_onLotChange() { const params = this._getHolderValues(); this._paramsChanged = !Vn.Value.equals(params, this._lastParams); @@ -284,14 +284,14 @@ Model.implement({ this.lazyRefresh(); } - ,_autoLoad: function() { + ,_autoLoad() { if (this.autoLoad) this.refresh(); else this.clean(); } - ,_isReady: function(params) { + ,_isReady(params) { if (!this._stmt || !this._conn) return false; @@ -302,7 +302,7 @@ Model.implement({ return true; } - ,lazyRefresh: function() { + ,lazyRefresh() { if (this._paramsChanged) this.refresh(); } @@ -310,7 +310,7 @@ Model.implement({ /** * Refresh the model data reexecuting the query on the database. */ - ,refresh: function() { + ,refresh() { const params = this._getHolderParams(); if (this._isReady(params)) { @@ -323,12 +323,12 @@ Model.implement({ this.clean(); } - ,clean: function() { + ,clean() { this._cleanData(); this._setStatus(Status.CLEAN); } - ,_selectDone: function(resultSet) { + ,_selectDone(resultSet) { var result; var dataResult; @@ -371,7 +371,7 @@ Model.implement({ this._setStatus(Status.READY); } - ,_refreshRowIndexes: function(start) { + ,_refreshRowIndexes(start) { for (var i = start; i < this.data.length; i++) this.data[i].index = i; @@ -383,7 +383,7 @@ Model.implement({ } } - ,_cleanData: function() { + ,_cleanData() { this.data = null; this.tables = null; this.columns = null; @@ -393,7 +393,7 @@ Model.implement({ this._resetOperations(); } - ,_refreshUpdatable: function() { + ,_refreshUpdatable() { var oldValue = this._updatable; this._updatable = this._mainTable !== null && this._requestedUpdatable; @@ -401,7 +401,7 @@ Model.implement({ this.emit('updatable-changed'); } - ,_refreshMainTable: function() { + ,_refreshMainTable() { var newMainTable = null; var tables = this.tables; @@ -425,7 +425,7 @@ Model.implement({ * @param {String} table The destination table name * @param {Sql.Expr} srcColumn The default value expression */ - ,setDefault: function(field, table, expr) { + ,setDefault(field, table, expr) { this._defaults.push({field, table, expr}); } @@ -436,7 +436,7 @@ Model.implement({ * @param {String} table The destination table name * @param {Object} value The default value */ - ,setDefaultFromValue: function(field, table, value) { + ,setDefaultFromValue(field, table, value) { this._defaults.push({field, table, value}); } @@ -448,7 +448,7 @@ Model.implement({ * @param {String} table The destination table name * @param {String} srcColumn The source column */ - ,setDefaultFromColumn: function(field, table, srcColumn) { + ,setDefaultFromColumn(field, table, srcColumn) { this._defaults.push({field, table, srcColumn}); } @@ -458,7 +458,7 @@ Model.implement({ * @param {integer} column The column index * @return {Boolean} %true if column exists, %false otherwise */ - ,checkColExists: function(column) { + ,checkColExists(column) { return this.columns && column >= 0 && column < this.columns.length; @@ -470,7 +470,7 @@ Model.implement({ * @param {string} columnName The column name * @return {Boolean} %true if column exists, %false otherwise */ - ,checkColName: function(columnName) { + ,checkColName(columnName) { return this.columnMap && this.columnMap[columnName] != null; } @@ -481,13 +481,13 @@ Model.implement({ * @param {integer} rowIndex The row index * @return {Boolean} %true if row exists, %false otherwise */ - ,checkRowExists: function(rowIndex) { + ,checkRowExists(rowIndex) { return this.data && rowIndex >= 0 && rowIndex < this.data.length; } - ,_checkTableUpdatable: function(tableIndex) { + ,_checkTableUpdatable(tableIndex) { var tableUpdatable = tableIndex !== null && this.tables[tableIndex].pks.length > 0; @@ -508,7 +508,7 @@ Model.implement({ * @param {string} columnName The column name * @return {number} The column index or -1 if column not exists */ - ,getColumnIndex: function(columnName) { + ,getColumnIndex(columnName) { if (this.checkColName(columnName)) return this.columnMap[columnName].index; @@ -521,7 +521,7 @@ Model.implement({ * @param {number} columnIndex The column name * @return {string} The column index or -1 if column not exists */ - ,getColumnName: function(columnIndex) { + ,getColumnName(columnIndex) { if (this.checkColExists(columnIndex)) return this.columns[columnIndex].name; @@ -534,7 +534,7 @@ Model.implement({ * @param {number} rowIndex The row index * @return {Object} The row */ - ,getObject: function(rowIndex) { + ,getObject(rowIndex) { if (!this.checkRowExists(rowIndex)) return undefined; @@ -548,7 +548,7 @@ Model.implement({ * @param {string} columnName The column name * @return {mixed} The value */ - ,get: function(rowIndex, columnName) { + ,get(rowIndex, columnName) { if (this.checkRowExists(rowIndex)) return this.data[rowIndex][columnName]; } @@ -560,7 +560,7 @@ Model.implement({ * @param {string} columnName The column name * @param {mixed} value The new value */ - ,set: function(rowIndex, columnName, value) { + ,set(rowIndex, columnName, value) { if (!this.checkRowExists(rowIndex) && !this.checkColName(columnName)) return; @@ -615,7 +615,7 @@ Model.implement({ * @param {number} columnIndex The column index * @return {mixed} The value */ - ,getByIndex: function(rowIndex, columnIndex) { + ,getByIndex(rowIndex, columnIndex) { var columnName = this.getColumnName(columnIndex); if (columnName) @@ -631,7 +631,7 @@ Model.implement({ * @param {number} columnIndex The column index * @param {mixed} value The new value */ - ,setByIndex: function(rowIndex, columnIndex, value) { + ,setByIndex(rowIndex, columnIndex, value) { var columnName = this.getColumnName(columnIndex); if (columnName) @@ -645,7 +645,7 @@ Model.implement({ * * @param {number} rowIndex The row index */ - ,deleteRow: function(rowIndex) { + ,deleteRow(rowIndex) { if (!this.checkRowExists(rowIndex) || !this._checkTableUpdatable(this._mainTable)) return; @@ -689,7 +689,7 @@ Model.implement({ * * @return The index of the inserted row */ - ,insertRow: function() { + ,insertRow() { if (!this._checkTableUpdatable(this._mainTable)) return -1; @@ -716,7 +716,7 @@ Model.implement({ /** * Performs all model changes on the database. */ - ,performOperations: function() { + ,performOperations() { var ops = this._operations; if (ops.length === 0) { @@ -769,7 +769,7 @@ Model.implement({ this._resetOperations(); } - ,_createDmlQuery: function(op, tableIndex) { + ,_createDmlQuery(op, tableIndex) { var where = this._createWhere(tableIndex, op, false); if (!where) @@ -827,7 +827,7 @@ Model.implement({ return multiStmt; } - ,_onOperationsDone: function(ops, resultSet) { + ,_onOperationsDone(ops, resultSet) { var error = resultSet.getError(); if (error) { @@ -895,7 +895,7 @@ Model.implement({ /** * Undoes all unsaved changes made to the model. */ - ,reverseOperations: function() { + ,reverseOperations() { for (var i = 0; i < this._operations.length; i++) { var op = this._operations[i]; var row = op.row; @@ -925,7 +925,7 @@ Model.implement({ this._refreshRowIndexes(0); } - ,_resetOperations: function() { + ,_resetOperations() { this._operations = []; this._operationsMap = {}; } @@ -933,7 +933,7 @@ Model.implement({ /* * Function used to sort the model ascending. */ - ,sortFunctionAsc: function(column, a, b) { + ,sortFunctionAsc(column, a, b) { if (a[column] < b[column]) return -1; else if (a[column] > b[column]) @@ -945,7 +945,7 @@ Model.implement({ /* * Function used to sort the model descending. */ - ,sortFunctionDesc: function(column, a, b) { + ,sortFunctionDesc(column, a, b) { if (a[column] > b[column]) return -1; else if (a[column] < b[column]) @@ -960,7 +960,7 @@ Model.implement({ * @param {integer} columnName The column name * @param {SortWay} way The sort way */ - ,sortByName: function(columnName, way) { + ,sortByName(columnName, way) { this._requestedSortIndex = -1; this._requestedSortName = columnName; @@ -974,7 +974,7 @@ Model.implement({ * @param {integer} column The column index * @param {SortWay} way The sort way */ - ,sort: function(column, way) { + ,sort(column, way) { this._requestedSortIndex = column; this._requestedSortName = null; @@ -984,13 +984,13 @@ Model.implement({ this._sort(columnName, way); } - ,_sort: function(column, way) { + ,_sort(column, way) { this._setStatus(Status.LOADING); this._realSort(column, way); this._setStatus(Status.READY); } - ,_realSort: function(column, way) { + ,_realSort(column, way) { if (column !== this._sortColumn) { if (way === SortWay.DESC) var sortFunction = this.sortFunctionDesc; @@ -1016,14 +1016,14 @@ Model.implement({ * * @param {String} column The column name */ - ,indexColumn: function(column) { + ,indexColumn(column) { this._requestedIndexes[column] = true; if (this._status === Status.READY) this._buildIndex(column); } - ,_buildIndex: function(columnName) { + ,_buildIndex(columnName) { if (this.checkColName(columnName)) { var index = {}; var data = this.data; @@ -1054,7 +1054,7 @@ Model.implement({ * @param {Object} value The value to search * @return {integer} The column index */ - ,search: function(columnName, value) { + ,search(columnName, value) { if (!this.checkColName(columnName)) return -1; @@ -1116,18 +1116,18 @@ Model.implement({ * @param {Object} value The value to search * @return {integer} The column index */ - ,searchByIndex: function(columnIndex, value) { + ,searchByIndex(columnIndex, value) { var columnName = this.getColumnName(columnIndex); return this.search(columnName, value); } - ,_setStatus: function(status) { + ,_setStatus(status) { this._status = status; this.emit('status-changed', status); this.emit('status-changed-after', status); } - ,_createTarget: function(tableIndex) { + ,_createTarget(tableIndex) { var table = this.tables[tableIndex]; return new Sql.Table({ @@ -1136,7 +1136,7 @@ Model.implement({ }); } - ,_createWhere: function(tableIndex, op, useOldValues) { + ,_createWhere(tableIndex, op, useOldValues) { const where = new Sql.Operation({type: Sql.Operation.Type.AND}); const pks = this.tables[tableIndex].pks; @@ -1169,7 +1169,7 @@ Model.implement({ return where; } - ,_createOperation: function(rowIndex) { + ,_createOperation(rowIndex) { var op = this._operationsMap[rowIndex]; if (!op) { @@ -1199,7 +1199,7 @@ Model.implement({ * @param {Array} pks Array with the names of primary keys * @param {String} ai The autoincrement column name */ - ,setInfo: function(table, orgname, schema, pks, ai) { + ,setInfo(table, orgname, schema, pks, ai) { if (!this.tableInfo) this.tableInfo = {}; @@ -1213,7 +1213,7 @@ Model.implement({ this._repairColumns(); } - ,_repairColumns: function() { + ,_repairColumns() { // Repairs wrong table info if (this.tableInfo && this.tables) diff --git a/js/db/query.js b/js/db/query.js index 95685a25..fb55d4db 100644 --- a/js/db/query.js +++ b/js/db/query.js @@ -10,11 +10,11 @@ module.exports = new Class({ */ conn: { type: Connection - ,set: function(x) { + ,set(x) { this._conn = x; this.onChange(); } - ,get: function() { + ,get() { return this._conn; } }, @@ -23,11 +23,11 @@ module.exports = new Class({ */ query: { type: String - ,set: function(x) { + ,set(x) { this._stmt = new Sql.String({query: x}); this.onChange(); } - ,get: function() { + ,get() { return this._stmt.render(null); } }, @@ -36,11 +36,11 @@ module.exports = new Class({ */ stmt: { type: Sql.Stmt - ,set: function(x) { + ,set(x) { this._stmt = x; this.onChange(); } - ,get: function() { + ,get() { return this._stmt; } }, @@ -49,11 +49,11 @@ module.exports = new Class({ */ lot: { type: Vn.LotIface - ,set: function(x) { + ,set(x) { this.link({_lot: x}, {'change': this.onChange}); this.onChange(); } - ,get: function() { + ,get() { return this._lot; } }, @@ -66,12 +66,12 @@ module.exports = new Class({ } } - ,appendChild: function(child) { + ,appendChild(child) { if (child.nodeType === Node.TEXT_NODE) this.query = child.textContent; } - ,loadXml: function(builder, node) { + ,loadXml(builder, node) { Vn.Object.prototype.loadXml.call(this, builder, node); var query = node.firstChild.nodeValue; @@ -80,16 +80,16 @@ module.exports = new Class({ this.query = query; } - ,execute: function() { + ,execute() { this._conn.execStmt(this._stmt, this.onQueryDone.bind(this), this._lot); } - ,onQueryDone: function(resultSet) { + ,onQueryDone(resultSet) { this.emit('ready', resultSet); } - ,onChange: function() { + ,onChange() { if (this.autoLoad && this._conn && this._stmt && this._lot) this.execute(); } diff --git a/js/db/result-set.js b/js/db/result-set.js index 8d4d4d94..c539ccd2 100644 --- a/js/db/result-set.js +++ b/js/db/result-set.js @@ -11,7 +11,7 @@ module.exports = new Class({ /** * Initilizes the resultset object. */ - ,initialize: function(results, error) { + ,initialize(results, error) { this.results = results; this.error = error; } @@ -21,11 +21,11 @@ module.exports = new Class({ * * @return {Db.Err} the error or null if no errors hapened */ - ,getError: function() { + ,getError() { return this.error; } - ,fetch: function() { + ,fetch() { if (this.error) throw this.error; @@ -41,7 +41,7 @@ module.exports = new Class({ * * @return {Db.Result} the result or %null if error or there are no more results */ - ,fetchResult: function() { + ,fetchResult() { var result = this.fetch(); if (result !== null) { @@ -59,7 +59,7 @@ module.exports = new Class({ * * @return {Array} the row if success, %null otherwise */ - ,fetchObject: function() { + ,fetchObject() { var result = this.fetch(); if (result !== null @@ -75,7 +75,7 @@ module.exports = new Class({ * * @return {Array} the data */ - ,fetchData: function() { + ,fetchData() { var result = this.fetch(); if (result !== null @@ -90,7 +90,7 @@ module.exports = new Class({ * * @return {Object} the value if success, %null otherwise */ - ,fetchValue: function() { + ,fetchValue() { var row = this.fetchRow(); if (row instanceof Array && row.length > 0) @@ -104,7 +104,7 @@ module.exports = new Class({ * * @return {Array} the row if success, %null otherwise */ - ,fetchRow: function() { + ,fetchRow() { var result = this.fetch(); if (result !== null diff --git a/js/db/result.js b/js/db/result.js index b8395ba1..fc4bfb8a 100644 --- a/js/db/result.js +++ b/js/db/result.js @@ -5,7 +5,7 @@ module.exports = new Class({ /** * Initilizes the result object. */ - initialize: function(result) { + initialize(result) { this.data = result.data; this.tables = result.tables; this.columns = result.columns; @@ -29,7 +29,7 @@ module.exports = new Class({ * @param {String} columnName The column name * @return {Object} The cell value */ - ,get: function(columnName) { + ,get(columnName) { return this.data[this.row][columnName]; } @@ -38,21 +38,21 @@ module.exports = new Class({ * * @return {Object} The cell value */ - ,getObject: function() { + ,getObject() { return this.data[this.row]; } /** * Resets the result iterator. */ - ,reset: function() { + ,reset() { this.row = -1; } /** * Moves the internal iterator to the next row. */ - ,next: function() { + ,next() { this.row++; if (this.row >= this.data.length) diff --git a/js/db/simple-iterator.js b/js/db/simple-iterator.js index 564e207e..52bde2bc 100644 --- a/js/db/simple-iterator.js +++ b/js/db/simple-iterator.js @@ -14,10 +14,10 @@ module.exports = new Class({ */ model: { type: Model - ,set: function(x) { + ,set(x) { this._model = x; } - ,get: function() { + ,get() { return this._model; } }, @@ -26,10 +26,10 @@ module.exports = new Class({ */ row: { type: Number - ,set: function(x) { + ,set(x) { this._row = x; } - ,get: function() { + ,get() { return this._row; } }, @@ -38,7 +38,7 @@ module.exports = new Class({ */ numRows: { type: Number - ,get: function() { + ,get() { if (this._model) return this._model.numRows; @@ -50,7 +50,7 @@ module.exports = new Class({ */ ready: { type: Boolean - ,get: function() { + ,get() { if (this._model) return this._model.ready; @@ -62,7 +62,7 @@ module.exports = new Class({ */ $: { type: Object - ,get: function() { + ,get() { return this._model.getObject(this._row); } } diff --git a/js/hedera/app.js b/js/hedera/app.js index 0c325c4a..0250f6eb 100644 --- a/js/hedera/app.js +++ b/js/hedera/app.js @@ -7,13 +7,13 @@ module.exports = new Class({ Properties: { conn: { type: Db.Connection - ,get: function() { + ,get() { return this._conn; } } } - ,initialize: function() { + ,initialize() { window.onerror = this._onWindowError.bind(this); window.onunload = this._onWindowUnload.bind(this); this._hash = new Vn.Hash({window: window}); @@ -24,7 +24,7 @@ module.exports = new Class({ this.initAutoLogin(); } - ,run: function() { + ,run() { if (this.tryAutoLogin()) return; @@ -36,7 +36,7 @@ module.exports = new Class({ login.show(); } - ,_onLogin: function() { + ,_onLogin() { this._freeLogin(); if (this._gui) @@ -50,24 +50,24 @@ module.exports = new Class({ gui.show(); } - ,_onLogout: function() { + ,_onLogout() { this.clearAutoLogin(); this._freeGui(); this.run(); } - ,_onWindowUnload: function() { + ,_onWindowUnload() { this.unref(); } - ,_onWindowError: function(message, file, line) { + ,_onWindowError(message, file, line) { var error = new Error(message); error.fileName = file; error.lineNumber = line; this._notifyError(error); } - ,_onConnError: function(conn, error) { + ,_onConnError(conn, error) { if (error instanceof Vn.JsonException) { if (error.message) Htk.Toast.showError(error.message); @@ -109,12 +109,12 @@ module.exports = new Class({ } } - ,_logout: function() { + ,_logout() { if (this._gui) this._gui.logout(); } - ,_newVersion: function() { + ,_newVersion() { if (this.ignoreVersion) return; @@ -129,11 +129,11 @@ module.exports = new Class({ dialog.open(); } - ,_onNewVersionResponse: function() { + ,_onNewVersionResponse() { location.reload(); } - ,_notifyError: function(error) { + ,_notifyError(error) { Htk.Toast.showError(_('Something went wrong')); var params = { @@ -147,7 +147,7 @@ module.exports = new Class({ this._conn.send('core/log', params); } - ,_freeLogin: function() { + ,_freeLogin() { if (this._login) { this._login.disconnectByInstance(this); this._login.hide(); @@ -156,7 +156,7 @@ module.exports = new Class({ } } - ,_freeGui: function() { + ,_freeGui() { if (this._gui) { this._gui.disconnectByInstance(this); this._gui.hide(); @@ -165,7 +165,7 @@ module.exports = new Class({ } } - ,_destroy: function() { + ,_destroy() { this._freeLogin(); this._freeGui(); this.deinitAutoLogin(); @@ -177,7 +177,7 @@ module.exports = new Class({ ,_firstLogin: true - ,initAutoLogin: function() { + ,initAutoLogin() { var isGuest = new Vn.Param({ lot: this._hash, type: Boolean, @@ -193,22 +193,22 @@ module.exports = new Class({ this.link({_token: token}, {'changed': this._onTokenChange}); } - ,_onGuestChange: function() { + ,_onGuestChange() { if (this._isGuest.value) setTimeout(this.tryAutoLogin.bind(this)); } - ,_onTokenChange: function() { + ,_onTokenChange() { if (this._token.value) setTimeout(this.tryAutoLogin.bind(this)); } - ,deinitAutoLogin: function() { + ,deinitAutoLogin() { this._isGuest.unref(); this._token.unref(); } - ,autoLogin: function() { + ,autoLogin() { var guest = localStorage.getItem('hederaGuest'); if (this._isGuest.value || guest) { @@ -227,7 +227,7 @@ module.exports = new Class({ return false; } - ,tryAutoLogin: function() { + ,tryAutoLogin() { var ok = this.autoLogin(); this._firstLogin = false; @@ -241,7 +241,7 @@ module.exports = new Class({ return true; } - ,clearAutoLogin: function() { + ,clearAutoLogin() { localStorage.removeItem('hederaGuest'); } }); diff --git a/js/hedera/basket-checker.js b/js/hedera/basket-checker.js index 624a76ff..abef361d 100644 --- a/js/hedera/basket-checker.js +++ b/js/hedera/basket-checker.js @@ -1,12 +1,12 @@ module.exports = { - check: function(conn, hash, callback) { + check(conn, hash, callback) { this.hash = hash; conn.execQuery('CALL myBasket_check', this._onBasketCheck.bind(this, callback)); }, - _onBasketCheck: function(callback, resultSet) { + _onBasketCheck(callback, resultSet) { var status = resultSet.fetchValue(); if (!status) diff --git a/js/hedera/form.js b/js/hedera/form.js index 3820714c..57cd961d 100644 --- a/js/hedera/form.js +++ b/js/hedera/form.js @@ -5,13 +5,13 @@ module.exports = new Class({ ,isOpen: false ,uiLoaded: false - ,initialize: function(gui) { + ,initialize(gui) { this.gui = gui; this.conn = gui.conn; this.hash = gui.hash; } - ,loadUi: function() { + ,loadUi() { if (!this.isOpen) return; @@ -53,7 +53,7 @@ module.exports = new Class({ this.uiLoaded = true; } - ,unloadUi: function() { + ,unloadUi() { if (!this.uiLoaded) return; @@ -74,7 +74,7 @@ module.exports = new Class({ /** * Called when the form is opened. */ - ,open: function() { + ,open() { this.close(); this.isOpen = true; this.loadUi(); @@ -83,7 +83,7 @@ module.exports = new Class({ /** * Called when the form is closed. */ - ,close: function() { + ,close() { if (!this.isOpen) return; @@ -94,14 +94,14 @@ module.exports = new Class({ /** * Called when the form is activated. */ - ,activate: function() {} + ,activate() {} /** * Called when the form is deactivated. */ - ,deactivate: function() {} + ,deactivate() {} - ,_destroy: function() { + ,_destroy() { this.close(); Vn.Object.prototype._destroy.call(this); } diff --git a/js/hedera/gui.js b/js/hedera/gui.js index d3633b1c..60e9565a 100644 --- a/js/hedera/gui.js +++ b/js/hedera/gui.js @@ -9,10 +9,10 @@ module.exports = new Class({ Properties: { conn: { type: Db.Connection - ,set: function(x) { + ,set(x) { this.link({_conn: x}, {'loading-changed': this._onConnLoadChange }); } - ,get: function() { + ,get() { return this._conn; } } @@ -29,7 +29,7 @@ module.exports = new Class({ ,_scrollTimeout: null ,_navbarVisible: true - ,initialize: function(props) { + ,initialize(props) { this.loadTemplateFromString(Tpl); this.loadingCount = 0; @@ -51,7 +51,7 @@ module.exports = new Class({ this.loadMenu(); } - ,show: function() { + ,show() { if (this._shown) return; @@ -78,7 +78,7 @@ module.exports = new Class({ this.supplantInit(); } - ,hide: function() { + ,hide() { if (!this._shown) return; @@ -94,26 +94,26 @@ module.exports = new Class({ Vn.Node.remove(this.node); } - ,logout: function() { + ,logout() { this.onLogoutClick(); } - ,onLogoutClick: function() { + ,onLogoutClick() { this._conn.close(this._onConnClose.bind(this)); } - ,_onConnClose: function() { + ,_onConnClose() { this.emit('logout'); } - ,_onConnLoadChange: function(conn, isLoading) { + ,_onConnLoadChange(conn, isLoading) { if (isLoading) this.loaderPush(); else this.loaderPop(); } - ,onMainQueryDone: function(resultSet) { + ,onMainQueryDone(resultSet) { // Retrieving the user name this.user = resultSet.fetchObject(); @@ -165,12 +165,12 @@ module.exports = new Class({ this._onFormChange(); } - ,loadMenu: function() { + ,loadMenu() { var sql = 'SELECT * FROM myMenu'; this._conn.execQuery(sql, this._onMenuLoad.bind(this)); } - ,_onMenuLoad: function(resultSet) { + ,_onMenuLoad(resultSet) { // Retrieving menu sections var res = resultSet.fetchData(); @@ -192,7 +192,7 @@ module.exports = new Class({ //++++++++++++++++++++++++++++++++++++++++++++++++++++++ Menu - ,createMenu: function(res, sectionMap, parent, ul) { + ,createMenu(res, sectionMap, parent, ul) { var sections = sectionMap[parent]; if (!sections) return; @@ -232,7 +232,7 @@ module.exports = new Class({ } } - ,_onLiMouseHover: function(submenu, parent) { + ,_onLiMouseHover(submenu, parent) { if (this.menuShown) return; @@ -245,11 +245,11 @@ module.exports = new Class({ submenu.style.top = rect.top +'px'; } - ,_onLiMouseOut: function() { + ,_onLiMouseOut() { this.timeout = setTimeout(this.hideSubmenu.bind(this), 160); } - ,hideSubmenu: function() { + ,hideSubmenu() { var submenu = this.activeSubmenu; if (submenu) { @@ -267,7 +267,7 @@ module.exports = new Class({ this.showMenu(); } - ,showMenu: function() { + ,showMenu() { this.showBackground(); Vn.Node.addClass(this.$.leftPanel, 'show'); this.menuShown = true; @@ -276,7 +276,7 @@ module.exports = new Class({ this.doc.addEventListener('click', this.hideMenuCallback); } - ,hideMenu: function() { + ,hideMenu() { if (!this.menuShown) return; @@ -290,13 +290,13 @@ module.exports = new Class({ //++++++++++++++++++++++++++++++++++++++++++++++++++++++ Navigation bar - ,_onScroll: function() { + ,_onScroll() { if (this._scrollTimeout === null) this._scrollTimeout = setTimeout( this._scrollTimeoutFunc.bind(this), 150); } - ,_scrollTimeoutFunc: function() { + ,_scrollTimeoutFunc() { if (!this._shown) return; @@ -321,24 +321,24 @@ module.exports = new Class({ //++++++++++++++++++++++++++++++++++++++++++++++++++++++ Background - ,showBackground: function() { + ,showBackground() { Vn.Node.addClass(this.$.background, 'show'); } - ,hideBackground: function() { + ,hideBackground() { Vn.Node.removeClass(this.$.background, 'show'); } //++++++++++++++++++++++++++++++++++++++++++++++++++++++ Spinner - ,loaderPush: function() { + ,loaderPush() { this.loadingCount++; if (this.loadingCount == 1) this.$.loader.start(); } - ,loaderPop: function() { + ,loaderPop() { if (this.loadingCount == 0) return; @@ -392,7 +392,7 @@ module.exports = new Class({ return fn ? fn() : null; } - ,setForm: function(form) { + ,setForm(form) { const holder = this.$.formHolder; Vn.Node.removeChilds(holder); @@ -403,7 +403,7 @@ module.exports = new Class({ } } - ,_onSetFormTimeout: function() { + ,_onSetFormTimeout() { const holder = this.$.formHolder; holder.classList.remove('move-start'); holder.classList.add('move-end'); @@ -413,21 +413,21 @@ module.exports = new Class({ ); } - ,setTitle: function(title) { + ,setTitle(title) { Vn.Node.removeChilds(this.$.title); if (title) this.$.title.appendChild(title); } - ,setActions: function(actions) { + ,setActions(actions) { Vn.Node.removeChilds(this.$.actionBar); if (actions) this.$.actionBar.appendChild(actions); } - ,closeForm: function() { + ,closeForm() { if (this.activeForm) { Vn.Node.removeClass(this.$.formHolder, 'show'); this.activeForm.close(); @@ -448,14 +448,14 @@ module.exports = new Class({ //++++++++++++++++++++++++++++++++++++++++++++++++++++++ Reports - ,openReport: function(reportName, lot) { + ,openReport(reportName, lot) { this.loaderPush(); var module = new Module('reports', reportName); module.addCallback(this._onReportLoad.bind(this, lot)); } - ,_onReportLoad: function(lot, module) { + ,_onReportLoad(lot, module) { this.loaderPop(); if (module.error) { @@ -469,19 +469,19 @@ module.exports = new Class({ //++++++++++++++++++++++++++++++++++++++++++++++++++++++ Supplant - ,supplantInit: function() { + ,supplantInit() { var user = sessionStorage.getItem('supplantUser'); if (user != null) this.supplantUser(user); } - ,supplantUser: function(user, callback) { + ,supplantUser(user, callback) { this._conn.supplantUser(user, this._onUserSupplant.bind(this, callback, user)); } - ,_onUserSupplant: function(callback, user, supplantOk, err) { + ,_onUserSupplant(callback, user, supplantOk, err) { if (err) throw err; sessionStorage.setItem('supplantUser', user); @@ -494,13 +494,13 @@ module.exports = new Class({ callback(); } - ,_onSupplantName: function(resultSet) { + ,_onSupplantName(resultSet) { var userName = resultSet.fetchValue(); Vn.Node.setText(this.$.supplanted, userName); this.$.supplant.classList.toggle('show', true); } - ,onSupplantExitClick: function() { + ,onSupplantExitClick() { this.$.supplant.classList.toggle('show', false); this._conn.supplantEnd(); sessionStorage.removeItem('supplantUser', @@ -511,7 +511,7 @@ module.exports = new Class({ //++++++++++++++++++++++++++++++++++++++++++++++++++++++ Destroy - ,_destroy: function() { + ,_destroy() { this.hide(); Vn.Component.prototype.initialize.call(this); } diff --git a/js/hedera/login.js b/js/hedera/login.js index 1f3bdeb1..189c3a37 100644 --- a/js/hedera/login.js +++ b/js/hedera/login.js @@ -8,16 +8,16 @@ module.exports = new Class({ conn: { type: Db.Connection - ,set: function(x) { + ,set(x) { this.link({_conn: x}, {'loading-changed': this._onConnLoadChange}); } - ,get: function() { + ,get() { return this._conn; } } } - ,initialize: function(props) { + ,initialize(props) { Vn.Component.prototype.initialize.call(this, props); this.loadTemplateFromString(Tpl); @@ -30,14 +30,14 @@ module.exports = new Class({ }; } - ,_onConnLoadChange: function(conn, isLoading) { + ,_onConnLoadChange(conn, isLoading) { if (isLoading) this.$.spinner.start(); else this.$.spinner.stop(); } - ,show: function() { + ,show() { document.body.appendChild(this.node); var lastUser = localStorage.getItem('hederaLastUser'); @@ -48,7 +48,7 @@ module.exports = new Class({ this._focusUserInput(); } - ,_onSubmit: function() { + ,_onSubmit() { this._conn.open( this.$.user.value, this.$.pass.value, @@ -58,7 +58,7 @@ module.exports = new Class({ this._disableUi(true); } - ,_onConnOpen: function(conn, success, error) { + ,_onConnOpen(conn, success, error) { this.$.pass.value = ''; this._disableUi(false); @@ -75,23 +75,23 @@ module.exports = new Class({ } } - ,hide: function() { + ,hide() { Vn.Node.remove(this.node); } - ,_focusUserInput: function() { + ,_focusUserInput() { var userEntry = this.$.user; userEntry.focus(); userEntry.select(); } - ,_disableUi: function(disabled) { + ,_disableUi(disabled) { this.$.user.disabled = disabled; this.$.pass.disabled = disabled; this.$.submit.disabled = disabled; } - ,onPasswordLost: function() { + ,onPasswordLost() { var user = this.$.user.value; if (!user) @@ -101,7 +101,7 @@ module.exports = new Class({ this._onPasswordRecovered.bind(this)); } - ,_onPasswordRecovered: function(json, error) { + ,_onPasswordRecovered(json, error) { if (error) throw error; diff --git a/js/hedera/module.js b/js/hedera/module.js index 6961ef61..66c32a63 100644 --- a/js/hedera/module.js +++ b/js/hedera/module.js @@ -10,7 +10,7 @@ module.exports = new Class({ ,error: false ,ready: false - ,initialize: function(basePath, path) { + ,initialize(basePath, path) { var absPath = basePath +'/'+ path; var aux = path.split('/'); @@ -28,31 +28,31 @@ module.exports = new Class({ this.moduleName = moduleName; } - ,addCallback: function(callback) { + ,addCallback(callback) { if (!this.ready) this.callbacks.push(callback); else callback(this); } - ,onLocaleReady: function() { + ,onLocaleReady() { this.localeReady = true; this.onReady(); } - ,onJsReady: function(success) { + ,onJsReady(success) { this.jsReady = true; this.error = !success; this.onReady(); } - ,onUiReady: function(success) { + ,onUiReady(success) { this.uiReady = true; this.error = !success; this.onReady(); } - ,onReady: function() { + ,onReady() { if (!(this.localeReady && this.jsReady && this.uiReady)) return; @@ -74,7 +74,7 @@ module.exports = new Class({ callbacks[i](this); } - ,toCamelCase: function(dashedName) { + ,toCamelCase(dashedName) { var camelCase = dashedName.charAt(0).toUpperCase(); camelCase += dashedName.substr(1).replace(/\w-\w/g, function(token) { return token.charAt(0) + token.charAt(2).toUpperCase(); diff --git a/js/hedera/report.js b/js/hedera/report.js index c0221059..549da1d0 100644 --- a/js/hedera/report.js +++ b/js/hedera/report.js @@ -2,23 +2,23 @@ module.exports = new Class({ Extends: Vn.Object - ,initialize: function(moduleInfo, gui) { + ,initialize(moduleInfo, gui) { this.info = moduleInfo; this.gui = gui; this.conn = gui.conn; Vn.Object.prototype.initialize.call(this); } - ,open: function(lot) { + ,open(lot) { this.lot = lot; this.createWindow(); } - ,print: function() { + ,print() { this.window.print(); } - ,includeCss: function(path) { + ,includeCss(path) { var basePath = location.protocol +'//'+ location.host; basePath += location.port ? ':'+ location.port : ''; basePath += location.pathname.substring(0, @@ -33,7 +33,7 @@ module.exports = new Class({ head.appendChild(link); } - ,createWindow: function() { + ,createWindow() { var reportWindow = window.open( 'js/hedera/report.html', '_blank', 'height=650, width=950, resizable=yes, fullscreen=no,'+ @@ -52,7 +52,7 @@ module.exports = new Class({ return true; } - ,_onWindowLoad: function() { + ,_onWindowLoad() { this.doc = this.window.document this.includeCss('reports/'+ this.info.path +'/style.css'); @@ -64,7 +64,7 @@ module.exports = new Class({ this.onWindowCreate(); } - ,onWindowCreate: function() { + ,onWindowCreate() { var builder = new Vn.Builder(); builder.compileFile('reports/'+ this.info.path +'/ui.xml'); diff --git a/js/hedera/social-bar.js b/js/hedera/social-bar.js index b70bf398..5e69e00e 100644 --- a/js/hedera/social-bar.js +++ b/js/hedera/social-bar.js @@ -6,21 +6,21 @@ module.exports = new Class({ ,Properties: { conn: { type: Db.Connection - ,set: function(x) { + ,set(x) { this._conn = x; this._refresh(); } - ,get: function() { + ,get() { return this._conn; } }, priority: { type: Number - ,set: function(x) { + ,set(x) { this._priority = x; this._refresh(); } - ,get: function() { + ,get() { return this._priority; } } @@ -28,12 +28,12 @@ module.exports = new Class({ ,_priority: 0 - ,initialize: function() { + ,initialize() { var node = this.createRoot('div'); node.className = 'htk-social-bar'; } - ,_refresh: function() { + ,_refresh() { if (!this._conn || this._priority === null) return; @@ -44,7 +44,7 @@ module.exports = new Class({ this._conn.execQuery(query, this._onQueryDone.bind(this), params); } - ,_onQueryDone: function(resultSet) { + ,_onQueryDone(resultSet) { Vn.Node.removeChilds(this._node); var res = resultSet.fetchResult(); diff --git a/js/hedera/tpv.js b/js/hedera/tpv.js index 19c4567a..a1b42ab2 100644 --- a/js/hedera/tpv.js +++ b/js/hedera/tpv.js @@ -5,7 +5,7 @@ module.exports = new Class({ ,tpvOrder: null ,tpvStatus: null - ,check: function(callback) { + ,check(callback) { this.tpvOrder = this.hash.$.tpvOrder; this.tpvStatus = this.hash.$.tpvStatus; @@ -22,11 +22,11 @@ module.exports = new Class({ callback(this, this.tpvOrder, this.tpvStatus); } - ,pay: function(amount, company) { + ,pay(amount, company) { this._realPay(amount * 100, company); } - ,_realPay: function(amount, company) { + ,_realPay(amount, company) { if (isNumeric(amount) && amount > 0) { const params = { amount: parseInt(amount) @@ -41,7 +41,7 @@ module.exports = new Class({ Htk.Toast.showError(_('AmountError')); } - ,_onTransactionStart: function(json) { + ,_onTransactionStart(json) { if (json) { const postValues = json.postValues; @@ -65,7 +65,7 @@ module.exports = new Class({ Htk.Toast.showWarning(_('PayError')); } - ,retryPay: function() { + ,retryPay() { const params = {transaction: parseInt(this.tpvOrder)}; const query = 'SELECT t.amount, m.companyFk ' @@ -76,7 +76,7 @@ module.exports = new Class({ this._onRetryPayDone.bind(this), params); } - ,_onRetryPayDone: function(resultSet) { + ,_onRetryPayDone(resultSet) { const res = resultSet.fetchObject(); if (res) @@ -85,7 +85,7 @@ module.exports = new Class({ Htk.Toast.showError(_('AmountError')); } - ,_makeUrl: function(status) { + ,_makeUrl(status) { let path = location.protocol +'//'+ location.hostname; path += location.port ? ':'+ location.port : ''; path += location.pathname; diff --git a/js/htk/assistant-bar/index.js b/js/htk/assistant-bar/index.js index dbcc2ddf..aac2059a 100644 --- a/js/htk/assistant-bar/index.js +++ b/js/htk/assistant-bar/index.js @@ -8,26 +8,26 @@ module.exports = new Class({ Properties: { assistant: { type: Assistant, - set: function(x) { + set(x) { this.link({_assistant: x}, { 'step-change': this.onStepChange, 'steps-change': this.onStepsChange }); this.onStepsChange(); }, - get: function() { + get() { return this._assistant; } }, disabled: { type: Boolean, - set: function(x) { + set(x) { this._disabled = x; this._previousButton.disabled = x; this._nextButton.disabled = x; this._endButton.disabled = x; }, - get: function() { + get() { return this._disabled; } } @@ -37,7 +37,7 @@ module.exports = new Class({ _stepIndex: -1, _disabled: false, - render: function() { + render() { var node = this.createRoot('div'); var previousButton = new Htk.Button({ @@ -74,27 +74,27 @@ module.exports = new Class({ this._endButton = endButton; }, - movePrevious: function() { + movePrevious() { if (this._assistant) this._assistant.movePrevious(); }, - moveNext: function() { + moveNext() { if (this._assistant) this._assistant.moveNext(); }, - end: function() { + end() { if (this._assistant) this._assistant.end(); }, - setStep: function(stepIndex) { + setStep(stepIndex) { if (this._assistant) this._assistant.setStep(stepIndex); }, - onStepsChange: function() { + onStepsChange() { var stepCount = this._assistant.stepCount; var steps = this._steps; @@ -110,7 +110,7 @@ module.exports = new Class({ this.onStepChange(); }, - onStepChange: function() { + onStepChange() { var childs = this._steps.childNodes; var stepCount = childs ? childs.length : 0; var stepIndex = this._assistant ? this._assistant.step : -1; diff --git a/js/htk/assistant/index.js b/js/htk/assistant/index.js index 486f781a..79e4dc50 100644 --- a/js/htk/assistant/index.js +++ b/js/htk/assistant/index.js @@ -15,10 +15,10 @@ module.exports = new Class({ */ step: { type: Number, - set: function(x) { + set(x) { this.setStep(x); }, - get: function() { + get() { return this._stepIndex; } }, @@ -27,10 +27,10 @@ module.exports = new Class({ */ stepName: { type: String, - set: function(x) { + set(x) { this.setStepByName(x); }, - get: function() { + get() { return this._stepName; } }, @@ -39,12 +39,12 @@ module.exports = new Class({ */ stepsIndex: { type: Array, - set: function(x) { + set(x) { this._stepsIndex = x; this.setStep(this._stepIndex); this.emit('steps-change'); }, - get: function() { + get() { return this._stepsIndex; } }, @@ -53,7 +53,7 @@ module.exports = new Class({ */ stepCount: { type: Number, - get: function() { + get() { if (this._stepsIndex) return this._stepsIndex.length; return 0; @@ -80,12 +80,12 @@ module.exports = new Class({ _stepName: null, steps: {}, - initialize: function(props) { + initialize(props) { Component.prototype.initialize.call(this, props); this.createRoot('div'); }, - appendChild: function(step) { + appendChild(step) { if (!(step instanceof Step)) throw new Error('Invalid child for assistant'); @@ -93,12 +93,12 @@ module.exports = new Class({ this.steps[step.name] = step; }, - setStepByName: function(stepName) { + setStepByName(stepName) { if (this._stepsIndex) this.setStep(this._stepsIndex.indexOf(stepName)); }, - setStep: function(stepIndex) { + setStep(stepIndex) { if ((this.currentStep && stepIndex == this._stepIndex) || !this._stepsIndex || !(stepIndex >= -1 && stepIndex < this._stepsIndex.length)) @@ -140,21 +140,21 @@ module.exports = new Class({ /** * Moves the assistant to the previous step. */ - movePrevious: function() { + movePrevious() { this.setStep(this._stepIndex - 1); }, /** * Moves the assistant to the next step. */ - moveNext: function() { + moveNext() { this.setStep(this._stepIndex + 1); }, /** * Ends the assistant. If defined, the stepFunc will be called. */ - end: function() { + end() { if (this.endFunc) this.endFunc(); } diff --git a/js/htk/button/index.js b/js/htk/button/index.js index bba8e449..783a6577 100644 --- a/js/htk/button/index.js +++ b/js/htk/button/index.js @@ -6,33 +6,33 @@ module.exports = new Class({ ,Properties: { image: { type: String - ,set: function(x) { + ,set(x) { this.iconNode.name = x; } }, icon: { type: String - ,set: function(x) { + ,set(x) { this.iconNode.name = x; } }, tip: { type: String - ,set: function(x) { + ,set(x) { this.node.title = x ? _(x) : ''; this.renderContent(); } - ,get: function() { + ,get() { return this.node.title; } }, showText: { type: Boolean - ,set: function(x) { + ,set(x) { this._showText = x; this.renderContent(); } - ,get: function() { + ,get() { return this._showText; } } @@ -40,14 +40,14 @@ module.exports = new Class({ ,_showText: false - ,render: function() { + ,render() { var node = this.createRoot('button'); this.iconNode = new Htk.Icon(); node.appendChild(this.iconNode.node); } - ,renderContent: function() { + ,renderContent() { if (this._textNode) Vn.Node.remove(this._textNode); diff --git a/js/htk/calendar/index.js b/js/htk/calendar/index.js index aeaeb569..24f757ef 100644 --- a/js/htk/calendar/index.js +++ b/js/htk/calendar/index.js @@ -6,10 +6,10 @@ module.exports = new Class({ ,Properties: { restrictFunc: { type: Function - ,set: function(x) { + ,set(x) { this._restrictFunc = x; } - ,get: function() { + ,get() { return this._restrictFunc; } } @@ -20,7 +20,7 @@ module.exports = new Class({ ,year: null ,month: null - ,render: function() { + ,render() { this.createRoot('div'); var table = this.createElement('table'); @@ -113,7 +113,7 @@ module.exports = new Class({ this.goToCurrentMonth(); } - ,getMonthDays: function() { + ,getMonthDays() { if (this.month > 6) return (this.month % 2 != 0) ? 31 : 30; else if (this.month != 1) @@ -122,7 +122,7 @@ module.exports = new Class({ return (this.year % 4 != 0) ? 28 : 29; } - ,goToMonth: function(year, month) { + ,goToMonth(year, month) { if (year) this.year = year; if (!isNaN(month)) @@ -131,7 +131,7 @@ module.exports = new Class({ this.refresh(); } - ,goToSelectedMonth: function() { + ,goToSelectedMonth() { var date = this._value; if (date instanceof Date) @@ -140,12 +140,12 @@ module.exports = new Class({ this.goToCurrentMonth(); } - ,goToCurrentMonth: function() { + ,goToCurrentMonth() { var date = new Date(); this.goToMonth(date.getFullYear(), date.getMonth()); } - ,refresh: function() { + ,refresh() { Vn.Node.setText(this.yearNode, this.year); Vn.Node.setText(this.monthNode, _(Vn.Date.Months[this.month])); @@ -199,7 +199,7 @@ module.exports = new Class({ this.selectCell(-1); } - ,selectCell: function(cellIndex) { + ,selectCell(cellIndex) { if (this.selectedCell != -1) { var node = this.cells[this.selectedCell].node; Vn.Node.removeClass(node, 'selected'); @@ -212,11 +212,11 @@ module.exports = new Class({ this.selectedCell = cellIndex; } - ,putValue: function() { + ,putValue() { this.goToSelectedMonth(); } - ,dayClicked: function(td, cellIndex) { + ,dayClicked(td, cellIndex) { var cell = this.cells[cellIndex]; if (cell.enabled) { @@ -241,7 +241,7 @@ module.exports = new Class({ } } - ,prevMonthClicked: function() { + ,prevMonthClicked() { if (this.month > 0) this.month--; else { @@ -252,7 +252,7 @@ module.exports = new Class({ this.refresh(); } - ,nextMonthClicked: function() { + ,nextMonthClicked() { if (this.month < 11) this.month++; else { diff --git a/js/htk/check/index.js b/js/htk/check/index.js index 56d4f8e8..404f3504 100644 --- a/js/htk/check/index.js +++ b/js/htk/check/index.js @@ -3,24 +3,24 @@ module.exports = new Class({ Extends: Htk.Field ,Tag: 'htk-check' - ,render: function() { + ,render() { var node = this.createRoot('input'); node.type = 'checkbox'; node.addEventListener('change', this.changed.bind(this)); } - ,changed: function() { + ,changed() { this.valueChanged(this.node.checked); } - ,putValue: function(value) { + ,putValue(value) { if (value) this.node.checked = true; else this.node.checked = false; } - ,setEditable: function(editable) { + ,setEditable(editable) { this.node.disabled = !editable; } }); diff --git a/js/htk/column/index.js b/js/htk/column/index.js index e5f9385b..a53066e4 100644 --- a/js/htk/column/index.js +++ b/js/htk/column/index.js @@ -35,7 +35,7 @@ module.exports = new Class({ }, class: { type: String - ,set: function(x) { + ,set(x) { this._userCssClass = x; if (this._cssClass) @@ -43,7 +43,7 @@ module.exports = new Class({ else this._cssClass = x; } - ,get: function() { + ,get() { return this._userCssClass; } } @@ -55,12 +55,12 @@ module.exports = new Class({ /** * Initializes the column. */ - ,initialize: function(props) { + ,initialize(props) { NodeBuilder.prototype.initialize.call(this, props); this.td = this.createElement('td'); } - ,renderHeader: function() { + ,renderHeader() { var th = this.createElement('th'); if (this.title) @@ -74,7 +74,7 @@ module.exports = new Class({ * * @return {HTMLTableData} the rendered cell */ - ,render: function() { + ,render() { var td = this.td.cloneNode(true); if (this._cssClass) @@ -83,12 +83,12 @@ module.exports = new Class({ return td; } - ,updateColumnName: function(model) { + ,updateColumnName(model) { if (this.columnIndex !== -1) this.column = model.getColumnName(this.columnIndex); } - ,changed: function(tr, newValue) { + ,changed(tr, newValue) { this.emit('changed', tr.rowIndex - 1, newValue); } }); diff --git a/js/htk/columns/button/index.js b/js/htk/columns/button/index.js index 552a39e5..e2cbca4f 100644 --- a/js/htk/columns/button/index.js +++ b/js/htk/columns/button/index.js @@ -10,10 +10,10 @@ module.exports = new Class({ }, icon: { type: String - ,set: function(x) { + ,set(x) { this._icon = x; } - ,get: function() { + ,get() { return this._icon; } }, @@ -35,12 +35,12 @@ module.exports = new Class({ } }, - initialize: function(props) { + initialize(props) { this._cssClass = 'cell-button'; Htk.Column.prototype.initialize.call(this, props); }, - render: function(tr) { + render(tr) { const td = Htk.Column.prototype.render.call(this, tr); let button; @@ -69,7 +69,7 @@ module.exports = new Class({ return td; }, - buttonClicked: function(value, tr, button) { + buttonClicked(value, tr, button) { this.emit('clicked', value, tr.rowIndex - 1, button); } }); diff --git a/js/htk/columns/check/index.js b/js/htk/columns/check/index.js index 0face4d1..b090ea50 100644 --- a/js/htk/columns/check/index.js +++ b/js/htk/columns/check/index.js @@ -4,12 +4,12 @@ module.exports = new Class({ Extends: Htk.Column ,Tag: 'htk-column-check' - ,initialize: function(props) { + ,initialize(props) { this._cssClass = 'cell-check'; Htk.Column.prototype.initialize.call(this, props); } - ,render: function(tr) { + ,render(tr) { var checkButton = this.createElement('input'); checkButton.type = 'checkbox'; checkButton.checked = this.value; @@ -25,7 +25,7 @@ module.exports = new Class({ return td; } - ,inputChanged: function(tr, node) { + ,inputChanged(tr, node) { this.changed(tr, node.value); } }); diff --git a/js/htk/columns/date/index.js b/js/htk/columns/date/index.js index 336573fc..1ef93bc5 100644 --- a/js/htk/columns/date/index.js +++ b/js/htk/columns/date/index.js @@ -11,10 +11,10 @@ module.exports = new Class format: { type: String - ,set: function(x) { + ,set(x) { this._format = _(x); } - ,get: function() { + ,get() { return this._format; } } @@ -22,12 +22,12 @@ module.exports = new Class ,_format: _('%a, %e %b %Y') - ,initialize: function(props) { + ,initialize(props) { this._cssClass = 'cell-date'; Htk.Column.prototype.initialize.call(this, props); } - ,render: function(tr) { + ,render(tr) { var text = Vn.Date.strftime(this.value, this._format); var td = Htk.Column.prototype.render.call(this, tr); diff --git a/js/htk/columns/image/index.js b/js/htk/columns/image/index.js index 3542f238..dd116ee9 100644 --- a/js/htk/columns/image/index.js +++ b/js/htk/columns/image/index.js @@ -33,12 +33,12 @@ module.exports = new Class({ } } - ,initialize: function(props) { + ,initialize(props) { this._cssClass = 'cell-image'; Htk.Column.prototype.initialize.call(this, props); } - ,render: function(tr) { + ,render(tr) { var image = new Htk.Image({ directory: this.directory ,subdir: this.subdir diff --git a/js/htk/columns/link/index.js b/js/htk/columns/link/index.js index 23b44895..0d5fab23 100644 --- a/js/htk/columns/link/index.js +++ b/js/htk/columns/link/index.js @@ -19,7 +19,7 @@ module.exports = new Class({ } } - ,render: function(tr) { + ,render(tr) { var link = this.createElement('a'); link.href = this.href; link.appendChild(this.createTextNode(this.value)); diff --git a/js/htk/columns/radio/index.js b/js/htk/columns/radio/index.js index 29b753e4..f2cff5aa 100644 --- a/js/htk/columns/radio/index.js +++ b/js/htk/columns/radio/index.js @@ -5,19 +5,19 @@ module.exports = new Class({ ,Properties: { param:{ type: Vn.Param - ,set: function(x) { + ,set(x) { this.radioGroup.master = x; } } } - ,initialize: function(props) { + ,initialize(props) { this._cssClass = 'cell-radio'; this.radioGroup = new Htk.RadioGroup(this.doc); Htk.Column.prototype.initialize.call(this, props); } - ,render: function(tr) { + ,render(tr) { var td = Htk.Column.prototype.render.call(this, tr); var radio = this.radioGroup.createButton(this.value); @@ -26,7 +26,7 @@ module.exports = new Class({ return td; } - ,clear: function() { + ,clear() { this.radioGroup.clear(); } }); diff --git a/js/htk/columns/spin/index.js b/js/htk/columns/spin/index.js index 85022c4e..09223409 100644 --- a/js/htk/columns/spin/index.js +++ b/js/htk/columns/spin/index.js @@ -20,18 +20,18 @@ module.exports = new Class({ } } - ,initialize: function(props) { + ,initialize(props) { this._cssClass = 'cell-spin'; Htk.Column.prototype.initialize.call(this, props); } - ,renderHeader: function() { + ,renderHeader() { var th = Htk.Column.prototype.renderHeader.call(this, ); th.className = 'cell-spin'; return th; } - ,render: function(tr) { + ,render(tr) { var td = Htk.Column.prototype.render.call(this, tr); var valueString = null; @@ -58,7 +58,7 @@ module.exports = new Class({ return td; } - ,inputChanged: function(tr, entry) { + ,inputChanged(tr, entry) { this.changed(tr, parseInt(entry.value)); } }); diff --git a/js/htk/columns/text/index.js b/js/htk/columns/text/index.js index 749823c1..b8efa69a 100644 --- a/js/htk/columns/text/index.js +++ b/js/htk/columns/text/index.js @@ -8,10 +8,10 @@ module.exports = new Class({ */ format:{ type: String - ,set: function(x) { + ,set(x) { this._format = _(x); } - ,get: function() { + ,get() { return this._format; } } @@ -19,12 +19,12 @@ module.exports = new Class({ ,_format: null - ,initialize: function(props) { + ,initialize(props) { this._cssClass = 'cell-text'; Htk.Column.prototype.initialize.call(this, props); } - ,render: function(tr) { + ,render(tr) { var node; if (this.editable) { @@ -44,7 +44,7 @@ module.exports = new Class({ return td; } - ,inputChanged: function(tr, node) { + ,inputChanged(tr, node) { this.changed(tr, node.value); } }); diff --git a/js/htk/date-chooser/index.js b/js/htk/date-chooser/index.js index 6c323504..868aaa1c 100644 --- a/js/htk/date-chooser/index.js +++ b/js/htk/date-chooser/index.js @@ -9,7 +9,7 @@ module.exports = new Class({ ,calendar: null ,ignoreCalendarChange: false - ,render: function() { + ,render() { const node = this.createRoot('button'); node.classList.add('input'); node.addEventListener('click', this._onClick.bind(this)); @@ -25,7 +25,7 @@ module.exports = new Class({ this.setEditable(this._editable); } - ,putValue: function(value) { + ,putValue(value) { var dateString; if (value instanceof Date) @@ -36,7 +36,7 @@ module.exports = new Class({ Vn.Node.setText(this.label, dateString); } - ,setEditable: function(editable) { + ,setEditable(editable) { if (this.calendar) { this.calendar.disconnectByInstance(this); this.calendar = null; @@ -50,7 +50,7 @@ module.exports = new Class({ } } - ,_onCalendarChange: function(calendar) { + ,_onCalendarChange(calendar) { if (this.ignoreCalendarChange) return; @@ -61,7 +61,7 @@ module.exports = new Class({ this.valueChanged(newDate); } - ,_onClick: function() { + ,_onClick() { this.ignoreCalendarChange = true; this.calendar.value = this._value; this.calendar.goToSelectedMonth(); diff --git a/js/htk/dialog/index.js b/js/htk/dialog/index.js index 5ac11fd2..bc697810 100644 --- a/js/htk/dialog/index.js +++ b/js/htk/dialog/index.js @@ -57,10 +57,10 @@ Dialog.implement({ message: { type: String - ,set: function(x) { + ,set(x) { this._message = x; } - ,get: function() { + ,get() { return this._message; } } @@ -70,10 +70,10 @@ Dialog.implement({ ,icon: { type: String - ,set: function(x) { + ,set(x) { this._icon = x; } - ,get: function() { + ,get() { return this._icon; } } @@ -83,10 +83,10 @@ Dialog.implement({ ,buttons: { enumType: Button - ,set: function(x) { + ,set(x) { this._buttons = x; } - ,get: function() { + ,get() { return this._buttons; } } @@ -96,7 +96,7 @@ Dialog.implement({ ,_icon: 'info' ,_buttons: Button.ACCEPT - ,open: function() { + ,open() { Popup.prototype.open.call(this); // Dialog body @@ -150,7 +150,7 @@ Dialog.implement({ this.emit('response', response); } - ,createButton: function(label, response) { + ,createButton(label, response) { var button = this.createElement('button'); button.className = 'thin'; button.appendChild(this.createTextNode(label)); diff --git a/js/htk/entry/index.js b/js/htk/entry/index.js index fed77876..e2e0da51 100644 --- a/js/htk/entry/index.js +++ b/js/htk/entry/index.js @@ -9,10 +9,10 @@ module.exports = new Class({ placeholder: { type: String - ,set: function(x) { + ,set(x) { this.node.placeholder = x; } - ,get: function() { + ,get() { return this.node.placeholder; } }, @@ -22,10 +22,10 @@ module.exports = new Class({ disabled: { type: Boolean - ,set: function(x) { + ,set(x) { this.node.disabled = x; } - ,get: function() { + ,get() { return this.node.disabled; } }, @@ -35,22 +35,22 @@ module.exports = new Class({ readonly: { type: Boolean - ,set: function(x) { + ,set(x) { this.node.readonly = x; } - ,get: function() { + ,get() { return this.node.readonly; } } } - ,render: function() { + ,render() { var node = this.createRoot('input'); node.type = 'text'; node.addEventListener('change', this._onChange.bind(this)); } - ,_onChange: function() { + ,_onChange() { var newValue; if (this.node.value == '') @@ -61,14 +61,14 @@ module.exports = new Class({ this.valueChanged(newValue); } - ,putValue: function(value) { + ,putValue(value) { if (!value) this.node.value = ''; else this.node.value = value; } - ,setEditable: function(editable) { + ,setEditable(editable) { this.node.readOnly = !editable; } }); diff --git a/js/htk/field/index.js b/js/htk/field/index.js index aae49706..d8b7102d 100644 --- a/js/htk/field/index.js +++ b/js/htk/field/index.js @@ -9,7 +9,7 @@ module.exports = new Class({ ,Properties: { value: { type: String - ,set: function(x) { + ,set(x) { if (Vn.Value.compare(x, this._value)) return; @@ -20,82 +20,82 @@ module.exports = new Class({ this.putValue(x); this._notifyChanges(); } - ,get: function() { + ,get() { return this._value; } }, param: { type: Vn.ParamIface - ,set: function(x) { + ,set(x) { this._setParam(x); } - ,get: function() { + ,get() { return this._param; } }, lot: { type: Vn.LotIface - ,set: function(x) { + ,set(x) { this._setLot(x); } - ,get: function() { + ,get() { return this._lot; } }, name: { type: String - ,set: function(x) { + ,set(x) { this._setName(x); } - ,get: function() { + ,get() { return this._name; } }, oneWay: { type: Boolean - ,set: function(x) { + ,set(x) { this._oneWay = x; } - ,get: function() { + ,get() { return this._oneWay; } }, oneTime: { type: Boolean - ,set: function(x) { + ,set(x) { this._oneTime = x; } - ,get: function() { + ,get() { return this._oneTime; } }, editable: { type: Boolean - ,set: function(x) { + ,set(x) { if (x != this._editable) { this._editable = x; this.setEditable(x); } } - ,get: function() { + ,get() { return this._editable; } }, form: { type: Db.Iterator - ,set: function(x) { + ,set(x) { this.lot = x; } - ,get: function() { + ,get() { return this._lot; } }, column: { type: String - ,set: function(x) { + ,set(x) { this.name = x; } - ,get: function() { + ,get() { return this._name; } }, @@ -108,7 +108,7 @@ module.exports = new Class({ ,_editable: true ,_lockField: false - ,_setValue: function(newValue) { + ,_setValue(newValue) { if (!this._putValue(newValue)) return; @@ -131,7 +131,7 @@ module.exports = new Class({ * * @param {Boolean} editable Whether the user is allowed to edit the entry */ - ,setEditable: function() {} + ,setEditable() {} /** * Virtual method that must be implemented by class childs to put the value @@ -139,7 +139,7 @@ module.exports = new Class({ * * @param {Object} value The new value for the entry */ - ,putValue: function() {} + ,putValue() {} /** * Protected method that should be called from class childs when the value @@ -147,7 +147,7 @@ module.exports = new Class({ * * @param {Object} value The new entry value */ - ,valueChanged: function(value) { + ,valueChanged(value) { this._lockField = true; this._setValue(value); this._lockField = false; diff --git a/js/htk/full-image/index.js b/js/htk/full-image/index.js index cea3810e..e643fba8 100644 --- a/js/htk/full-image/index.js +++ b/js/htk/full-image/index.js @@ -13,16 +13,16 @@ module.exports = new Class fullDir: { type: String - ,set: function(x) { + ,set(x) { this._fullDir = x; } - ,get: function() { + ,get() { return this._fullDir; } } } - ,show: function(src) { + ,show(src) { var popup = new Popup({class: 'htk-full-image', modal: true}); var img = document.createElement('img'); @@ -43,7 +43,7 @@ module.exports = new Class popup.open(); } - ,_onImageLoad: function(popup, img) { + ,_onImageLoad(popup, img) { var scale = null; var width = img.width; var height = img.height; @@ -70,10 +70,10 @@ module.exports = new Class popup.reset(); } - ,_onImageClick: function(popup) { + ,_onImageClick(popup) { popup.hide(); } - ,_onImageError: function(popup) {} + ,_onImageError(popup) {} }); diff --git a/js/htk/grid/index.js b/js/htk/grid/index.js index 1d7e9c7b..fc11b7e0 100644 --- a/js/htk/grid/index.js +++ b/js/htk/grid/index.js @@ -12,7 +12,7 @@ module.exports = new Class({ */ model: { type: Db.Model - ,set: function(x) { + ,set(x) { this.link({_model: x}, { 'status-changed': this.onModelChange @@ -28,7 +28,7 @@ module.exports = new Class({ this.onUpdatableChange(); this.onModelChange(); } - ,get: function() { + ,get() { return this._model; } }, @@ -44,11 +44,11 @@ module.exports = new Class({ */ showHeader: { type: Boolean - ,set: function(x) { + ,set(x) { this._showHeader = x; this.thead.style.display = x ? 'table-header-group' : 'none'; } - ,get: function() { + ,get() { return this._showHeader; } } @@ -63,7 +63,7 @@ module.exports = new Class({ ,sortWay: null ,_showHeader: true - ,render: function() { + ,render() { var table = this.createRoot('table'); var thead = this.createElement('thead'); @@ -76,16 +76,16 @@ module.exports = new Class({ table.appendChild(this.tbody); } - ,appendChild: function(child) { + ,appendChild(child) { this.appendColumn(child); } - ,removeClicked: function(column, value, row) { + ,removeClicked(column, value, row) { if (confirm(_('ReallyDelete'))) this._model.deleteRow(row); } - ,onRowDelete: function(model, row) { + ,onRowDelete(model, row) { var tableRows = this.tbody.childNodes; this.tbody.removeChild(tableRows[row]); @@ -95,11 +95,11 @@ module.exports = new Class({ this.showNoRecordsFound(); } - ,onRowInsert: function() { + ,onRowInsert() { this.buildRow(1); } - ,renderCell: function(row, column, tr) { + ,renderCell(row, column, tr) { if (column.column) column.value = this._model.data[row][column.column]; @@ -111,7 +111,7 @@ module.exports = new Class({ return column.render(tr); } - ,refreshRow: function(row, columns) { + ,refreshRow(row, columns) { var x = this.columns; var tr = this.tbody.childNodes[row]; @@ -122,11 +122,11 @@ module.exports = new Class({ } } - ,onRowUpdate: function(model, row, columns) { + ,onRowUpdate(model, row, columns) { this.refreshRow(row, columns); } - ,buildRow: function(count) { + ,buildRow(count) { for (var i = 0; i < count; i++) { var tr = this.createElement('tr'); @@ -142,7 +142,7 @@ module.exports = new Class({ } } - ,onUpdatableChange: function() { + ,onUpdatableChange() { if (this._model && this._model.updatable) { if (!this.internalColumn) { this.internalColumn = new Htk.ColumnButton({ @@ -158,7 +158,7 @@ module.exports = new Class({ } } - ,onModelChange: function() { + ,onModelChange() { var emptyMessage = this.emptyMessage ? this.emptyMessage : _('NoData'); @@ -194,12 +194,12 @@ module.exports = new Class({ this._node.appendChild(this.tbody); } - ,showNoRecordsFound: function() { + ,showNoRecordsFound() { if (this._model.numRows == 0) this.showMessage(_('EmptyList'), 'block'); } - ,showMessage: function(message, src) { + ,showMessage(message, src) { if (this.columns.length == 0) return; @@ -226,7 +226,7 @@ module.exports = new Class({ td.appendChild(message); } - ,scrollToRow: function(row) { + ,scrollToRow(row) { if (row >= 0) { var height = parseInt(this.tr.style.height); this.node.scrollTop = (row - 2) * height; @@ -239,7 +239,7 @@ module.exports = new Class({ } } - ,sortModel: function(column) { + ,sortModel(column) { var columnName = column.column; if (this._model && columnName != -1) { @@ -255,14 +255,14 @@ module.exports = new Class({ } } - ,columnChanged: function(column, row, newValue) { + ,columnChanged(column, row, newValue) { var columnName = column.column; if (columnName != -1) this._model.set(row, columnName, newValue); } - ,addColumn: function(pos, column) { + ,addColumn(pos, column) { var header = column.renderHeader(); if (pos == -1 || pos >= this.columns.length) { @@ -290,7 +290,7 @@ module.exports = new Class({ return pos; } - ,insertInternalColumn: function(pos, column) { + ,insertInternalColumn(pos, column) { if (pos < 0 || pos > this.internalColumns) pos = this.internalColumns; @@ -298,18 +298,18 @@ module.exports = new Class({ return this.addColumn(pos, column); } - ,insertColumn: function(pos, column) { + ,insertColumn(pos, column) { if (pos > 0) pos += this.internalColumns; return this.addColumn(pos, column) - this.internalColumns; } - ,appendColumn: function(column) { + ,appendColumn(column) { return this.insertColumn(-1, column); } - ,deleteColumn: function(pos) { + ,deleteColumn(pos) { if (pos < 0 || pos >= this.columns.length) return; @@ -323,7 +323,7 @@ module.exports = new Class({ rows[i].removeChild(rows[i].childNodes[pos]); } - ,removeInternalColumn: function(pos) { + ,removeInternalColumn(pos) { if (this.internalColumns == 0) return; @@ -334,14 +334,14 @@ module.exports = new Class({ this.internalColumns--; } - ,removeColumn: function(pos) { + ,removeColumn(pos) { if (pos > 0) pos += this.internalColumns; this.deleteColumn(pos); } - ,reloadModel: function() { + ,reloadModel() { if (this._model != null) this.onModelChange(); } diff --git a/js/htk/html/index.js b/js/htk/html/index.js index 641d9a46..a08c3efe 100644 --- a/js/htk/html/index.js +++ b/js/htk/html/index.js @@ -4,11 +4,11 @@ module.exports = new Class Extends: Htk.Field ,Tag: 'htk-html' - ,render: function() { + ,render() { this.createRoot('div'); } - ,putValue: function(value) { + ,putValue(value) { this.node.innerHTML = value; } }); diff --git a/js/htk/icon/index.js b/js/htk/icon/index.js index 66735155..72dc2029 100644 --- a/js/htk/icon/index.js +++ b/js/htk/icon/index.js @@ -8,31 +8,31 @@ module.exports = new Class({ { name: { type: String - ,set: function(x) { + ,set(x) { this._icon = x; this._setIcon(); } - ,get: function() { + ,get() { return this._icon; } }, theme: { type: String - ,set: function(x) { + ,set(x) { this._theme = x; this._setIcon(); } - ,get: function() { + ,get() { return this._theme; } }, alt: { type: String - ,set: function(x) { + ,set(x) { this.node.alt = x; } - ,get: function() { + ,get() { return this.node.alt; } } @@ -40,12 +40,12 @@ module.exports = new Class({ ,_icon: null - ,render: function() { + ,render() { const node = this.createRoot('span'); node.classList.add('material-symbols-rounded'); } - ,_setIcon: function() { + ,_setIcon() { this.node.innerText = this._icon; } }); diff --git a/js/htk/image-editor/index.js b/js/htk/image-editor/index.js index 3ba053ae..d646930f 100644 --- a/js/htk/image-editor/index.js +++ b/js/htk/image-editor/index.js @@ -18,7 +18,7 @@ module.exports = new Class({ } }, - initialize: function(props) { + initialize(props) { this.loadTemplateFromString(Tpl); var self = this; @@ -29,7 +29,7 @@ module.exports = new Class({ Component.prototype.initialize.call(this, props); }, - onNameChange: function() { + onNameChange() { var newValue = this.$.name.value; if (!newValue) @@ -38,7 +38,7 @@ module.exports = new Class({ this.emit('name-changed', newValue); }, - _onSubmit: function() { + _onSubmit() { this.$.hiddenName.value = this.$.name.value; this.$.submit.disabled = true; this.$.spinner.start(); @@ -47,7 +47,7 @@ module.exports = new Class({ this._onResponse.bind(this)); }, - _onResponse: function(json, error) { + _onResponse(json, error) { this.$.submit.disabled = false; this.$.spinner.stop(); @@ -58,7 +58,7 @@ module.exports = new Class({ this.emit('file-uploaded', this.$.name.value); }, - setData: function(image, directory) { + setData(image, directory) { this.$.name.value = image; this.$.schema.value = directory; } diff --git a/js/htk/image/index.js b/js/htk/image/index.js index 92d3f30c..efe3a752 100644 --- a/js/htk/image/index.js +++ b/js/htk/image/index.js @@ -13,11 +13,11 @@ module.exports = new Class({ */ directory: { type: String - ,set: function(x) { + ,set(x) { this._directory = x; this._refreshSrc(); } - ,get: function() { + ,get() { return this._directory; } }, @@ -26,11 +26,11 @@ module.exports = new Class({ */ subdir: { type: String - ,set: function(x) { + ,set(x) { this._subdir = x; this._refreshSrc(); } - ,get: function() { + ,get() { return this._subdir; } }, @@ -39,11 +39,11 @@ module.exports = new Class({ */ stampColumn: { type: String - ,set: function(x) { + ,set(x) { this._stampColumn = x; this._refreshSrc(); } - ,get: function() { + ,get() { return this._stampColumn; } }, @@ -52,11 +52,11 @@ module.exports = new Class({ */ fullDir: { type: String - ,set: function(x) { + ,set(x) { this._fullDir = x; this._refreshClick(); } - ,get: function() { + ,get() { return this._fullDir; } }, @@ -74,7 +74,7 @@ module.exports = new Class({ ,_error: false ,_editable: false - ,render: function() { + ,render() { var node = this.createRoot('div'); var img = this.img = this.createElement('img'); @@ -86,7 +86,7 @@ module.exports = new Class({ this._refreshSrc(); } - ,_refreshClick: function() { + ,_refreshClick() { if (!this.node) return; @@ -103,7 +103,7 @@ module.exports = new Class({ } } - ,setEditable: function() { + ,setEditable() { if (!this.node) return; @@ -124,7 +124,7 @@ module.exports = new Class({ } } - ,_makeSrc: function(subdir) { + ,_makeSrc(subdir) { var src = Vn.Config.imageUrl +'/'; if (this._directory) @@ -142,7 +142,7 @@ module.exports = new Class({ return src; } - ,_refreshSrc: function() { + ,_refreshSrc() { if (!this.node) return; @@ -153,15 +153,15 @@ module.exports = new Class({ delete this.img.src; } - ,putValue: function() { + ,putValue() { this._refreshSrc(); } - ,_onImageError: function() { + ,_onImageError() { this._error = true; } - ,_onClick: function(event) { + ,_onClick(event) { if (!this._fullDir || !this._value || this._error || event.defaultPrevented) return; @@ -170,7 +170,7 @@ module.exports = new Class({ (new Htk.FullImage()).show(this._makeSrc(this._fullDir)); } - ,_onEditClick: function(event) { + ,_onEditClick(event) { if (event.defaultPrevented) return event.preventDefault(); @@ -187,17 +187,17 @@ module.exports = new Class({ this.popup.show(this.node); } - ,_onNameChange: function(editor, value) { + ,_onNameChange(editor, value) { this.value = value; } - ,_onFileUpload: function(cell) { + ,_onFileUpload(cell) { this._stamp = new Date().getTime(); this._refreshSrc(cell); this.popup.hide(); } - ,_onEditorClose: function(editor) { + ,_onEditorClose(editor) { editor.disconnectByInstance(this); } }); diff --git a/js/htk/label/index.js b/js/htk/label/index.js index 94f09b68..5f9cbad4 100644 --- a/js/htk/label/index.js +++ b/js/htk/label/index.js @@ -11,11 +11,11 @@ module.exports = new Class format: { type: String - ,set: function(x) { + ,set(x) { this._format = _(x); this.putValue(this._value); } - ,get: function() { + ,get() { return this._format; } } @@ -23,11 +23,11 @@ module.exports = new Class ,_format: null - ,render: function() { + ,render() { this.createRoot('label'); } - ,putValue: function(value) { + ,putValue(value) { Vn.Node.setText(this.node, Vn.Value.format(value, this._format)); } diff --git a/js/htk/loader/index.js b/js/htk/loader/index.js index dd6d8b19..ee59627f 100644 --- a/js/htk/loader/index.js +++ b/js/htk/loader/index.js @@ -7,17 +7,17 @@ module.exports = new Class({ ,Properties: { form: { type: Db.Form - ,set: function(x) { + ,set(x) { this.link({_form: x}, {'status-changed': this.onFormChange}); this.onFormChange(); } - ,get: function() { + ,get() { return this._form; } } } - ,initialize: function(props) { + ,initialize(props) { Component.prototype.initialize.call(this, props); this.createRoot('div'); @@ -36,11 +36,11 @@ module.exports = new Class({ this.stop(); } - ,appendChild: function(child) { + ,appendChild(child) { this.childs.appendChild(child); } - ,stop: function() { + ,stop() { if (!this.isLoading) return; @@ -50,7 +50,7 @@ module.exports = new Class({ this.node.appendChild(this.childs); } - ,start: function() { + ,start() { if (this.isLoading) return; @@ -60,7 +60,7 @@ module.exports = new Class({ this.node.appendChild(this.div); } - ,onFormChange: function() { + ,onFormChange() { if (this._form.ready) this.stop(); else diff --git a/js/htk/popup/index.js b/js/htk/popup/index.js index fa461ad3..1cd46375 100644 --- a/js/htk/popup/index.js +++ b/js/htk/popup/index.js @@ -13,11 +13,11 @@ module.exports = new Class({ */ child: { type: Component - ,set: function(x) { + ,set(x) { this._child = x; this._setChildNode(x.node); } - ,get: function() { + ,get() { return this._child; } } @@ -26,11 +26,11 @@ module.exports = new Class({ */ ,childNode: { type: Object - ,set: function(x) { + ,set(x) { this._child = null; this._setChildNode(x); } - ,get: function() { + ,get() { return this.node.firstChild; } } @@ -39,10 +39,10 @@ module.exports = new Class({ */ ,modal: { type: Boolean - ,set: function(x) { + ,set(x) { this._modal = x; } - ,get: function() { + ,get() { return this._modal; } } @@ -53,31 +53,31 @@ module.exports = new Class({ ,_isOpen: false ,_child: null - ,initialize: function(props) { + ,initialize(props) { this._bgMouseDownHandler = this._bgMouseDown.bind(this); Component.prototype.initialize.call(this, props); } - ,render: function() { + ,render() { this.createRoot('div'); } - ,_setChildNode: function(childNode) { + ,_setChildNode(childNode) { Vn.Node.removeChilds(this.node); this.node.appendChild(childNode); } - ,show: function(parent, event) { + ,show(parent, event) { this._parent = parent; this._lastEvent = event; this.open(); } - ,isModal: function() { + ,isModal() { return this._modal || Vn.isMobile(); } - ,open: function() { + ,open() { if (this._isOpen) { this.reset(); return; @@ -106,16 +106,16 @@ module.exports = new Class({ setTimeout(this._onResetTimeout.bind(this), 0); } - ,_onOpacityTimeout: function() { + ,_onOpacityTimeout() { if (this._bg) this._bg.style.opacity = 1; } - ,_onResetTimeout: function() { + ,_onResetTimeout() { this.reset(); } - ,reset: function() { + ,reset() { if (!this._isOpen) return; @@ -162,7 +162,7 @@ module.exports = new Class({ } } - ,hide: function() { + ,hide() { if (!this._isOpen) return; @@ -180,14 +180,14 @@ module.exports = new Class({ this.emit('closed'); } - ,_bgMouseDown: function(e) { + ,_bgMouseDown(e) { if (e !== this._lastEvent) this.hide(); this._lastEvent = null; } - ,_onMouseDown: function(e) { + ,_onMouseDown(e) { this._lastEvent = e; } }); diff --git a/js/htk/radio/index.js b/js/htk/radio/index.js index 4c771a03..270a1f3f 100644 --- a/js/htk/radio/index.js +++ b/js/htk/radio/index.js @@ -7,17 +7,17 @@ module.exports = new Class({ ,Properties: { tip: { type: String - ,set: function(x) { + ,set(x) { if (x) this.node.title = _(x); } }, val: { type: String - ,get: function() { + ,get() { return this._val; } - ,set: function(x) { + ,set(x) { this._val = x; this.node.value = !x ? '' : x; this._onRadioGroupChange(); @@ -25,19 +25,19 @@ module.exports = new Class({ }, name: { type: String - ,get: function() { + ,get() { return this.node.name; } - ,set: function(x) { + ,set(x) { this.node.name = x; } }, radioGroup: { type: RadioGroup - ,get: function() { + ,get() { return this._radioGroup; } - ,set: function(x) { + ,set(x) { if (this._radioGroup) this._radioGroup.removeButton(this); @@ -51,32 +51,32 @@ module.exports = new Class({ ,_radioGroup: null - ,render: function() { + ,render() { var radio = Vn.Browser.createRadio('', this.doc); radio.checked = false; radio.addEventListener('change', this._onChange.bind(this)); this._node = radio; } - ,_onChange: function() { + ,_onChange() { if (this.node.checked && this._radioGroup) this._radioGroup.value = this._val || this.value; } - ,_onRadioGroupChange: function() { + ,_onRadioGroupChange() { const value = this._radioGroup.value; this.node.checked = value && (value == this._val || value == this.value); } - ,putValue: function(value) { + ,putValue(value) { if (!value) this.node.value = ''; else this.node.value = value; } - ,setEditable: function(editable) { + ,setEditable(editable) { this.node.disabled = !editable; } }); diff --git a/js/htk/radio/radio-group.js b/js/htk/radio/radio-group.js index 59673b4f..ebeaaba2 100644 --- a/js/htk/radio/radio-group.js +++ b/js/htk/radio/radio-group.js @@ -7,24 +7,24 @@ module.exports = new Class({ ,radioLock: false - ,initialize: function(props) { + ,initialize(props) { this.clear(); Htk.Field.prototype.initialize.call(this, props); } - ,clear: function() { + ,clear() { this.name = htkRadioGroupUid++; this.buttons = []; } - ,createButton: function(value) { + ,createButton(value) { var button = Vn.Browser.createRadio(this.name, this.doc); button.value = value; button.radioGroup = this; return button; } - ,removeButton: function(button) { + ,removeButton(button) { for (var i = 0; i < this.buttons.length; i++) if (this.buttons === button) { this.buttons.splice(i, 1); @@ -35,7 +35,7 @@ module.exports = new Class({ /** * @return %true if there is an option selected, otherwise it returns %false */ - ,isSelected: function() { + ,isSelected() { for (var i = 0; i < this.buttons.length; i++) if (this.buttons[i].value == this.value) return true; diff --git a/js/htk/repeater/index.js b/js/htk/repeater/index.js index b7ce3f23..498f5cfa 100644 --- a/js/htk/repeater/index.js +++ b/js/htk/repeater/index.js @@ -11,7 +11,7 @@ module.exports = new Class({ */ model: { type: Db.Model - ,set: function(x) { + ,set(x) { this.link({_model: x}, { 'status-changed': this._onModelChange ,'row-deleted': this._onRowDelete @@ -21,7 +21,7 @@ module.exports = new Class({ this._onModelChange(); } - ,get: function() { + ,get() { this._model; } } @@ -30,10 +30,10 @@ module.exports = new Class({ */ ,formId: { type: String - ,set: function(x) { + ,set(x) { this._formId = x; } - ,get: function() { + ,get() { this._formId; } } @@ -43,10 +43,10 @@ module.exports = new Class({ */ ,renderer: { type: Function - ,set: function(x) { + ,set(x) { this._renderer = x; } - ,get: function() { + ,get() { this._renderer; } } @@ -55,11 +55,11 @@ module.exports = new Class({ */ ,showStatus: { type: Boolean - ,set: function(x) { + ,set(x) { this._showStatus = x; this._onModelChange(); } - ,get: function() { + ,get() { this._showStatus; } } @@ -76,7 +76,7 @@ module.exports = new Class({ ,_formId: 'form' ,_showStatus: true - ,render: function() { + ,render() { var div = this.createRoot('div'); this._container = this.createElement('div'); @@ -84,7 +84,7 @@ module.exports = new Class({ div.appendChild(this._container); } - ,loadXml: function(scope, node) { + ,loadXml(scope, node) { Component.prototype.loadXml.call(this, scope, node); this._parentScope = scope; @@ -94,19 +94,19 @@ module.exports = new Class({ this._onModelChange(); } - ,getChild: function(index) { + ,getChild(index) { return this._container.childNodes[index]; } - ,getBuilder: function(index) { + ,getBuilder(index) { return this._childsData[index].scope; } - ,getForm: function(index) { + ,getForm(index) { return this._childsData[index].set; } - ,_buildBox: function(index) { + ,_buildBox(index) { var set = new Db.SimpleIterator({ model: this._model, row: index @@ -126,7 +126,7 @@ module.exports = new Class({ return scope.getMain(); } - ,_onModelChange: function() { + ,_onModelChange() { if (!this._model || !this._builder) return; @@ -164,12 +164,12 @@ module.exports = new Class({ this.emit('change'); } - ,_showNoRecordsFound: function() { + ,_showNoRecordsFound() { if (this._model.numRows === 0) this._showMessage(_('EmptyList'), 'block'); } - ,_showMessage: function(message, src) { + ,_showMessage(message, src) { if (!this._showStatus) return; @@ -191,7 +191,7 @@ module.exports = new Class({ div.appendChild(this.createTextNode(message)); } - ,_onRowDelete: function(model, row) { + ,_onRowDelete(model, row) { Vn.Node.remove(this._container.childNodes[row]); this._unrefChildData(row); this._childsData.splice(row, 1); @@ -202,28 +202,28 @@ module.exports = new Class({ this._showNoRecordsFound(); } - ,_onRowUpdate: function(model, row) { + ,_onRowUpdate(model, row) { this._childsData[row].set.iterChanged(); } - ,_onRowInsert: function(model, row) { + ,_onRowInsert(model, row) { var box = this._buildBox(row); this._container.appendChild(box); } - ,_freeChildsData: function() { + ,_freeChildsData() { if (this._childsData) for (var i = 0; i < this._childsData.length; i++) this._unrefChildData(i); } - ,_unrefChildData: function(index) { + ,_unrefChildData(index) { var childData = this._childsData[index]; childData.set.unref(); childData.scope.unref(); } - ,destroy: function() { + ,destroy() { this._freeChildsData(); Component.prototype.destroy.call(this); } diff --git a/js/htk/search-entry/index.js b/js/htk/search-entry/index.js index c2b91fa0..379585c3 100644 --- a/js/htk/search-entry/index.js +++ b/js/htk/search-entry/index.js @@ -4,7 +4,7 @@ module.exports = new Class({ Extends: Htk.Field ,Tag: 'htk-search-entry' - ,render: function() { + ,render() { var div = this.createRoot('div'); div.className = 'htk-search-entry'; @@ -24,7 +24,7 @@ module.exports = new Class({ this._input = input; } - ,_onChange: function() { + ,_onChange() { var newValue; if (this._input.value === '') @@ -35,14 +35,14 @@ module.exports = new Class({ this.valueChanged(newValue); } - ,putValue: function(value) { + ,putValue(value) { if (!value) this._input.value = ''; else this._input.value = value; } - ,setEditable: function(editable) { + ,setEditable(editable) { this.node.readOnly = !editable; } }); diff --git a/js/htk/select/index.js b/js/htk/select/index.js index 341c3b3b..f1059577 100644 --- a/js/htk/select/index.js +++ b/js/htk/select/index.js @@ -11,11 +11,11 @@ module.exports = new Class({ */ model: { type: Db.Model - ,set: function(x) { + ,set(x) { this.link({_model: x}, {'status-changed-after': this._onModelChange}); this._onModelChange(); } - ,get: function() { + ,get() { return this._model; } }, @@ -24,7 +24,7 @@ module.exports = new Class({ */ row: { type: Number - ,set: function(x) { + ,set(x) { if (!this._model || this._model.numRows <= x || x < -1) x = -1; if (x == this._row) @@ -33,7 +33,7 @@ module.exports = new Class({ this._row = x; this.iterChanged(); } - ,get: function() { + ,get() { return this._row; } }, @@ -42,7 +42,7 @@ module.exports = new Class({ */ numRows:{ type: Number - ,get: function() { + ,get() { if (this._model) return this._model.numRows; @@ -54,7 +54,7 @@ module.exports = new Class({ */ ready:{ type: Boolean - ,get: function() { + ,get() { return this._model && this._model.ready; } }, @@ -63,11 +63,11 @@ module.exports = new Class({ */ placeholder:{ type: String - ,set: function(x) { + ,set(x) { this._placeholder = x; this._refreshShowText(x); } - ,get: function() { + ,get() { return this._placeholder; } }, @@ -76,10 +76,10 @@ module.exports = new Class({ */ notNull:{ type: Boolean - ,set: function(x) { + ,set(x) { this._notNull = x; } - ,get: function() { + ,get() { return this._notNull; } }, @@ -88,13 +88,13 @@ module.exports = new Class({ */ $: { type: Object - ,get: function() { + ,get() { return this._model.getObject(this._row) || {}; } }, params: { type: Object - ,get: function() { + ,get() { return this.$; } } @@ -109,7 +109,7 @@ module.exports = new Class({ ,_notNull: true ,_webkitRefresh: false - ,render: function() { + ,render() { const button = this.createRoot('button'); button.type = 'button'; button.classList.add('input'); @@ -134,7 +134,7 @@ module.exports = new Class({ button.appendChild(dropDown.node); } - ,_setRow: function(row) { + ,_setRow(row) { this._row = row; this._refreshShowText(); this.iterChanged(); @@ -147,7 +147,7 @@ module.exports = new Class({ this.valueChanged(undefined); } - ,_onButtonMouseDown: function(event) { + ,_onButtonMouseDown(event) { if (this._popup) { this._popup.hide(); return; @@ -178,7 +178,7 @@ module.exports = new Class({ this.emit('menu-show'); } - ,_onGridClicked: function(grid, e) { + ,_onGridClicked(grid, e) { let cell; let target = e.target; @@ -204,12 +204,12 @@ module.exports = new Class({ e.stopPropagation(); } - ,_onPopupClose: function() { + ,_onPopupClose() { this._popup = null; this.emit('menu-hide'); } - ,_refreshShowText: function() { + ,_refreshShowText() { var model = this._model; if (this._row !== -1) @@ -224,7 +224,7 @@ module.exports = new Class({ Vn.Node.setText(this.label, showText); } - ,_onModelChange: function() { + ,_onModelChange() { var model = this._model; this.emit('status-changed'); @@ -238,11 +238,11 @@ module.exports = new Class({ this._setRow(-1); } - ,setEditable: function(editable) { + ,setEditable(editable) { this.node.disabled = !editable; } - ,_selectOption: function() { + ,_selectOption() { var row; if (this._model && this._model.ready) @@ -253,7 +253,7 @@ module.exports = new Class({ this._setRow(row); } - ,putValue: function() { + ,putValue() { this._selectOption(); } }); diff --git a/js/htk/spin/index.js b/js/htk/spin/index.js index 6032bacf..8ef919f5 100644 --- a/js/htk/spin/index.js +++ b/js/htk/spin/index.js @@ -3,7 +3,7 @@ module.exports = new Class({ Extends: Htk.Field ,Tag: 'htk-spin' - ,render: function() { + ,render() { var input = this.createRoot('input'); this.node.type = 'number'; input.addEventListener('change', this._onChange.bind(this)); @@ -12,13 +12,13 @@ module.exports = new Class({ this.digits = 0; } - ,_onChange: function() { + ,_onChange() { var newValue = (this.node.value == '') ? null : parseFloat(this.node.value); this.node.value = newValue; this.valueChanged(newValue); } - ,putValue: function(value) { + ,putValue(value) { var text; if (value != null) { @@ -32,7 +32,7 @@ module.exports = new Class({ this.node.value = text; } - ,setEditable: function(editable) { + ,setEditable(editable) { this.node.readOnly = !editable; } }); diff --git a/js/htk/spinner/index.js b/js/htk/spinner/index.js index b95fadc3..fcc0b425 100644 --- a/js/htk/spinner/index.js +++ b/js/htk/spinner/index.js @@ -7,14 +7,14 @@ module.exports = new Class({ ,_started: false - ,render: function() { + ,render() { var loader = this.createRoot('div'); var spin = this.spin = this.createElement('div'); loader.appendChild(spin); } - ,start: function() { + ,start() { if (this._started) return; @@ -22,7 +22,7 @@ module.exports = new Class({ this._started = true; } - ,stop: function() { + ,stop() { if (!this._started) return; diff --git a/js/htk/step/index.js b/js/htk/step/index.js index 3da1bfd4..1085ff0a 100644 --- a/js/htk/step/index.js +++ b/js/htk/step/index.js @@ -19,28 +19,28 @@ module.exports = new Class({ } }, - initialize: function(props) { + initialize(props) { Component.prototype.initialize.call(this, props); this.createRoot('div'); }, - show: function() { + show() { if (this.showFunc) this.showFunc(); this.node.style.display = 'block'; }, - hide: function() { + hide() { this.node.style.display = 'none'; }, - validate: function() { + validate() { if (this.validateFunc) return this.validateFunc(); return true; }, - appendChild: function(child) { + appendChild(child) { if (child instanceof Component) child = child.node; this.node.appendChild(child); diff --git a/js/htk/table/index.js b/js/htk/table/index.js index 26ed5fad..6a232aa5 100644 --- a/js/htk/table/index.js +++ b/js/htk/table/index.js @@ -6,7 +6,7 @@ module.exports = new Class({ Extends: Entry ,Tag: 'htk-table' - ,render: function() { + ,render() { var tv = new Htk.TreeView(); this.node.appendChild(tv.node); @@ -20,31 +20,31 @@ module.exports = new Class({ this.rbGroup = rbGroup; } - ,setModel: function(model) { + ,setModel(model) { this.treeview.setModel(model); model.addSignal('status-changed', this.modelRefresh, this); this.selectValue(); } - ,changed: function() { + ,changed() { this.realValue = this.rbGroup.getValue(); this.emit('changed'); } - ,selectValue: function() { + ,selectValue() { this.rbGroup.setValue(this.realValue); } - ,setRealValue: function() { + ,setRealValue() { this.selectValue(); } - ,modelRefresh: function(model, status) { + ,modelRefresh(model, status) { if (status == Db.Model.Status.READY) this.selectValue(); } - ,setEditable: function(editable) { + ,setEditable(editable) { this.rbGroup.setEditable(editable); } }); diff --git a/js/htk/text-area/index.js b/js/htk/text-area/index.js index 10625025..8030d3f0 100644 --- a/js/htk/text-area/index.js +++ b/js/htk/text-area/index.js @@ -3,12 +3,12 @@ module.exports = new Class({ Extends: Htk.Field ,Tag: 'htk-textarea' - ,render: function() { + ,render() { var node = this.createRoot('textarea'); node.addEventListener('change', this.changed.bind(this)); } - ,changed: function() { + ,changed() { var value; if (this.node.value == '') @@ -19,11 +19,11 @@ module.exports = new Class({ this.valueChanged(value); } - ,setEditable: function(editable) { + ,setEditable(editable) { this.node.readOnly = !editable; } - ,putValue: function(value) { + ,putValue(value) { if (!value) this.node.value = ''; else diff --git a/js/htk/text/index.js b/js/htk/text/index.js index 14fe88b2..721d2e30 100644 --- a/js/htk/text/index.js +++ b/js/htk/text/index.js @@ -11,11 +11,11 @@ module.exports = new Class format: { type: String - ,set: function(x) { + ,set(x) { this._format = _(x); this.putValue(this._value); } - ,get: function() { + ,get() { return this._format; } } @@ -23,11 +23,11 @@ module.exports = new Class ,_format: null - ,render: function() { + ,render() { this._node = this.createTextNode(''); } - ,putValue: function(value) { + ,putValue(value) { this._node.nodeValue = Vn.Value.format(value, this._format); } }); diff --git a/js/htk/toast/index.js b/js/htk/toast/index.js index 6a19ccd0..0c624a9c 100644 --- a/js/htk/toast/index.js +++ b/js/htk/toast/index.js @@ -16,7 +16,7 @@ module.exports = * * @param {String} message The message text */ - ,showMessage: function(message) { + ,showMessage(message) { this._showText(message, 'message'); } @@ -25,7 +25,7 @@ module.exports = * * @param {String} message The message text */ - ,showWarning: function(message) { + ,showWarning(message) { this._showText(message, 'warning'); } @@ -34,22 +34,22 @@ module.exports = * * @param {String} message The message text */ - ,showError: function(message) { + ,showError(message) { this._showText(message, 'error'); } - ,pushTop: function(top) { + ,pushTop(top) { this._topHeap.push(top); this._refreshPosition(); } - ,popTop: function() { + ,popTop() { var top = this._topHeap.pop(); this._refreshPosition(); return top; } - ,_refreshPosition: function() { + ,_refreshPosition() { if (!this._container) return; @@ -69,7 +69,7 @@ module.exports = /** * Hides all currently displayed toast messages. */ - ,hide: function() { + ,hide() { if (!this._container) return; @@ -85,7 +85,7 @@ module.exports = this.nodes = []; } - ,_createContainer: function() { + ,_createContainer() { if (!this._container) { var container = document.createElement('div'); container.className = 'htk-toast'; @@ -101,7 +101,7 @@ module.exports = this._refreshPosition(); } - ,_showText: function(message, className) { + ,_showText(message, className) { this._createContainer(); if (this._timeouts.length >= this.maxMessages) @@ -122,11 +122,11 @@ module.exports = setTimeout(this._onShowToastTimeout.bind(this, toast), 50); } - ,_onShowToastTimeout: function(toast) { + ,_onShowToastTimeout(toast) { Vn.Node.addClass(toast, 'show'); } - ,_onMessageTimeout: function() { + ,_onMessageTimeout() { if (!this._container) return; @@ -140,7 +140,7 @@ module.exports = this.hide(); } - ,_onMessageMouseDown: function(event) { + ,_onMessageMouseDown(event) { event.stopPropagation(); } }; diff --git a/js/sql/delete.js b/js/sql/delete.js index 53447391..e8e862fc 100644 --- a/js/sql/delete.js +++ b/js/sql/delete.js @@ -8,7 +8,7 @@ module.exports = new Class({ Extends: Stmt ,Tag: 'sql-delete' - ,render: function(params) { + ,render(params) { return 'DELETE FROM' + this.renderTarget(params) + this.renderIfSet(this.where, 'WHERE', params) diff --git a/js/sql/dml.js b/js/sql/dml.js index 00ad03f5..4de0610a 100644 --- a/js/sql/dml.js +++ b/js/sql/dml.js @@ -12,17 +12,17 @@ module.exports = new Class({ ,field: [] ,expr: [] - ,addSet: function(fieldName, value) { + ,addSet(fieldName, value) { this.field.push(new Field({name: fieldName})); this.expr.push(new Value({value: value})); } - ,addExpr: function(fieldName, expr) { + ,addExpr(fieldName, expr) { this.field.push(new Field({name: fieldName})); this.expr.push(expr); } - ,delSet: function() { + ,delSet() { this.field.splice(0, this.field.length); this.expr.splice(0, this.expr.length); } diff --git a/js/sql/field.js b/js/sql/field.js index 79839d48..2e7310f0 100644 --- a/js/sql/field.js +++ b/js/sql/field.js @@ -26,7 +26,7 @@ module.exports = new Class({ } } - ,render: function() { + ,render() { return this.renderPreIdent(this.target) + this.renderIdent(this.name); } diff --git a/js/sql/filter-item.js b/js/sql/filter-item.js index 343eebb3..345253a3 100644 --- a/js/sql/filter-item.js +++ b/js/sql/filter-item.js @@ -38,11 +38,11 @@ module.exports = new Class({ /** * Checks if parameter name has been defined and if it has a value. */ - ,isReady: function(params) { + ,isReady(params) { return this.param != null && params != null && params[this.param] != null; } - ,render: function(params) { + ,render(params) { var newOp = new Operation({type: this.type}); newOp.push(new Field({ @@ -56,7 +56,7 @@ module.exports = new Class({ return newOp.render(params); } - ,findHolders: function() { + ,findHolders() { return this.param ? [this.param] : null; } }); diff --git a/js/sql/filter.js b/js/sql/filter.js index 111a6914..ed904412 100644 --- a/js/sql/filter.js +++ b/js/sql/filter.js @@ -13,7 +13,7 @@ module.exports = new Class({ /** * Checks if any of filters childs are ready. */ - ,isReady: function(params) { + ,isReady(params) { var exprs = this.exprs; for (var i = exprs.length; i--;) if (exprs[i].isReady(params)) @@ -27,7 +27,7 @@ module.exports = new Class({ * ready is ommitted from the expression. If all of its childs aren't ready * renders the TRUE expression. */ - ,render: function(params) { + ,render(params) { var newOp; var newExprs = []; diff --git a/js/sql/function.js b/js/sql/function.js index 50fc7c0a..0f8452d5 100644 --- a/js/sql/function.js +++ b/js/sql/function.js @@ -29,16 +29,16 @@ module.exports = new Class({ */ params: { type: Array - ,set: function(x) { + ,set(x) { this.list = x; } - ,get: function() { + ,get() { return this.list; } } } - ,render: function(params) { + ,render(params) { return this.renderPreIdent(this.schema) + this.renderIdent(this.name) + '(' diff --git a/js/sql/holder.js b/js/sql/holder.js index 67083cfa..01345c48 100644 --- a/js/sql/holder.js +++ b/js/sql/holder.js @@ -14,7 +14,7 @@ module.exports = new Class({ } } - ,render: function(params) { + ,render(params) { if (params) { var object = params[this.id]; diff --git a/js/sql/insert.js b/js/sql/insert.js index 6e6dd4c7..1dad50cf 100644 --- a/js/sql/insert.js +++ b/js/sql/insert.js @@ -7,7 +7,7 @@ var Dml = require('./dml'); module.exports = new Class({ Extends: Dml - ,render: function(params) { + ,render(params) { return 'INSERT INTO' + this.renderTarget(params) + ' (' diff --git a/js/sql/join-item.js b/js/sql/join-item.js index 3e63cc9a..0902df7e 100644 --- a/js/sql/join-item.js +++ b/js/sql/join-item.js @@ -40,7 +40,7 @@ module.exports = new Class({ } } - ,render: function(params) { + ,render(params) { return TypeSql[this.type] +' JOIN ' + this.target.render(params) + this.renderIfSet(this.condition, 'ON', params); diff --git a/js/sql/join.js b/js/sql/join.js index 37fcb8c8..c23c520c 100644 --- a/js/sql/join.js +++ b/js/sql/join.js @@ -28,16 +28,16 @@ Klass.implement({ */ targets: { type: Array - ,set: function(x) { + ,set(x) { this.list = x; } - ,get: function() { + ,get() { return this.list; } } } - ,render: function(params) { + ,render(params) { return '(' + this.target.render(params) + ' ' diff --git a/js/sql/list-holder.js b/js/sql/list-holder.js index 470ee8bb..ef05ad11 100644 --- a/js/sql/list-holder.js +++ b/js/sql/list-holder.js @@ -17,7 +17,7 @@ module.exports = new Class({ ,list: [] - ,appendChild: function(child) { + ,appendChild(child) { this.list.push(child); } @@ -26,7 +26,7 @@ module.exports = new Class({ * * @param {SqlObject} element The element to add */ - ,push: function(element) { + ,push(element) { this.list.push(element); } @@ -35,7 +35,7 @@ module.exports = new Class({ * * @param {Number} i The element index */ - ,splice: function(i) { + ,splice(i) { this.list.splice(i); } @@ -44,7 +44,7 @@ module.exports = new Class({ * * @param {Number} i The element index */ - ,get: function(i) { + ,get(i) { return this.list[i]; } diff --git a/js/sql/list.js b/js/sql/list.js index b9c7e697..32cf2492 100644 --- a/js/sql/list.js +++ b/js/sql/list.js @@ -9,30 +9,30 @@ module.exports = new Class({ ,objects: [] - ,add: function(object) { + ,add(object) { this.objects.push(object.ref()); object.on('changed', this._onObjectChange, this); this._onObjectChange(); } - ,get: function(i) { + ,get(i) { return objects[i]; } - ,getArray: function() { + ,getArray() { return this.objects; } - ,remove: function(i) { + ,remove(i) { this._unrefObject(this.objects.splice(i, 1)); this._onObjectChange(); } - ,_onObjectChange: function() { + ,_onObjectChange() { this.emit('changed'); } - ,isReady: function() { + ,isReady() { var o = this.objects; if (o.length == 0) @@ -56,12 +56,12 @@ module.exports = new Class({ return ids; } - ,_unrefObject: function(object) { + ,_unrefObject(object) { object.disconnect('changed', this._onObjectChange, this); object.unref(); } - ,_destroy: function() { + ,_destroy() { for (var i = 0; i < this.objects.length; i++) this._unrefObject(this.objects[i]); diff --git a/js/sql/multi-stmt.js b/js/sql/multi-stmt.js index 60504a28..d71a6546 100644 --- a/js/sql/multi-stmt.js +++ b/js/sql/multi-stmt.js @@ -15,16 +15,16 @@ module.exports = new Class({ */ stmts: { type: Array - ,set: function(x) { + ,set(x) { this.list = x; } - ,get: function() { + ,get() { return this.list; } } } - ,render: function(params) { + ,render(params) { return this.renderListWs(this.list, params, ";\n"); } }); diff --git a/js/sql/object.js b/js/sql/object.js index 848ac8ce..582eb2d2 100644 --- a/js/sql/object.js +++ b/js/sql/object.js @@ -10,7 +10,7 @@ module.exports = new Class({ * @param {Object} params The query parameters * @return {boolean} %true if the object is ready, %false otherwise */ - ,isReady: function() { + ,isReady() { return true; } @@ -19,7 +19,7 @@ module.exports = new Class({ * * @return {Array} An array with the names of the found parameters */ - ,findHolders: function() {} + ,findHolders() {} /** * Renders the object as an SQL string. @@ -27,7 +27,7 @@ module.exports = new Class({ * @param {Object} params The params used to render the object * @return {string} The SQL string */ - ,render: function() {} + ,render() {} /** * Renders an objects array. @@ -36,7 +36,7 @@ module.exports = new Class({ * @param {Object} params The parameters * @return {string} The rendered SQL string */ - ,renderList: function(list, params) { + ,renderList(list, params) { var sql = ''; list.forEach(function(item) { @@ -54,7 +54,7 @@ module.exports = new Class({ * @param {String} separator The separator between items * @return {string} The rendered SQL string */ - ,renderListWs: function(list, params, separator) { + ,renderListWs(list, params, separator) { var sql = ''; list.forEach(function(item, i) { @@ -72,7 +72,7 @@ module.exports = new Class({ * @param {String} identifier The identifier * @return {string} The quoted identifier */ - ,renderIdent: function(identifier) { + ,renderIdent(identifier) { return '`'+ identifier +'`'; } @@ -82,7 +82,7 @@ module.exports = new Class({ * @param {String} identifier The identifier * @return {string} The quoted identifier */ - ,renderPreIdent: function(identifier) { + ,renderPreIdent(identifier) { if (identifier) return this.renderIdent(identifier) +'.'; else @@ -95,7 +95,7 @@ module.exports = new Class({ * @param {String} prefix The rendered string prefix * @return {string} The rendered object with its prefix */ - ,renderIfSet: function(object, prefix, params) { + ,renderIfSet(object, prefix, params) { if (object) return ' '+ prefix +' '+ object.render(params); else diff --git a/js/sql/operation.js b/js/sql/operation.js index 9f491f4a..6d37bb92 100644 --- a/js/sql/operation.js +++ b/js/sql/operation.js @@ -67,16 +67,16 @@ Klass.implement({ }, exprs: { type: Array - ,set: function(x) { + ,set(x) { this.list = x; } - ,get: function() { + ,get() { return this.list; } } } - ,render: function(params) { + ,render(params) { var operator = ' '+ Operators[this.type] +' '; return '(' + this.renderListWs(this.list, params, operator) diff --git a/js/sql/select.js b/js/sql/select.js index 12840246..8d5c2ff0 100644 --- a/js/sql/select.js +++ b/js/sql/select.js @@ -10,11 +10,11 @@ module.exports = new Class({ ,expr: [] - ,addField: function(fieldName) { + ,addField(fieldName) { this.expr.push(new Field({name: fieldName})); } - ,render: function(params) { + ,render(params) { return 'SELECT ' + this.renderListWs(this.expr, params, ', ') + ' FROM' diff --git a/js/sql/stmt.js b/js/sql/stmt.js index a6d3e564..da147eb6 100644 --- a/js/sql/stmt.js +++ b/js/sql/stmt.js @@ -20,18 +20,18 @@ module.exports = new Class({ ,target: [] - ,addTarget: function(target) { + ,addTarget(target) { this.target.push(target); } - ,renderTarget: function(params) { + ,renderTarget(params) { if (this.target.length > 0) return ' '+ this.renderListWs(this.target, params, ', '); else return ' DUAL'; } - ,renderLimit: function() { + ,renderLimit() { if (this.limit != null) return ' LIMIT '+ parseInt(this.limit); else diff --git a/js/sql/string.js b/js/sql/string.js index ed8989b4..dee0bb20 100644 --- a/js/sql/string.js +++ b/js/sql/string.js @@ -17,12 +17,12 @@ module.exports = new Class({ ,regexp: /#\w+/g - ,appendChild: function(child) { + ,appendChild(child) { if (child.nodeType === Node.TEXT_NODE) this.query = child.textContent; } - ,render: function(params) { + ,render(params) { if (!this.query) return null; @@ -34,7 +34,7 @@ module.exports = new Class({ return this.query.replace(this.regexp, replaceFunc); } - ,findHolders: function() { + ,findHolders() { var ids = this.query.match(this.regexp); if (ids) diff --git a/js/sql/table.js b/js/sql/table.js index e97c8eec..61975ece 100644 --- a/js/sql/table.js +++ b/js/sql/table.js @@ -21,7 +21,7 @@ module.exports = new Class({ } } - ,render: function() { + ,render() { var sql = this.renderPreIdent(this.schema) + this.renderIdent(this.name); diff --git a/js/sql/update.js b/js/sql/update.js index 8c91eab8..5b9e42cf 100644 --- a/js/sql/update.js +++ b/js/sql/update.js @@ -7,7 +7,7 @@ var Dml = require('./dml'); module.exports = new Class({ Extends: Dml - ,render: function(params) { + ,render(params) { var sql = 'UPDATE' + this.renderTarget(params) + ' SET '; diff --git a/js/sql/value.js b/js/sql/value.js index 6e069472..3006d55f 100644 --- a/js/sql/value.js +++ b/js/sql/value.js @@ -12,65 +12,65 @@ module.exports = new Class({ ,Properties: { value: { type: null - ,set: function(x) { + ,set(x) { this._setValue(x); } - ,get: function() { + ,get() { return this._value; } }, type: { type: Type - ,set: function(x) { + ,set(x) { this._setType(x); } - ,get: function() { + ,get() { return this._type; } }, param: { type: Vn.ParamIface - ,set: function(x) { + ,set(x) { this._setParam(x); } - ,get: function() { + ,get() { return this._param; } }, lot: { type: Vn.LotIface - ,set: function(x) { + ,set(x) { this._setLot(x); } - ,get: function() { + ,get() { return this._lot; } }, name: { type: String - ,set: function(x) { + ,set(x) { this._name = x; this._onLotChange(); } - ,get: function() { + ,get() { return this._name; } }, oneWay: { type: Boolean - ,set: function(x) { + ,set(x) { this._oneWay = x; } - ,get: function() { + ,get() { return this._oneWay; } }, oneTime: { type: Boolean - ,set: function(x) { + ,set(x) { this._oneTime = x; } - ,get: function() { + ,get() { return this._oneTime; } } @@ -78,11 +78,11 @@ module.exports = new Class({ ,regexp: new RegExp('(\\\\)|\'', 'g') - ,isReady: function() { + ,isReady() { return this._value !== undefined; } - ,replaceFunc: function(token) { + ,replaceFunc(token) { switch (token) { case '\\': return '\\\\'; case '\'': return '\\\''; @@ -91,7 +91,7 @@ module.exports = new Class({ return token; } - ,render: function() { + ,render() { var v = this._value; switch (typeof v) { diff --git a/js/vn/browser.js b/js/vn/browser.js index 92986ab0..86aa8a8a 100644 --- a/js/vn/browser.js +++ b/js/vn/browser.js @@ -1,29 +1,29 @@ module.exports = { - getPageYOffset: function() { + getPageYOffset() { return window.pageYOffset; }, - getPageXOffset: function() { + getPageXOffset() { return window.pageXOffset; }, - getInnerHeight: function() { + getInnerHeight() { return window.innerHeight; }, - getInnerWidth: function() { + getInnerWidth() { return window.innerWidth; }, - createRadio: function(uid, doc) { + createRadio(uid, doc) { var radio = doc.createElement('input'); radio.type = 'radio'; radio.name = uid; return radio; }, - setInputTypeNumber: function(input) { + setInputTypeNumber(input) { input.type = 'number'; } }; diff --git a/js/vn/builder.js b/js/vn/builder.js index ee6182b6..ffe22d00 100644 --- a/js/vn/builder.js +++ b/js/vn/builder.js @@ -24,7 +24,7 @@ module.exports = new Class({ * @param {String} path The XML path * @return {Boolean} %true on success, %false othersise */ - ,compileFile: function(path) { + ,compileFile(path) { this._path = path; return this.compileDocument(Vn.getXml(path)); } @@ -35,7 +35,7 @@ module.exports = new Class({ * @param {String} xmlString The XML string * @return {Boolean} %true on success, %false othersise */ - ,compileString: function(xmlString) { + ,compileString(xmlString) { const parser = new DOMParser(); const doc = parser.parseFromString(xmlString, 'text/xml'); return this.compileDocument(doc); @@ -47,7 +47,7 @@ module.exports = new Class({ * @param {Document} doc The DOM document * @return {Boolean} %true on success, %false othersise */ - ,compileDocument: function(doc) { + ,compileDocument(doc) { if (!doc) return false; @@ -75,7 +75,7 @@ module.exports = new Class({ * @path Node The DOM node * @return %true on success, %false othersise */ - ,compileNode: function(node) { + ,compileNode(node) { this._preCompile(); this._mainContext = this._compile(node).id; this._postCompile(); @@ -85,7 +85,7 @@ module.exports = new Class({ /** * Called before starting to compile nodes. */ - ,_preCompile: function() { + ,_preCompile() { this._path = null; this._tags = {}; this._contexts = []; @@ -102,7 +102,7 @@ module.exports = new Class({ /** * Called after all nodes have been compiled. */ - ,_postCompile: function() { + ,_postCompile() { for (const compiler of this._compilers) compiler.postCompile(this._contextMap); } @@ -110,7 +110,7 @@ module.exports = new Class({ /** * Compiles a node. */ - ,_compile: function(node) { + ,_compile(node) { let context = null; let tagName = null; const isElement = node.nodeType === Node.ELEMENT_NODE; @@ -148,7 +148,7 @@ module.exports = new Class({ return context; } - ,load: function(dstDocument, thisArg, parentScope) { + ,load(dstDocument, thisArg, parentScope) { if (!this._contexts) return null; const doc = dstDocument ? dstDocument : document; const objects = new Array(this._contexts.length); @@ -156,7 +156,7 @@ module.exports = new Class({ return new Scope(this, doc, objects, exprValues, thisArg, parentScope); } - ,showError: function(error) { + ,showError(error) { const path = this._path ? this._path : 'Node'; const logArgs = ['Vn.Builder: %s: '+ error, path]; diff --git a/js/vn/compiler-element.js b/js/vn/compiler-element.js index 61441f9c..b35c9d31 100644 --- a/js/vn/compiler-element.js +++ b/js/vn/compiler-element.js @@ -8,7 +8,7 @@ const VnNode = require('./node'); module.exports = new Class({ Extends: Compiler - ,compile: function(builder, node, tagName) { + ,compile(builder, node, tagName) { const context = { tagName, attributes: {}, @@ -44,7 +44,7 @@ const VnNode = require('./node'); return context; } - ,instantiate: function(doc, context, scope) { + ,instantiate(doc, context, scope) { const object = doc.createElement(context.tagName); const attributes = context.attributes; @@ -64,7 +64,7 @@ const VnNode = require('./node'); object.setAttribute(property, value); } - ,link: function(context, object, objects, scope) { + ,link(context, object, objects, scope) { const childs = context.childs; for (let i = 0; i < childs.length; i++) { let child = objects[childs[i]]; diff --git a/js/vn/compiler-object.js b/js/vn/compiler-object.js index e623f838..a5ddd221 100644 --- a/js/vn/compiler-object.js +++ b/js/vn/compiler-object.js @@ -14,7 +14,7 @@ module.exports = new Class({ /** * Creates a object context. */ - ,compile: function(builder, node, tagName) { + ,compile(builder, node, tagName) { const klass = vnCustomTags[tagName]; if (!klass) return null; @@ -68,7 +68,7 @@ module.exports = new Class({ return context; } - ,propCompile: function(context, node, attribute, value) { + ,propCompile(context, node, attribute, value) { const tagName = node.tagName; const propName = kebabToCamel(attribute); const propInfo = context.klass.Properties[propName]; @@ -132,7 +132,7 @@ module.exports = new Class({ } } - ,instantiate: function(doc, context, scope) { + ,instantiate(doc, context, scope) { const object = new context.klass(); object.setProperties(context.props); @@ -171,7 +171,7 @@ module.exports = new Class({ } } - ,link: function(context, object, objects, scope) { + ,link(context, object, objects, scope) { const objectProps = context.objectProps; for (const prop in objectProps) object[prop] = objects[objectProps[prop]]; @@ -202,7 +202,7 @@ module.exports = new Class({ object.loadXml(scope, context.custom); } - ,_addLink: function(context, prop, objectId) { + ,_addLink(context, prop, objectId) { this._links.push({ context ,prop @@ -210,7 +210,7 @@ module.exports = new Class({ }); } - ,_replaceFunc: function(token) { + ,_replaceFunc(token) { return token.charAt(1).toUpperCase(); } }); \ No newline at end of file diff --git a/js/vn/compiler-text.js b/js/vn/compiler-text.js index 6b21a697..7951c735 100644 --- a/js/vn/compiler-text.js +++ b/js/vn/compiler-text.js @@ -6,7 +6,7 @@ const Compiler = require('./compiler'); module.exports = new Class({ Extends: Compiler - ,compile: function(builder, node, tagName) { + ,compile(builder, node, tagName) { if (tagName && tagName != 't') return null; @@ -23,7 +23,7 @@ module.exports = new Class({ return context; } - ,instantiate: function(doc, context) { + ,instantiate(doc, context) { return doc.createTextNode(context.text); } diff --git a/js/vn/compiler.js b/js/vn/compiler.js index b505d3b0..9f00c05e 100644 --- a/js/vn/compiler.js +++ b/js/vn/compiler.js @@ -7,17 +7,17 @@ var VnObject = require('./object'); module.exports = new Class({ Extends: VnObject - ,compile: function() {} - ,postCompile: function() {} - ,instantiate: function() {} - ,preLink: function() {} - ,link: function() {} - ,connect: function() {} - ,postLink: function() {} - ,setProperty: function() {} - ,free: function() {} + ,compile() {} + ,postCompile() {} + ,instantiate() {} + ,preLink() {} + ,link() {} + ,connect() {} + ,postLink() {} + ,setProperty() {} + ,free() {} - ,initialize: function(builder) { + ,initialize(builder) { this._builder = builder; this._interpoler = builder._interpoler; this.parent(); @@ -29,11 +29,11 @@ module.exports = new Class({ * @param {String} attribute The attribute name * @return {Boolean} %true if it's an event, otherwise %false */ - ,isEvent: function(attribute) { + ,isEvent(attribute) { return /^on-\w+/.test(attribute); } - ,isIdentifier: function(value) { + ,isIdentifier(value) { return /^[a-zA-Z_$][\w$]*$/.test(value); } @@ -43,11 +43,11 @@ module.exports = new Class({ * @param {String} error The error message template * @param {...} varArgs The message template arguments */ - ,showError: function() { + ,showError() { this._builder.showError.apply(this._builder, arguments); } - ,_getMethod: function(value) { + ,_getMethod(value) { // XXX: Compatibility with old methods return this.isIdentifier(value) ? value @@ -137,7 +137,7 @@ module.exports = new Class({ } } - ,_translateValue: function(value) { + ,_translateValue(value) { var chr = value.charAt(0); if (chr === '_') diff --git a/js/vn/component.js b/js/vn/component.js index 73974b62..3fe3938a 100644 --- a/js/vn/component.js +++ b/js/vn/component.js @@ -15,7 +15,7 @@ const ComponentClass = { */ node: { type: Object - ,get: function() { + ,get() { this.renderBase(); return this._node; } @@ -25,10 +25,10 @@ const ComponentClass = { */ style: { type: String - ,set: function(x) { + ,set(x) { this.node.style = x; } - ,get: function() { + ,get() { return this._node.style; } }, @@ -37,11 +37,11 @@ const ComponentClass = { */ class: { type: String - ,set: function(x) { + ,set(x) { this._className = x; this._refreshClass(); } - ,get: function() { + ,get() { return this._className; } }, @@ -50,11 +50,11 @@ const ComponentClass = { */ className: { type: String - ,set: function(x) { + ,set(x) { this._className = x; this._refreshClass(); } - ,get: function() { + ,get() { return this._className; } }, @@ -63,7 +63,7 @@ const ComponentClass = { */ classList: { type: Object - ,get: function() { + ,get() { return this._node.classList; } }, @@ -72,10 +72,10 @@ const ComponentClass = { */ title: { type: String - ,set: function(x) { + ,set(x) { this._node.title = x; } - ,get: function() { + ,get() { return this._node.title; } }, @@ -85,12 +85,12 @@ const ComponentClass = { htmlId: { type: String - ,set: function(x) { + ,set(x) { this._htmlId = x; if (this._node) this._node.id = x; } - ,get: function() { + ,get() { return this._htmlId; } }, @@ -99,13 +99,13 @@ const ComponentClass = { ,_node: null ,scope: null - ,initialize: function(props) { + ,initialize(props) { this.doc = document; this.renderBase(); NodeBuilder.prototype.initialize.call(this, props); } - ,createRoot: function(tagName) { + ,createRoot(tagName) { const node = this._node = this.createElement(tagName); node.$ctrl = this; if (this._htmlId) @@ -115,14 +115,14 @@ const ComponentClass = { return node; } - ,appendChild: function(child) { + ,appendChild(child) { if (child instanceof Klass) this._node.appendChild(child.node); else if (child instanceof Element) this._node.appendChild(child); } - ,renderBase: function() { + ,renderBase() { if (this._node) return; @@ -130,16 +130,16 @@ const ComponentClass = { this._refreshClass(); } - ,_refreshClass: function() { + ,_refreshClass() { if (this._node && this._className) this._node.className = this._className +' '+ (this._node.className || ''); } - ,remove: function() { + ,remove() { Vn.Node.remove(this._node); } - ,on: function(id, callback, instance) { + ,on(id, callback, instance) { if (htmlEventMap[id]) { this.addEventListener(id, callback.bind(instance, this)); @@ -147,19 +147,19 @@ const ComponentClass = { NodeBuilder.prototype.on.call(this, id, callback, instance); } - ,loadTemplateFromFile: function(path) { + ,loadTemplateFromFile(path) { const builder = new Vn.Builder(); builder.compileFile(path); this.loadScope(builder); } - ,loadTemplateFromString: function(xmlString) { + ,loadTemplateFromString(xmlString) { const builder = new Vn.Builder(); builder.compileString(xmlString); this.loadScope(builder); } - ,loadScope: function(builder) { + ,loadScope(builder) { const scope = this.scope = builder.load(this.doc, this); scope.link(); @@ -167,7 +167,7 @@ const ComponentClass = { this._node = scope.$.main; } - ,_destroy: function() { + ,_destroy() { if (this.scope) this.scope.unref(); diff --git a/js/vn/date.js b/js/vn/date.js index 24fb6598..1a0c26b6 100644 --- a/js/vn/date.js +++ b/js/vn/date.js @@ -59,14 +59,14 @@ module.exports = ,regexp: new RegExp('%[a-zA-Z]', 'g') - ,pad: function(number) { + ,pad(number) { if (number < 10) return '0'+ number.toString(); return number.toString(); } - ,regexpFunc: function(d, token) { + ,regexpFunc(d, token) { switch (token.charAt(1)) { // Minutes with 2 digits case 'M': return this.pad(d.getMinutes()); @@ -108,7 +108,7 @@ module.exports = return token; } - ,strftime: function(date, format) { + ,strftime(date, format) { if (!date) return ''; if (!(date instanceof Date)) diff --git a/js/vn/form.js b/js/vn/form.js index 208bc25b..0f2d5d8f 100644 --- a/js/vn/form.js +++ b/js/vn/form.js @@ -8,14 +8,14 @@ module.exports = new Class({ ,Properties: { model: { type: ModelIface - ,set: function(x) { + ,set(x) { this.link({_model: x}, { 'status-changed': this.onModelChange ,'row-updated': this.onModelRowUpdate }); } - ,get: function() { + ,get() { return this._model; } }, @@ -24,7 +24,7 @@ module.exports = new Class({ */ row: { type: Number - ,set: function(x) { + ,set(x) { if (!this._model || this._model.numRows <= x || x < -1) x = -1; if (x == this._row) @@ -33,13 +33,13 @@ module.exports = new Class({ this._row = x; this.rowChanged(); } - ,get: function() { + ,get() { return this._row; } } } - ,initialize: function(props) { + ,initialize(props) { Object.assign(this, { _lastRow: 0 ,_lastReady: false @@ -47,7 +47,7 @@ module.exports = new Class({ Iterator.prototype.initialize.call(this, props); } - ,onModelChange: function() { + ,onModelChange() { var ready = this._model && this._model.ready; if (ready != this._lastReady) { @@ -65,7 +65,7 @@ module.exports = new Class({ } } - ,onModelRowUpdate: function(model, row) { + ,onModelRowUpdate(model, row) { if (row == this._row) this.rowChanged(); } diff --git a/js/vn/hash.js b/js/vn/hash.js index d7f67ac6..0e373c43 100644 --- a/js/vn/hash.js +++ b/js/vn/hash.js @@ -15,18 +15,18 @@ module.exports = new Class({ window: { type: Window - ,set: function(x) { + ,set(x) { this._window = x; x.addEventListener('hashchange', this._hashChangedHandler); this._hashChanged(); } - ,get: function() { + ,get() { return this._window; } } } - ,initialize: function(props) { + ,initialize(props) { Object.assign(this, { _hash: null ,_hashLock: false @@ -36,7 +36,7 @@ module.exports = new Class({ Lot.prototype.initialize.call(this, props); } - ,_paramsChanged: function() { + ,_paramsChanged() { this.updateHash(); } @@ -47,7 +47,7 @@ module.exports = new Class({ * @param {boolean} add %true to combine with the current params, %false otherwise * @return {string} The URL */ - ,make: function(params, add) { + ,make(params, add) { if (add) { params = Object.assign({}, params); @@ -62,7 +62,7 @@ module.exports = new Class({ /** * Updates the window hash with current params. */ - ,updateHash: function() { + ,updateHash() { if (this._hashLock) return; @@ -76,7 +76,7 @@ module.exports = new Class({ /* * Called when window hash changes. */ - ,_hashChanged: function() { + ,_hashChanged() { var newHash = location.hash; if (this._hashLock || this._hash === newHash) @@ -95,7 +95,7 @@ module.exports = new Class({ * @param {Object} params The key-value object * @return {string} The URL */ - ,renderHash: function(params) { + ,renderHash(params) { var hash = '#!'; for (var key in params) @@ -115,7 +115,7 @@ module.exports = new Class({ * @param {string} hashString The hash string * @return {Object} The key-value object */ - ,parseHash: function(hashString) { + ,parseHash(hashString) { var newMap = hashMap = {}; var kvPairs = hashString.substr(2).split('&'); @@ -129,7 +129,7 @@ module.exports = new Class({ return newMap; } - ,renderValue: function(v) { + ,renderValue(v) { if (v == null) return ''; @@ -144,7 +144,7 @@ module.exports = new Class({ return v; } - ,parseValue: function(v) { + ,parseValue(v) { if (v == null) return v; @@ -156,7 +156,7 @@ module.exports = new Class({ return v; } - ,_destroy: function() { + ,_destroy() { this._window.removeEventListener('hashchange', this._hashChangedHandler); this._window = null; Lot.prototype._destroy.call(this); diff --git a/js/vn/ie.js b/js/vn/ie.js index 29b451f9..34270e68 100644 --- a/js/vn/ie.js +++ b/js/vn/ie.js @@ -1,34 +1,34 @@ module.exports = { - getPageYOffset: function() { + getPageYOffset() { if (document.documentElement.scrollTop) return document.documentElement.scrollTop; else return document.body.scrollTop; }, - getPageXOffset: function() { + getPageXOffset() { if (document.documentElement.scrollLeft) return document.documentElement.scrollLeft; else return document.body.scrollLeft; }, - getInnerHeight: function() { + getInnerHeight() { if (document.documentElement.clientHeight) return document.documentElement.clientHeight; else return document.body.clientHeight; }, - getInnerWidth: function() { + getInnerWidth() { if (document.documentElement.clientWidth) return document.documentElement.clientWidth; else return document.body.clientWidth; }, - createRadio: function(radioName) { + createRadio(radioName) { var radio; try { @@ -42,7 +42,7 @@ module.exports = { return radio; }, - setInputTypeNumber: function(input) { + setInputTypeNumber(input) { input.type = 'text'; } }; diff --git a/js/vn/iterator-iface.js b/js/vn/iterator-iface.js index c01e0e8e..e7f91724 100644 --- a/js/vn/iterator-iface.js +++ b/js/vn/iterator-iface.js @@ -31,7 +31,7 @@ module.exports = new Class({ } } - ,insertRow: function() { + ,insertRow() { if (this._model) this.row = this._model.insertRow(); } @@ -39,7 +39,7 @@ module.exports = new Class({ /** * Removes the current row. */ - ,deleteRow: function() { + ,deleteRow() { if (this._row >= 0) this._model.deleteRow(this._row); } @@ -50,7 +50,7 @@ module.exports = new Class({ * @param {string} columnName The column name * @return {Object} The value */ - ,get: function(columnName) { + ,get(columnName) { return this._model ? this._model.get(this._row, columnName) : undefined; } @@ -61,7 +61,7 @@ module.exports = new Class({ * @param {string} columnName The column name * @param {Object} value The new value */ - ,set: function(columnName, value) { + ,set(columnName, value) { this._model.set(this._row, columnName, value); } }); diff --git a/js/vn/iterator.js b/js/vn/iterator.js index 01888c7a..db609daa 100644 --- a/js/vn/iterator.js +++ b/js/vn/iterator.js @@ -13,33 +13,33 @@ module.exports = new Class({ ,Properties: { model: { type: ModelIface - ,set: function(x) { + ,set(x) { this._model = x; } - ,get: function() { + ,get() { return this._model; } }, row: { type: Number - ,set: function(x) { + ,set(x) { this._row = x; this.rowChanged(); } - ,get: function() { + ,get() { return this._row; } }, numRows: { type: Number - ,get: function() { + ,get() { return this._model ? this._model.numRows : 0; } }, ready: { type: Boolean - ,get: function() { + ,get() { return this._model ? this._model.ready : false; } @@ -48,7 +48,7 @@ module.exports = new Class({ ,_model: null - ,initialize: function(props) { + ,initialize(props) { Object.assign(this, { _row: -1 ,_rowLock: false @@ -56,13 +56,13 @@ module.exports = new Class({ Lot.prototype.initialize.call(this, props); } - ,_paramsChanged: function(diff) { + ,_paramsChanged(diff) { if (!this._rowLock) for (var key in diff) this._model.set(this._row, key, diff[key]); } - ,rowChanged: function() { + ,rowChanged() { var row; if (this._model) diff --git a/js/vn/json-connection.js b/js/vn/json-connection.js index 23bc2e3f..e24da306 100644 --- a/js/vn/json-connection.js +++ b/js/vn/json-connection.js @@ -15,12 +15,12 @@ module.exports = new Class({ /** * Initilizes the connection object. */ - ,initialize: function() { + ,initialize() { VnObject.prototype.initialize.call(this); this.fetchToken(); } - ,fetchToken: function() { + ,fetchToken() { var token = null; if (sessionStorage.getItem('vnToken')) @@ -31,7 +31,7 @@ module.exports = new Class({ this.token = token; } - ,clearToken: function() { + ,clearToken() { this.token = null; localStorage.removeItem('vnToken'); sessionStorage.removeItem('vnToken'); @@ -45,7 +45,7 @@ module.exports = new Class({ * @param {Boolean} remember Specifies if the user should be remembered * @param {Function} openCallback The function to call when operation is done */ - ,open: function(user, pass, remember, callback) { + ,open(user, pass, remember, callback) { if (user !== null && user !== undefined) { var params = { user: user @@ -62,7 +62,7 @@ module.exports = new Class({ /* * Called when open operation is done. */ - ,_onOpen: function(callback, remember, json, error) { + ,_onOpen(callback, remember, json, error) { if (json) { this._connected = true; this.token = json.token; @@ -83,7 +83,7 @@ module.exports = new Class({ * * @param {Function} callback The function to call when operation is done */ - ,close: function(callback) { + ,close(callback) { this.lbSend('POST', 'Accounts/logout', null, this._onClose.bind(this, callback)); this._closeClient(); @@ -92,14 +92,14 @@ module.exports = new Class({ /* * Called when close operation is done. */ - ,_onClose: function(callback, json, error) { + ,_onClose(callback, json, error) { this.emit('closed'); if (callback) callback(this, null, error); } - ,_closeClient: function() { + ,_closeClient() { this._connected = false; this.clearToken(); } @@ -110,13 +110,13 @@ module.exports = new Class({ * @param {String} user The user name * @param {Function} callback The callback function */ - ,supplantUser: function(user, callback) { + ,supplantUser(user, callback) { var params = {supplantUser: user}; this.send('client/supplant', params, this._onUserSupplant.bind(this, callback)); } - ,_onUserSupplant: function(callback, json, err) { + ,_onUserSupplant(callback, json, err) { if (json) this.token = json; @@ -127,7 +127,7 @@ module.exports = new Class({ /** * Ends the user supplanting and restores the last login. */ - ,supplantEnd: function() { + ,supplantEnd() { this.lbSend('POST', 'Accounts/logout'); this.fetchToken(); } @@ -140,7 +140,7 @@ module.exports = new Class({ * @param {Map} params The params to pass to the service * @param {Function} callback The response callback */ - ,send: function(restService, params, callback) { + ,send(restService, params, callback) { if (!params) params = {}; @@ -149,7 +149,7 @@ module.exports = new Class({ this.sendWithUrl(params, callback, 'POST', '.'); } - ,sendForm: function(form, callback) { + ,sendForm(form, callback) { var params = {}; var elements = form.elements; @@ -160,7 +160,7 @@ module.exports = new Class({ this.sendWithUrl(params, callback, 'POST', form.action); } - ,sendFormMultipart: function(form, callback) { + ,sendFormMultipart(form, callback) { var formData = new FormData(form); var request = new XMLHttpRequest(); @@ -174,7 +174,7 @@ module.exports = new Class({ this._addRequest(); } - ,sendFormData: function(formData, callback) { + ,sendFormData(formData, callback) { var request = new XMLHttpRequest(); request.open('POST', '', true); if (this.token) @@ -189,7 +189,7 @@ module.exports = new Class({ /* * Called when REST response is received. */ - ,sendWithUrl: function(params, callback, method, url) { + ,sendWithUrl(params, callback, method, url) { var request = new XMLHttpRequest(); request.open(method, url, true); request.setRequestHeader('Content-Type', @@ -203,7 +203,7 @@ module.exports = new Class({ this._addRequest(); } - ,lbSend: function(method, url, params, callback) { + ,lbSend(method, url, params, callback) { var request = new XMLHttpRequest(); request.open(method, `api/${url}`, true); request.setRequestHeader('Content-Type', @@ -217,14 +217,14 @@ module.exports = new Class({ this._addRequest(); } - ,_addRequest: function() { + ,_addRequest() { this._requestsCount++; if (this._requestsCount === 1) this.emit('loading-changed', true); } - ,_onStateChange: function(request, callback) { + ,_onStateChange(request, callback) { if (request.readyState !== 4) return; diff --git a/js/vn/json-exception.js b/js/vn/json-exception.js index e60c416b..03414baa 100644 --- a/js/vn/json-exception.js +++ b/js/vn/json-exception.js @@ -10,7 +10,7 @@ module.exports = new Class ,line: null ,trace: null - ,initialize: function(exception, message, code, file, line, trace) { + ,initialize(exception, message, code, file, line, trace) { this.exception = exception; this.message = message; this.code = code; diff --git a/js/vn/locale.js b/js/vn/locale.js index 56d46250..f3f2a66b 100644 --- a/js/vn/locale.js +++ b/js/vn/locale.js @@ -9,7 +9,7 @@ module.exports = language: null ,defaultLang: 'en' - ,init: function() { + ,init() { if (this.language) return; @@ -24,7 +24,7 @@ module.exports = this.language = language.substr(0, 2); } - ,load: function(path, callback) { + ,load(path, callback) { this.init(); var data = { @@ -40,7 +40,7 @@ module.exports = data.org = this.createRequest(data, false, this.language); } - ,createRequest: function(data, isDef, lang) { + ,createRequest(data, isDef, lang) { var langFile = data.path +'/locale/'+ lang +'.yml'+ Vn.getVersion(); var request = new XMLHttpRequest(); @@ -51,7 +51,7 @@ module.exports = return request; } - ,onRequestReady: function(request, data, isDef) { + ,onRequestReady(request, data, isDef) { if (request.readyState != 4) return; @@ -69,7 +69,7 @@ module.exports = } } - ,loadFromRequest: function(request) { + ,loadFromRequest(request) { if (request.status !== 200) return false; @@ -83,12 +83,12 @@ module.exports = return false } - ,loadScript: function(path, callback) { + ,loadScript(path, callback) { this.init(); Vn.includeJs(path +'/locale/'+ this.language, callback); } - ,add: function(translations) { + ,add(translations) { for (var str in translations) vnLocaleStrings[str] = translations[str]; } diff --git a/js/vn/lot-iface.js b/js/vn/lot-iface.js index 7639a16e..2678e9af 100644 --- a/js/vn/lot-iface.js +++ b/js/vn/lot-iface.js @@ -25,7 +25,7 @@ module.exports = new Class({ * @param {string} field The field name * @return {*} The field value */ - ,get: function(field) { + ,get(field) { return this.params[field]; } @@ -35,7 +35,7 @@ module.exports = new Class({ * @param {string} field The field name * @param {*} value The new field value */ - ,set: function(field, value) { + ,set(field, value) { var params = {}; params[field] = value; this.assign(params); @@ -46,14 +46,14 @@ module.exports = new Class({ * * @return {Array} The lot keys */ - ,keys: function() {} + ,keys() {} /** * Emits the 'change' signal on the lot. * * @param {Object} changes The changed params and its values */ - ,changed: function(changes) { + ,changed(changes) { this.emit('change', changes); } @@ -62,21 +62,21 @@ module.exports = new Class({ * * @param {Object} object The source object */ - ,assign: function() {} + ,assign() {} /** * Copies all values from another lot. * * @param {LotIface} lot The source lot */ - ,assignLot: function(lot) { + ,assignLot(lot) { this.assign(lot.$); } /** * Resets all values. */ - ,reset: function() { + ,reset() { this.params = {}; } }); diff --git a/js/vn/lot-query.js b/js/vn/lot-query.js index 63981d7d..8b4748b0 100644 --- a/js/vn/lot-query.js +++ b/js/vn/lot-query.js @@ -10,27 +10,27 @@ module.exports = new Class({ ,Properties: { fields: { type: Array - ,set: function(x) { + ,set(x) { this._fields = x; this._onSourceChange(); } - ,get: function() { + ,get() { return this._fields; } }, source: { type: LotIface - ,set: function(x) { + ,set(x) { this.link({_source: x}, {change: this._onSourceChange}); this._onSourceChange(); } - ,get: function() { + ,get() { return this._source; } } } - ,initialize: function(props) { + ,initialize(props) { Object.assign(this, { _fields: null, _source: null, @@ -40,7 +40,7 @@ module.exports = new Class({ Lot.prototype.initialize.call(this, props); } - ,appendChild: function(child) { + ,appendChild(child) { if (!(child instanceof Spec)) throw new Error('VnLotQuery: Child must be a Vn.Spec instance'); @@ -48,7 +48,7 @@ module.exports = new Class({ this._onSourceChange(); } - ,_onSourceChange: function() { + ,_onSourceChange() { if (this._lockSource) return; @@ -61,19 +61,19 @@ module.exports = new Class({ this.assign(myParams); } - ,assign: function(params) { + ,assign(params) { params = this.transformParams(params); var diff = Value.partialDiff(this._params, params); this._assign(diff); } - ,setAll: function(params) { + ,setAll(params) { params = this.transformParams(params); var diff = Value.diff(this._params, params); this._assign(diff); } - ,_assign: function(diff) { + ,_assign(diff) { if (diff) { Object.assign(this._params, diff); @@ -88,7 +88,7 @@ module.exports = new Class({ } } - ,transformParams: function(params) { + ,transformParams(params) { var newParams = {}; for (var key in this._specs) { diff --git a/js/vn/lot.js b/js/vn/lot.js index 490b22fd..7d84aba4 100644 --- a/js/vn/lot.js +++ b/js/vn/lot.js @@ -10,25 +10,25 @@ module.exports = new Class({ ,Properties: { $: { type: Object - ,set: function(x) { + ,set(x) { this.setAll(x); } - ,get: function() { + ,get() { return this._params; } } ,params: { type: Object - ,set: function(x) { + ,set(x) { this.$ = x; } - ,get: function() { + ,get() { return this.$; } } } - ,initialize: function(props) { + ,initialize(props) { this._params = new Proxy({}, { set(obj, prop, value) { return Reflect.set(obj, prop, value); @@ -37,21 +37,21 @@ module.exports = new Class({ VnObject.prototype.initialize.call(this, props); } - ,keys: function() { + ,keys() { return Object.keys(this._params); } - ,assign: function(params) { + ,assign(params) { var diff = Value.partialDiff(this._params, params); this._assign(diff); } - ,setAll: function(params) { + ,setAll(params) { var diff = Value.diff(this._params, params); this._assign(diff); } - ,_assign: function(diff) { + ,_assign(diff) { if (diff) { Object.assign(this._params, diff); this._paramsChanged(diff); @@ -65,5 +65,5 @@ module.exports = new Class({ * * @param {Object} diff Changed parameters and its new values */ - ,_paramsChanged: function() {} + ,_paramsChanged() {} }); diff --git a/js/vn/model-iface.js b/js/vn/model-iface.js index 7b4abdb9..d5218a14 100644 --- a/js/vn/model-iface.js +++ b/js/vn/model-iface.js @@ -30,7 +30,7 @@ * @param {integer} column The column index * @return {boolean} %true if column exists, %false otherwise */ - ,checkColExists: function() {} + ,checkColExists() {} /** * Checks if the row exists. @@ -38,7 +38,7 @@ * @param {integer} rowIndex The row index * @return {boolean} %true if row exists, %false otherwise */ - ,checkRowExists: function() {} + ,checkRowExists() {} /** * Get the index of the column from its name. @@ -46,7 +46,7 @@ * @param {string} columnName The column name * @return {number} The column index or -1 if column not exists */ - ,getColumnIndex: function() {} + ,getColumnIndex() {} /** * Gets a value from the model. @@ -55,7 +55,7 @@ * @param {string} columnName The column name * @return {*} The value, or %undefined */ - ,get: function() {} + ,get() {} /** * Gets a value using the column index. @@ -64,7 +64,7 @@ * @param {number} column The column index * @return {*} The value */ - ,getByIndex: function() {} + ,getByIndex() {} /** * Gets a row as an object using the column index. @@ -72,7 +72,7 @@ * @param {number} rowIndex The row index * @return {Object} The row as an object */ - ,getObject: function() {} + ,getObject() {} /** * Orders the model by the specified column name. @@ -80,7 +80,7 @@ * @param {number} column The column name * @param {SortWay} way The sort way */ - ,sortByName: function() {} + ,sortByName() {} /** * Orders the model by the specified column. @@ -88,7 +88,7 @@ * @param {number} column The column index * @param {SortWay} way The sort way */ - ,sort: function() {} + ,sort() {} /** * Searchs a value on the model and returns the row index of the first @@ -100,7 +100,7 @@ * @param {Object} value The value to search * @return {number} The column index */ - ,search: function() {} + ,search() {} /** * Searchs a value on the model and returns the row index of the first @@ -110,7 +110,7 @@ * @param {Object} value The value to search * @return {number} The column index */ - ,searchByIndex: function() {} + ,searchByIndex() {} /** * Builds an internal hash index for the specified column, this speeds @@ -121,7 +121,7 @@ * * @param {string} column The column name */ - ,indexColumn: function() {} + ,indexColumn() {} }); \ No newline at end of file diff --git a/js/vn/model-proxy.js b/js/vn/model-proxy.js index 04fabcd0..71ff34f1 100644 --- a/js/vn/model-proxy.js +++ b/js/vn/model-proxy.js @@ -42,7 +42,7 @@ Klass.implement({ * @param {string} columnName The column name * @param {*} value The new value */ - ,set: function() {} + ,set() {} /** * Updates a value on the model using the column index. @@ -51,30 +51,30 @@ Klass.implement({ * @param {number} col The column index * @param {*} value The new value */ - ,setByIndex: function() {} + ,setByIndex() {} /** * Deletes a row from the model. * * @param {number} rowIndex The row index */ - ,deleteRow: function() {} + ,deleteRow() {} /** * Inserts a new row on the model. * * @return The index of the inserted row */ - ,insertRow: function() {} + ,insertRow() {} /** * Cleans the model data. */ - ,clean: function() {} + ,clean() {} /** * Performs all model changes on the database. */ - ,performOperations: function() {} + ,performOperations() {} }); diff --git a/js/vn/model.js b/js/vn/model.js index d33ead43..9feeec24 100644 --- a/js/vn/model.js +++ b/js/vn/model.js @@ -31,10 +31,10 @@ Klass.implement({ */ data: { type: Array - ,get: function() { + ,get() { return this._data; } - ,set: function(x) { + ,set(x) { this._setData(x); } }, @@ -43,7 +43,7 @@ Klass.implement({ */ numRows: { type: Number - ,get: function() { + ,get() { if (this._data) return this._data.length; @@ -55,7 +55,7 @@ Klass.implement({ */ status: { type: Number - ,get: function() { + ,get() { return this._status; } }, @@ -64,7 +64,7 @@ Klass.implement({ */ ready: { type: Boolean - ,get: function() { + ,get() { return this._status === Status.READY; } } @@ -82,7 +82,7 @@ Klass.implement({ //+++++++++++++++++++++++++++++ Data hadling - ,_setData: function(data) { + ,_setData(data) { this._data = data; this._refreshRowIndexes(0); @@ -100,7 +100,7 @@ Klass.implement({ * @param {Integer} rowIndex The row index * @return {Boolean} %true if row exists, %false otherwise */ - ,checkRowExists: function(rowIndex) { + ,checkRowExists(rowIndex) { return this._data != null && rowIndex >= 0 && rowIndex < this._data.length; @@ -113,7 +113,7 @@ Klass.implement({ * @param {Number} columnName The column name * @return {*} The value */ - ,get: function(rowIndex, columnName) { + ,get(rowIndex, columnName) { if (!this.checkRowExists(rowIndex)) return undefined; @@ -127,7 +127,7 @@ Klass.implement({ * @param {Number} columnName The column name * @param {*} value The new value */ - ,set: function(rowIndex, columnName, value) { + ,set(rowIndex, columnName, value) { if (!this.checkRowExists(rowIndex)) return; @@ -142,12 +142,12 @@ Klass.implement({ * @param {Number} rowIndex The row index * @return {Object} The row as an object */ - ,getObject: function(rowIndex) { + ,getObject(rowIndex) { return this.checkRowExists(rowIndex) ? this._data[rowIndex] : null; } - ,_setStatus: function(status) { + ,_setStatus(status) { this._status = status; this.emit('status-changed', status); this.emit('status-changed-after', status); @@ -158,7 +158,7 @@ Klass.implement({ * * @return The index of the inserted row */ - ,insertRow: function(newRow) { + ,insertRow(newRow) { var rowIndex = this._data.push(newRow) - 1; newRow.index = rowIndex; this.emit('row-inserted', rowIndex); @@ -170,7 +170,7 @@ Klass.implement({ * * @param {Number} rowIndex The row index */ - ,deleteRow: function(rowIndex) { + ,deleteRow(rowIndex) { if (!this.checkRowExists(rowIndex)) return; @@ -188,19 +188,19 @@ Klass.implement({ * @param {String} columnName The column name * @param {SortWay} way The sort way */ - ,sort: function(columnName, way) { + ,sort(columnName, way) { this._requestedSortName = columnName; this._sort(columnName, way); } - ,_sort: function(columnName, way) { + ,_sort(columnName, way) { var status = this._status; this._setStatus(Status.LOADING); this._realSort(columnName, way); this._setStatus(status); } - ,_realSort: function(columnName, way) { + ,_realSort(columnName, way) { if (!this._data) return; @@ -220,7 +220,7 @@ Klass.implement({ this._refreshRowIndexes(0); } - ,_refreshRowIndexes: function(start) { + ,_refreshRowIndexes(start) { var data = this._data; for (var i = start; i < data.length; i++) @@ -230,7 +230,7 @@ Klass.implement({ /* * Function used to sort the model ascending. */ - ,sortFunctionAsc: function(column, a, b) { + ,sortFunctionAsc(column, a, b) { if (a[column] < b[column]) return -1; else if (a[column] > b[column]) @@ -242,7 +242,7 @@ Klass.implement({ /* * Function used to sort the model descending. */ - ,sortFunctionDesc: function(column, a, b) { + ,sortFunctionDesc(column, a, b) { if (a[column] > b[column]) return -1; else if (a[column] < b[column]) @@ -262,21 +262,21 @@ Klass.implement({ * * @param {String} column The column name */ - ,indexColumn: function(column) { + ,indexColumn(column) { this._requestedIndexes[column] = true; if (this._status === Status.READY) this._buildIndex(column); } - ,getHashValue: function(value) { + ,getHashValue(value) { if (value instanceof Date) return value.getTime(); else return value; } - ,_buildIndex: function(columnName) { + ,_buildIndex(columnName) { if (this.columnMap[columnName] === undefined) return; @@ -309,7 +309,7 @@ Klass.implement({ * @param {Object} value The value to search * @return {Number} The column index */ - ,search: function(columnName, value) { + ,search(columnName, value) { var data = this._data; if (data == null) @@ -344,7 +344,7 @@ Klass.implement({ //+++++++++++++++++++++++++++++ Virtual - ,refresh: function() { + ,refresh() { this._setStatus(Status.READY); } }); diff --git a/js/vn/node-builder.js b/js/vn/node-builder.js index 30b8c004..c576f6c5 100644 --- a/js/vn/node-builder.js +++ b/js/vn/node-builder.js @@ -5,19 +5,19 @@ module.exports = new Class({ ,doc: null - ,initialize: function(props) { + ,initialize(props) { this.doc = document; this.parent(props); } - ,createElement: function(tagName) { + ,createElement(tagName) { return this.doc.createElement(tagName); } - ,createTextNode: function(text) { + ,createTextNode(text) { return this.doc.createTextNode(text); } - ,render: function() {} + ,render() {} }); diff --git a/js/vn/param-iface.js b/js/vn/param-iface.js index 4800c4d6..98134303 100644 --- a/js/vn/param-iface.js +++ b/js/vn/param-iface.js @@ -56,12 +56,12 @@ module.exports = new Class({ ,_name: null ,_oneWay: false - ,_setValue: function(newValue) { + ,_setValue(newValue) { if (this._putValue(newValue)) this._notifyChanges(); } - ,_putValue: function(newValue) { + ,_putValue(newValue) { if (Value.simpleEquals(newValue, this._value)) return false; @@ -69,13 +69,13 @@ module.exports = new Class({ return true; } - ,_notifyChanges: function() { + ,_notifyChanges() { this._refreshLot(); this._refreshParam(); this.emit('changed', this._value); } - ,_setType: function(type) { + ,_setType(type) { this._type = type; this._onLotChange(); } @@ -89,18 +89,18 @@ module.exports = new Class({ this._sourceLock = false; } - ,_setParam: function(param) { + ,_setParam(param) { this.link({_lot: null}); this.link({_param: param}, {changed: this._onParamChange}); this._refreshParam(); } - ,_onParamChange: function() { + ,_onParamChange() { if (this._sourceLock || !this._param) return; this._onSourceChange(this._param.value); } - ,_refreshParam: function() { + ,_refreshParam() { if (this._sourceLock || !this._param || this._oneWay) return; @@ -109,13 +109,13 @@ module.exports = new Class({ this._sourceLock = false; } - ,_setLot: function(lot) { + ,_setLot(lot) { this.link({_param: null}); this.link({_lot: lot}, {change: this._onLotChange}); this._onLotChange(); } - ,_onLotChange: function() { + ,_onLotChange() { if (this._sourceLock || !this._lot || !this._name) return; @@ -123,7 +123,7 @@ module.exports = new Class({ this._onSourceChange(newValue); } - ,_refreshLot: function() { + ,_refreshLot() { if (this._sourceLock || !this._name || !this._lot || this._oneWay) return; @@ -132,7 +132,7 @@ module.exports = new Class({ this._sourceLock = false; } - ,_setName: function(name) { + ,_setName(name) { this._name = name; this._onLotChange(); } diff --git a/js/vn/param.js b/js/vn/param.js index 61da0210..cc9d5b25 100644 --- a/js/vn/param.js +++ b/js/vn/param.js @@ -14,73 +14,73 @@ module.exports = new Class({ ,Properties: { value: { type: null - ,set: function(x) { + ,set(x) { this._setValue(x); } - ,get: function() { + ,get() { return this._value; } }, type: { type: Type - ,set: function(x) { + ,set(x) { this._setType(x); } - ,get: function() { + ,get() { return this._type; } }, param: { type: ParamIface - ,set: function(x) { + ,set(x) { this._setParam(x); } - ,get: function() { + ,get() { return this._param; } }, master: { type: ParamIface - ,set: function(x) { + ,set(x) { this._setParam(x); } - ,get: function() { + ,get() { return this._param; } }, lot: { type: LotIface - ,set: function(x) { + ,set(x) { this._setLot(x); } - ,get: function() { + ,get() { return this._lot; } }, name: { type: String - ,set: function(x) { + ,set(x) { this._setName(x); } - ,get: function() { + ,get() { return this._name; } }, oneWay: { type: Boolean - ,set: function(x) { + ,set(x) { this._oneWay = x; } - ,get: function() { + ,get() { return this._oneWay; } }, oneTime: { type: Boolean - ,set: function(x) { + ,set(x) { this._oneTime = x; } - ,get: function() { + ,get() { return this._oneTime; } } diff --git a/js/vn/scope.js b/js/vn/scope.js index f4043180..97ab5dfe 100644 --- a/js/vn/scope.js +++ b/js/vn/scope.js @@ -6,7 +6,7 @@ let scopeUid = 0; module.exports = new Class({ Extends: VnObject - ,initialize: function(builder, doc, objects, exprValues, thisArg, parent) { + ,initialize(builder, doc, objects, exprValues, thisArg, parent) { this.builder = builder; this.objects = objects; this.exprValues = exprValues; @@ -29,7 +29,7 @@ module.exports = new Class({ } } - ,link: function(extraObjects) { + ,link(extraObjects) { var contextMap = this.builder._contextMap; for (var id in extraObjects) @@ -117,16 +117,16 @@ module.exports = new Class({ this.digest(); } - ,getMain: function() { + ,getMain() { return this.objects[this.builder._mainContext]; } - ,getById: function(objectId) { + ,getById(objectId) { if (!objectId) return null; return this.$[kebabToCamel(objectId)]; } - ,getByTagName: function(tagName) { + ,getByTagName(tagName) { const tags = this.builder._tags[tagName]; if (tags) { @@ -141,11 +141,11 @@ module.exports = new Class({ return []; } - ,getHtmlId: function(nodeId) { + ,getHtmlId(nodeId) { return 'vn-'+ this.uid +'-'+ nodeId; } - ,_destroy: function() { + ,_destroy() { for (const object of this.objects) if (object instanceof VnObject) { object.disconnectByInstance(this); diff --git a/js/vn/spec.js b/js/vn/spec.js index f24bc6da..b64eb4dc 100644 --- a/js/vn/spec.js +++ b/js/vn/spec.js @@ -14,10 +14,10 @@ module.exports = new Class({ */ name: { type: String - ,set: function(x) { + ,set(x) { this._name = x; } - ,get: function() { + ,get() { return this._name; } }, @@ -26,10 +26,10 @@ module.exports = new Class({ */ type: { type: Type - ,set: function(x) { + ,set(x) { this._type = x; } - ,get: function() { + ,get() { return this._type; } } diff --git a/js/vn/url.js b/js/vn/url.js index 582733d8..2ee29c48 100644 --- a/js/vn/url.js +++ b/js/vn/url.js @@ -8,7 +8,7 @@ module.exports = * * @param {string} key The variable name */ - getQuery: function(key) { + getQuery(key) { var regExp = new RegExp('[\?\&]'+ key +'=([^\&]*)(\&?)', 'i'); var value = location.search.match(regExp); @@ -21,7 +21,7 @@ module.exports = * @param {string} key The variable name * @param {string} value The new value */ - ,setQuery: function(key, value) { + ,setQuery(key, value) { var changed = true; var found = false; var newPair = key +'='+ value; @@ -48,7 +48,7 @@ module.exports = document.location.hash = '?'+ kvPairs.join('&'); } - ,makeUri: function(map) { + ,makeUri(map) { var post = ''; for (var key in map) { diff --git a/js/vn/value.js b/js/vn/value.js index b45bf17f..dc7584ed 100644 --- a/js/vn/value.js +++ b/js/vn/value.js @@ -152,7 +152,7 @@ module.exports = { ,simpleEquals ,sprintf - ,compare: function(a, b) { + ,compare(a, b) { if (a === b) return true; if (a instanceof Date && b instanceof Date) @@ -161,7 +161,7 @@ module.exports = { return false; } - ,format: function(value, format) { + ,format(value, format) { if (value === null || value === undefined) return ''; @@ -181,11 +181,11 @@ module.exports = { return value; } - ,replaceNumber: function(value, token, digits) { + ,replaceNumber(value, token, digits) { return new Number(value).toFixed(parseInt(digits)); } - ,replaceString: function(value) { + ,replaceString(value) { return value; } }; diff --git a/js/vn/vn.js b/js/vn/vn.js index b64fd0d6..db9dae55 100644 --- a/js/vn/vn.js +++ b/js/vn/vn.js @@ -40,7 +40,7 @@ Vn = module.exports = { ,head: document.getElementsByTagName('head')[0] ,isMobileCached: null - ,getVersion: function() { + ,getVersion() { if (this._version === undefined) { var re = /[; ]vnVersion=([^\\s;]*)/; var sMatch = (' '+ document.cookie).match(re); @@ -60,7 +60,7 @@ Vn = module.exports = { * * @param {string} fileName The stylesheet file name */ - ,includeCss: function(fileName) { + ,includeCss(fileName) { var cssData = this.cssIncludes[fileName]; if (!cssData) { @@ -86,7 +86,7 @@ Vn = module.exports = { * * @param {string} fileName The stylesheet file name */ - ,excludeCss: function(fileName) { + ,excludeCss(fileName) { var cssData = this.cssIncludes[fileName]; if (cssData && cssData.included) { @@ -95,7 +95,7 @@ Vn = module.exports = { } } - ,_createIncludeData: function(path) { + ,_createIncludeData(path) { var includeData = { depCount: 0 ,success: false @@ -108,7 +108,7 @@ Vn = module.exports = { return includeData; } - ,_handleCallback: function(includeData, callback) { + ,_handleCallback(includeData, callback) { if (!callback) return; @@ -118,7 +118,7 @@ Vn = module.exports = { includeData.callbacks.push(callback); } - ,_resolveDeps: function(includeData) { + ,_resolveDeps(includeData) { includeData.success = true; var callbacks = includeData.callbacks; @@ -150,7 +150,7 @@ Vn = module.exports = { * * @param {Function} callback The main function */ - ,main: function(callback) { + ,main(callback) { if (this.mainCalled) { Vn.warning("Vn: main method should be called only once"); return; @@ -183,17 +183,17 @@ Vn = module.exports = { window.addEventListener('load', this._onWindowLoad.bind(this)); } - ,_onMainDepsLoad: function() { + ,_onMainDepsLoad() { this.mainDepsLoaded = true; this._callMain(); } - ,_onWindowLoad: function() { + ,_onWindowLoad() { this.windowReady = true; this._callMain(); } - ,_callMain: function() { + ,_callMain() { if (this.mainCallback && this.windowReady && this.mainDepsLoaded) this.mainCallback(); } @@ -204,7 +204,7 @@ Vn = module.exports = { * * @param {...} The list of files as function arguments */ - ,include: function() { + ,include() { for (var i = 0; i < arguments.length; i++) { var includeData = this._realIncludeJs(arguments[i] +'.js'); @@ -219,7 +219,7 @@ Vn = module.exports = { * * @param {...} The list of files as function arguments */ - ,resource: function() { + ,resource() { for (var i = 0; i < arguments.length; i++) { var includeData = this._realLoadXml(arguments[i]); @@ -234,7 +234,7 @@ Vn = module.exports = { * * @param {Function} callback The callback function */ - ,define: function(callback) { + ,define(callback) { this.currentCallback = callback; } @@ -244,7 +244,7 @@ Vn = module.exports = { * @param {string} libName The folder of the library * @param {Array} files Array with every library file name */ - ,includeLib: function(libName, files) { + ,includeLib(libName, files) { Vn.Locale.loadScript('js/'+ libName +'.js'); for (var i = 0; i < files.length; i++) @@ -259,12 +259,12 @@ Vn = module.exports = { * @param {Function} callback The function to call when script is * downloaded and included */ - ,includeJs: function(fileName, callback, skipVersion) { + ,includeJs(fileName, callback, skipVersion) { var includeData = this._realIncludeJs(fileName, skipVersion); this._handleCallback(includeData, callback); } - ,_realIncludeJs: function(fileName, skipVersion) { + ,_realIncludeJs(fileName, skipVersion) { var includeData = this.includes[fileName]; if (includeData === undefined) { @@ -293,12 +293,12 @@ Vn = module.exports = { return includeData; } - ,_onScriptStateChange: function(includeData, script) { + ,_onScriptStateChange(includeData, script) { if (script.readyState == 'complete') this._onScriptLoad(includeData, true); } - ,_onScriptLoad: function(includeData, loaded) { + ,_onScriptLoad(includeData, loaded) { includeData.loaded = loaded; if (loaded) { @@ -327,12 +327,12 @@ Vn = module.exports = { * @param {string} path The file path * @param {Function} callback The function to call when file is downloaded */ - ,loadXml: function(path, callback) { + ,loadXml(path, callback) { var includeData = this._realLoadXml(path); this._handleCallback(includeData, callback); } - ,_realLoadXml: function(path) { + ,_realLoadXml(path) { var includeData = this.includes[path]; if (includeData === undefined) { @@ -348,7 +348,7 @@ Vn = module.exports = { return includeData; } - ,_onXmlReady: function(includeData, request) { + ,_onXmlReady(includeData, request) { if (request.readyState != 4) return; @@ -366,7 +366,7 @@ Vn = module.exports = { * @param {string} path The file path * @return {Object} The DOM object */ - ,getXml: function(path) { + ,getXml(path) { var includeData = this.includes[path]; if (!(includeData && includeData.success)) @@ -380,7 +380,7 @@ Vn = module.exports = { * * return {boolean} %true if is mobile, %false otherwise. */ - ,isMobile: function() { + ,isMobile() { if (this.isMobileCached === null) { var regExp = /(Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone)/i; this.isMobileCached = navigator.userAgent.match(regExp); diff --git a/reports/shelves-report/shelves-report.js b/reports/shelves-report/shelves-report.js index e681ef81..a19cd10c 100644 --- a/reports/shelves-report/shelves-report.js +++ b/reports/shelves-report/shelves-report.js @@ -7,7 +7,7 @@ Hedera.ShelvesReport = new Class({ ,trayThickness: 2 ,trayMargin: 5 - ,open: function(lot) { + ,open(lot) { this.lot = lot; var query = @@ -18,7 +18,7 @@ Hedera.ShelvesReport = new Class({ this.conn.execQuery(query, this.onQueryExec.bind(this), lot.$); } - ,onQueryExec: function(resultSet) { + ,onQueryExec(resultSet) { // Fetch query data const row = resultSet.fetchObject(); @@ -98,7 +98,7 @@ Hedera.ShelvesReport = new Class({ this.createWindow(); } - ,onWindowCreate: function() { + ,onWindowCreate() { // Remaining amount var remainings = this.remainings; @@ -151,7 +151,7 @@ Hedera.ShelvesReport = new Class({ this.drawShelfRange(this.lastItem, false); } - ,drawShelf: function(allocator, item) { + ,drawShelf(allocator, item) { var shelf = this.shelf; var sheet = this.doc.createElement('div'); @@ -203,7 +203,7 @@ Hedera.ShelvesReport = new Class({ } } - ,drawShelfRange: function(item, isFirst) { + ,drawShelfRange(item, isFirst) { var labelText = isFirst ? _('Start') : _('End'); var label = this.doc.createElement('label'); @@ -217,7 +217,7 @@ Hedera.ShelvesReport = new Class({ this.subtitles.appendChild(subtitle); } - ,getItemLabel: function(item) { + ,getItemLabel(item) { if (!this.useIds) { var packing = this.showPacking ? (' x'+ item.packing) : ''; return item.name + packing; @@ -225,11 +225,11 @@ Hedera.ShelvesReport = new Class({ return item.id.toLocaleString(); } - ,mm: function(size) { + ,mm(size) { return size.toFixed(2) +'mm'; } - ,drawBox: function(allocator, item, amount) { + ,drawBox(allocator, item, amount) { if (item.boxWidth == 0 || item.boxHeight == 0) return; @@ -283,7 +283,7 @@ Hedera.ShelvesReport = new Class({ }); Vn.Allocator = new Class({ - addShelf: function(item) { + addShelf(item) { this.currentShelf++; this.firstShelfBox = true; @@ -291,7 +291,7 @@ Vn.Allocator = new Class({ this.shelfFunc(this, item); } - ,addTray: function(item) { + ,addTray(item) { if (this.currentTray <= 0) { this.addShelf(item); this.currentTray = this.nTrays - 1; @@ -301,7 +301,7 @@ Vn.Allocator = new Class({ this.trayX = 0; } - ,addColumn: function(item) { + ,addColumn(item) { if (this.trayX + this.columnWidth + item.boxWidth > this.width || this.currentTray == -1) this.addTray(item); @@ -313,7 +313,7 @@ Vn.Allocator = new Class({ this.lastBoxWidth = item.boxWidth; } - ,addBox: function(item, amount) { + ,addBox(item, amount) { var trayHeight = this.trayHeight; if (this.currentTray == this.nTrays - 1) @@ -333,7 +333,7 @@ Vn.Allocator = new Class({ this.lastBoxWidth = item.boxWidth; } - ,run: function() { + ,run() { this.firstShelfBox = false; this.currentShelf = -1; this.currentTray = -1;