- added shortcut for all dialogs, to force close (key: "ESC"), #133

- added ".jshintrc" config file
- fixed some JS code style issues
This commit is contained in:
Exodus4D
2016-08-14 15:57:56 +02:00
parent 835d3563d0
commit 4987e3e8f1
11 changed files with 36 additions and 21 deletions

View File

@@ -627,6 +627,8 @@ define([
* main init "landing" page
*/
$(function(){
// set Dialog default config
Util.initDefaultBootboxConfig();
// show app information in browser console
Util.showVersionInfo();

View File

@@ -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 += '&nbsp;' + userCounter;
// show system head
@@ -1531,9 +1531,9 @@ define([
{icon: 'fa-reply fa-rotate-180', action: 'change_status', text: 'change status', subitems: [
{subIcon: 'fa-clock-o', subAction: 'wh_eol', subText: 'toggle EOL'},
{subDivider: true},
{subIcon: 'fa-circle', subAction: 'status_fresh', subText: 'stage 0 (fresh)'},
{subIcon: 'fa-adjust', subAction: 'status_reduced', subText: 'stage 1 (reduced)'},
{subIcon: 'fa-circle-o', subAction: 'status_critical', subText: 'stage 2 (critical)'}
{subIcon: 'fa-circle', subAction: 'status_fresh', subText: 'stage 1 (fresh)'},
{subIcon: 'fa-adjust', subAction: 'status_reduced', subText: 'stage 2 (reduced)'},
{subIcon: 'fa-circle-o', subAction: 'status_critical', subText: 'stage 3 (critical)'}
]},
{divider: true, action: 'delete_connection'},
@@ -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');

View File

@@ -35,7 +35,7 @@ define([
updateOnBrowserResize: true,
updateOnContentResize: true,
autoExpandHorizontalScroll: true,
autoScrollOnFocus: "div"
autoScrollOnFocus: 'div'
},
mouseWheel:{
enable: false, // scroll weel currently disabled

View File

@@ -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)

View File

@@ -19,6 +19,9 @@ define([
* main init "map" page
*/
$(function(){
// set Dialog default config
Util.initDefaultBootboxConfig();
// load page
$('body').loadPageStructure();

View File

@@ -649,7 +649,7 @@ define([
data.defaultMapId
){
mapDataIndex = Util.getCurrentMapDataIndex(data.defaultMapId);
mapKeyTabSelector = 'nth-child(' + ( mapDataIndex + 1 ) + ')'
mapKeyTabSelector = 'nth-child(' + ( mapDataIndex + 1 ) + ')';
}
// ==============================================================

View File

@@ -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

View File

@@ -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);

View File

@@ -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);

View File

@@ -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
}

View File

@@ -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,