js: more linting

This commit is contained in:
boyska 2019-11-16 12:41:40 +01:00
parent b729eec1d1
commit ee9f396c5c
2 changed files with 14 additions and 11 deletions

View file

@ -1,3 +1,5 @@
/* global $ */
console.log('Loading...') console.log('Loading...')
function trx_startbut (code) { return 'startbutton-' + code } function trx_startbut (code) { return 'startbutton-' + code }

View file

@ -1,13 +1,13 @@
/* global $ */ /* global $ */
function time_changer_dialog (d, changed_callback) { function time_changer_dialog (d, changed_callback) {
// d is a Date object // d is a Date object
var dlg_html = '<div> \ var dlg_html = '<div>' +
<form action="#"> \ '<form action="#"> ' +
<input name="h" size="2" maxlength="2" type="number" min="0" max="23"> \ '<input name="h" size="2" maxlength="2" type="number" min="0" max="23"> ' +
<input name="m" size="2" maxlength="2" type="number" min="0" max="59"> \ '<input name="m" size="2" maxlength="2" type="number" min="0" max="59"> ' +
<input name="s" size="2" maxlength="2" type="number" min="0" max="59"> \ '<input name="s" size="2" maxlength="2" type="number" min="0" max="59"> ' +
</form> \ '</form> ' +
</div>' '</div>'
var $dlg = $($.parseHTML(dlg_html)) var $dlg = $($.parseHTML(dlg_html))
$('[name=h]', $dlg).val(d.getHours()) $('[name=h]', $dlg).val(d.getHours())
@ -22,7 +22,7 @@ function time_changer_dialog (d, changed_callback) {
if (changed_callback === undefined) { if (changed_callback === undefined) {
return return
} }
newd = new Date(d.getTime()) var newd = new Date(d.getTime())
newd.setHours($('[name=h]', $dlg).val()) newd.setHours($('[name=h]', $dlg).val())
newd.setMinutes($('[name=m]', $dlg).val()) newd.setMinutes($('[name=m]', $dlg).val())
newd.setSeconds($('[name=s]', $dlg).val()) newd.setSeconds($('[name=s]', $dlg).val())
@ -49,11 +49,10 @@ $.widget('ror.thebutton', {
'use strict' 'use strict'
// create an appropriate button // create an appropriate button
var widget = this var widget = this
var state = this.options.rec // var state = this.options.rec
widget.element.addClass('pure-button') widget.element.addClass('pure-button')
widget.element.on('click', function (evt) { widget.element.on('click', function (evt) {
/* global error_dialog */
if (widget.element.hasClass('rec-failed')) { if (widget.element.hasClass('rec-failed')) {
error_dialog(widget.options.errormsg, error_dialog(widget.options.errormsg,
function () { function () {
@ -113,7 +112,9 @@ $.widget('ror.thebutton', {
function error_dialog (msg, retry, cancel) { function error_dialog (msg, retry, cancel) {
$('<div/>').html($('<pre/>').text(msg)) $('<div/>').html($('<pre/>').text(msg))
.dialog({modal: true, title: 'Dettaglio errori', .dialog({
modal: true,
title: 'Dettaglio errori',
buttons: { buttons: {
Retry: retry, Retry: retry,
Cancel: cancel Cancel: cancel