- added shortcut for all dialogs, to force close (key: "ESC"), #133
- added ".jshintrc" config file. Used by Gulp build tasks - fixed some JS code style issues
This commit is contained in:
75
.jshintrc
Normal file
75
.jshintrc
Normal file
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -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 )
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
@@ -627,6 +627,8 @@ define([
|
||||
* main init "landing" page
|
||||
*/
|
||||
$(function(){
|
||||
// set Dialog default config
|
||||
Util.initDefaultBootboxConfig();
|
||||
|
||||
// show app information in browser console
|
||||
Util.showVersionInfo();
|
||||
|
||||
@@ -214,7 +214,7 @@ define([
|
||||
|
||||
tooltipOptions.id = systemId;
|
||||
tooltipOptions.highlight = highlight;
|
||||
tooltipOptions.title = "<i class='fa " + tooltipIconClass + "'></i>";
|
||||
tooltipOptions.title = '<i class="fa ' + tooltipIconClass + '"></i>';
|
||||
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');
|
||||
|
||||
@@ -35,7 +35,7 @@ define([
|
||||
updateOnBrowserResize: true,
|
||||
updateOnContentResize: true,
|
||||
autoExpandHorizontalScroll: true,
|
||||
autoScrollOnFocus: "div"
|
||||
autoScrollOnFocus: 'div'
|
||||
},
|
||||
mouseWheel:{
|
||||
enable: false, // scroll weel currently disabled
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -19,6 +19,9 @@ define([
|
||||
* main init "map" page
|
||||
*/
|
||||
$(function(){
|
||||
// set Dialog default config
|
||||
Util.initDefaultBootboxConfig();
|
||||
|
||||
// load page
|
||||
$('body').loadPageStructure();
|
||||
|
||||
|
||||
@@ -649,7 +649,7 @@ define([
|
||||
data.defaultMapId
|
||||
){
|
||||
mapDataIndex = Util.getCurrentMapDataIndex(data.defaultMapId);
|
||||
mapKeyTabSelector = 'nth-child(' + ( mapDataIndex + 1 ) + ')'
|
||||
mapKeyTabSelector = 'nth-child(' + ( mapDataIndex + 1 ) + ')';
|
||||
}
|
||||
|
||||
// ==============================================================
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user