Skip to content

Commit

Permalink
[CI] Lint JS scripts with jshint (#2315)
Browse files Browse the repository at this point in the history
  • Loading branch information
Frenzie authored and Alkarex committed Apr 1, 2019
1 parent e5c8d52 commit c2a339f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .jshintignore
@@ -0,0 +1,4 @@
node_modules
p/scripts/bcrypt.min.js
p/scripts/flotr2.min.js
p/scripts/jquery.min.js
8 changes: 8 additions & 0 deletions .jshintrc
@@ -0,0 +1,8 @@
{
"esversion" : 6,
"browser" : true,
"globals": {
"confirm": true,
"console": true
}
}
9 changes: 9 additions & 0 deletions .travis.yml
Expand Up @@ -34,6 +34,15 @@ matrix:
dist: precise
- php: "7.2"
env: CHECK_TRANSLATION=yes VALIDATE_STANDARD=no
- language: node_js
node_js:
- "node"
php:
# none
install:
- npm install jshint
script:
- node_modules/jshint/bin/jshint .
allow_failures:
- env: CHECK_TRANSLATION=yes VALIDATE_STANDARD=no
- dist: precise
14 changes: 7 additions & 7 deletions p/scripts/install.js
@@ -1,15 +1,15 @@
"use strict";
/* jshint globalstrict: true */

function show_password() {
var button = this;
function show_password(ev) {
var button = ev.target;
var passwordField = document.getElementById(button.getAttribute('data-toggle'));
passwordField.setAttribute('type', 'text');
button.className += ' active';
return false;
}
function hide_password() {
var button = this;
function hide_password(ev) {
var button = ev.target;
var passwordField = document.getElementById(button.getAttribute('data-toggle'));
passwordField.setAttribute('type', 'password');
button.className = button.className.replace(/(?:^|\s)active(?!\S)/g , '');
Expand Down Expand Up @@ -61,10 +61,10 @@ if (bd_type) {
bd_type.addEventListener('change', mySqlShowHide);
}

function ask_confirmation(e) {
var str_confirmation = this.getAttribute('data-str-confirm');
function ask_confirmation(ev) {
var str_confirmation = ev.target.getAttribute('data-str-confirm');
if (!confirm(str_confirmation)) {
e.preventDefault();
ev.preventDefault();
}
}
var confirms = document.getElementsByClassName('confirm');
Expand Down

0 comments on commit c2a339f

Please sign in to comment.