diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 00000000..a4bf3293
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,75 @@
+{
+ /*
+ * ENVIRONMENTS
+ * =================
+ */
+
+ // Define globals exposed by modern browsers.
+ "browser": true,
+
+ // Define globals exposed by jQuery.
+ "jquery": true,
+
+ // Define globals exposed by Node.js.
+ "node": true,
+
+ // Allow ES6.
+ "esversion": 6,
+
+ /*
+ * ENFORCING OPTIONS
+ * =================
+ */
+
+ // Force all variable names to use either camelCase style or UPPER_CASE
+ // with underscores.
+ "camelcase": false,
+
+ // Prohibit use of == and != in favor of === and !==.
+ "eqeqeq": true,
+
+ // Enforce tab width of 2 spaces.
+ "indent": 2,
+
+ // Require variables/functions to be defined before being used
+ "latedef": false,
+
+ // Enforce line length to 100 characters
+ "maxlen": 200,
+
+ // Require capitalized names for constructor functions.
+ "newcap": true,
+
+ // Enforce use of single quotation marks for strings.
+ "quotmark": "single",
+
+ // Enforce placing 'use strict' at the top function scope
+ "strict": true,
+
+ // Prohibit use of explicitly undeclared variables.
+ "undef": true,
+
+ // Warn when variables are defined but never used.
+ "unused": false,
+
+ // Prohibit use of empty blocks
+ "noempty": true,
+
+ /*
+ * RELAXING OPTIONS
+ * =================
+ */
+
+ // Suppress warnings about == null comparisons.
+ "eqnull": true,
+
+ "predef": [
+ "requirejs",
+ "define",
+ "jsPlumb",
+ "Magnetizer",
+ "Morris",
+ "TweenLite",
+ "Circ"
+ ]
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 8ca7c2e1..fd51e65d 100644
--- a/README.md
+++ b/README.md
@@ -65,6 +65,7 @@ Issues should be reported in the [Issue](https://github.com/exodus4d/pathfinder/
--------------------------
CI/CD config files:
--------------------------
+ |-- .jshintrc --> "JSHint" config (not used for production)
|-- build.js --> "RequireJs Optimizer" config (not used for production)
|-- config.rb --> "Compass" config (not used for production)
|-- gulpfile.js --> "Gulp" task config (not used for production )
diff --git a/gulpfile.js b/gulpfile.js
index 8dbdfc7c..0dab24b3 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -18,6 +18,7 @@ var stylish = require('jshint-stylish');
var _src = {
GULP: './gulpfile.js',
ICON: './public/img/notifications/logo.png',
+ JSHINT_CONF: '.jshintrc',
JS_SRC: './js/**/*',
JS_LIBS: './js/lib/**/*',
JS_BUILD: './build_js',
@@ -89,7 +90,7 @@ gulp.task('jshint', function(){
.pipe(plumber({
errorHandler: onError
}))
- .pipe(jshint())
+ .pipe(jshint( _src.JSHINT_CONF ))
.pipe(jshint.reporter(stylish));
// .pipe(jshint.reporter('fail')); // uncomment this line to stop build on error
});
diff --git a/js/app/login.js b/js/app/login.js
index 568b1f7a..192a289e 100644
--- a/js/app/login.js
+++ b/js/app/login.js
@@ -627,6 +627,8 @@ define([
* main init "landing" page
*/
$(function(){
+ // set Dialog default config
+ Util.initDefaultBootboxConfig();
// show app information in browser console
Util.showVersionInfo();
diff --git a/js/app/map/map.js b/js/app/map/map.js
index de55da41..51dbb670 100644
--- a/js/app/map/map.js
+++ b/js/app/map/map.js
@@ -214,7 +214,7 @@ define([
tooltipOptions.id = systemId;
tooltipOptions.highlight = highlight;
- tooltipOptions.title = "";
+ tooltipOptions.title = '';
tooltipOptions.title += ' ' + userCounter;
// show system head
@@ -1794,7 +1794,7 @@ define([
// init context menu
system.contextMenu({
- menuSelector: "#" + config.systemContextMenuId,
+ menuSelector: '#' + config.systemContextMenuId,
menuSelected: function (params) {
// click action
@@ -2136,7 +2136,7 @@ define([
});
$(mapContainer).contextMenu({
- menuSelector: "#" + config.mapContextMenuId,
+ menuSelector: '#' + config.mapContextMenuId,
menuSelected: function (params) {
// click action
@@ -2474,7 +2474,7 @@ define([
* must be triggered manually on demand
*/
$(connection.canvas).contextMenu({
- menuSelector: "#" + config.connectionContextMenuId,
+ menuSelector: '#' + config.connectionContextMenuId,
menuSelected: function (params){
var action = params.selectedMenu.attr('data-action');
diff --git a/js/app/map/scrollbar.js b/js/app/map/scrollbar.js
index 8eddcacd..5563d312 100644
--- a/js/app/map/scrollbar.js
+++ b/js/app/map/scrollbar.js
@@ -35,7 +35,7 @@ define([
updateOnBrowserResize: true,
updateOnContentResize: true,
autoExpandHorizontalScroll: true,
- autoScrollOnFocus: "div"
+ autoScrollOnFocus: 'div'
},
mouseWheel:{
enable: false, // scroll weel currently disabled
diff --git a/js/app/map/util.js b/js/app/map/util.js
index ba0fe488..90590827 100644
--- a/js/app/map/util.js
+++ b/js/app/map/util.js
@@ -515,7 +515,7 @@ define([
if(objectId > 0){
// get current map config
var storageKey = getLocalStoragePrefixByType(type) + objectId;
- Util.localforage.getItem(mapStorageKey).then(function(data) {
+ Util.localforage.getItem(storageKey).then(function(data) {
if(
data &&
data.hasOwnProperty(key)
diff --git a/js/app/mappage.js b/js/app/mappage.js
index 08f16fc8..441f0de8 100644
--- a/js/app/mappage.js
+++ b/js/app/mappage.js
@@ -19,6 +19,9 @@ define([
* main init "map" page
*/
$(function(){
+ // set Dialog default config
+ Util.initDefaultBootboxConfig();
+
// load page
$('body').loadPageStructure();
diff --git a/js/app/module_map.js b/js/app/module_map.js
index 70bfd3cb..3bb7774a 100644
--- a/js/app/module_map.js
+++ b/js/app/module_map.js
@@ -649,7 +649,7 @@ define([
data.defaultMapId
){
mapDataIndex = Util.getCurrentMapDataIndex(data.defaultMapId);
- mapKeyTabSelector = 'nth-child(' + ( mapDataIndex + 1 ) + ')'
+ mapKeyTabSelector = 'nth-child(' + ( mapDataIndex + 1 ) + ')';
}
// ==============================================================
diff --git a/js/app/page.js b/js/app/page.js
index 325a8f7a..2802259f 100644
--- a/js/app/page.js
+++ b/js/app/page.js
@@ -909,11 +909,10 @@ define([
}
if (
- typeof document.addEventListener === 'undefined' ||
- typeof document[hidden] === 'undefined'
+ typeof document.addEventListener !== 'undefined' &&
+ typeof document[hidden] !== 'undefined'
){
- // the current browser does not support this feature
- }else{
+ // the current browser supports this feature
// Handle page visibility change
// check once initial -> in case the tab is hidden on page load
diff --git a/js/app/render.js b/js/app/render.js
index e139c6a1..66676088 100644
--- a/js/app/render.js
+++ b/js/app/render.js
@@ -4,7 +4,7 @@
define(['jquery', 'mustache'], function($, Mustache) {
- "use strict";
+ 'use strict';
/**
* init function will be called before and after a new module is loaded
@@ -34,7 +34,7 @@ define(['jquery', 'mustache'], function($, Mustache) {
// check for an id, if module already exists, do not insert again
if(
data.id === 'undefined' ||
- $("#" + data.id).length === 0
+ $('#' + data.id).length === 0
){
var content = Mustache.render(template, data);
diff --git a/js/app/ui/dialog/manual.js b/js/app/ui/dialog/manual.js
index a796f8ad..01b4e3fd 100644
--- a/js/app/ui/dialog/manual.js
+++ b/js/app/ui/dialog/manual.js
@@ -128,7 +128,7 @@ define([
disableOnScrollEvent = true;
// scroll to anchor
- scrollspyElement.mCustomScrollbar("scrollTo", $(this).attr('data-target'));
+ scrollspyElement.mCustomScrollbar('scrollTo', $(this).attr('data-target'));
var mainNavigationLiElement = $(this).parent('.' + config.dialogNavigationListItemClass);
diff --git a/js/app/ui/logo.js b/js/app/ui/logo.js
index fa8052a4..9d88dc84 100644
--- a/js/app/ui/logo.js
+++ b/js/app/ui/logo.js
@@ -23,6 +23,7 @@ define([
/**
* draws the pathfinder logo to an element and add some animation features
* @param callback
+ * @param enableHover
*/
$.fn.drawLogo = function(callback, enableHover){
var canvasElement = $(this);
@@ -31,22 +32,22 @@ define([
logo: {
strokepath: [
{
- path: "M195.9 9.6 226.9 297.1 354.2 365 196.2 9.8 ",
+ path: 'M195.9 9.6 226.9 297.1 354.2 365 196.2 9.8 ',
strokeColor: '#477372',
duration: 1600
},
{
- path: "M1.7 361.3 73.9 284.9 178.6 286.7 2.2 361.4 ",
+ path: 'M1.7 361.3 73.9 284.9 178.6 286.7 2.2 361.4 ',
strokeColor: '#5cb85c',
duration: 1000
},
{
- path: "M192.9 286.7 121.2 318.6 335.6 363.5 193.4 286.7 ",
+ path: 'M192.9 286.7 121.2 318.6 335.6 363.5 193.4 286.7 ',
strokeColor: '#375959',
duration: 900
},
{
- path: "M202.8 141.9 0.2 352.6 189.1 0.8 202.7 141.3 ",
+ path: 'M202.8 141.9 0.2 352.6 189.1 0.8 202.7 141.3 ',
strokeColor: '#63676a',
duration: 1500
}
diff --git a/js/app/util.js b/js/app/util.js
index b94e5524..8c9eaade 100644
--- a/js/app/util.js
+++ b/js/app/util.js
@@ -821,6 +821,15 @@ define([
console.info('PATHFINDER ' + versionNumber);
};
+ /**
+ * set default configuration for "Bootbox" dialogs
+ */
+ var initDefaultBootboxConfig = function(){
+ bootbox.setDefaults({
+ onEscape: true // enables close dialogs on ESC key
+ });
+ };
+
/**
* get the current main trigger delay for the main trigger functions
* optional in/decrease the delay
@@ -1744,6 +1753,7 @@ define([
config: config,
localforage: localforage,
showVersionInfo: showVersionInfo,
+ initDefaultBootboxConfig: initDefaultBootboxConfig,
getCurrentTriggerDelay: getCurrentTriggerDelay,
getServerTime: getServerTime,
convertTimestampToServerTime: convertTimestampToServerTime,