v1.1.1 (#233)
* fixed #194 PHP 5.6 error * - closed #102 added "set waypoint/destination" context menu to route finder module - update "Select2" 4.0.0 -> 4.0.3 - update "Font Awesome" 4.6.1 -> 4.6.3 * - added *.js files for develop branch * - closed #195 fixed "BASE" dir for subDir installations - fixed "Home" menu link * - #195 improved js load path * - added "clear cache" function for manually cache clearing to /setup #200 #105 #158 - added cache size information to /setup - added current pathfinder "VERSION" to /setup - updated "requireJs" 2.1.20 ->2.2.0 - removed unnecessary page cache timings from static templates (page cache) * - added "document_root", "port", "protocol" and "PHP framework version" to /setup page - added new "shattered" wormhole types to "signature table", closed #182, #179 * - added new "delete old signatures" option to "signature reader" dialog, closed #95 * - added new housekeeping cronjob für cached files, closed #200 - added new cache size information to /setup page * - fixed signature groupId/typeId "overwriting" for already known signatures. closed #207 - improved system search dialog. Added trim(); before "api/signatures-> search" request * updated README.me * fixed PHP error "default object from empty value", closed #209 * reduced image file size * - added local storage (IndexedDB) - added local storage for map scroll position. closed #69 * - added "notice" panel for upcoming release information - improved layout for "release dialog" (GitHub API) - improved pagespeed (removed render blocking javascripts) - improved map scrollbar configuration - improved Chrome browser custom scrollbar layout - removed "sign up" buttons from "map panels", closed #214 * - fixed some session and cookie bugs * - added new requirement check for `max_input_vars` to /setup URL, closed #224 * - fixed isWormhole(); bug * -v1.1.1 added js build files
This commit is contained in:
@@ -10,6 +10,7 @@ define([
|
||||
'bootbox',
|
||||
'app/ccp',
|
||||
'app/map/magnetizing',
|
||||
'app/map/scrollbar',
|
||||
'dragToSelect',
|
||||
'select2',
|
||||
'app/map/contextmenu',
|
||||
@@ -65,6 +66,9 @@ define([
|
||||
systemDialogId: 'pf-system-dialog', // id for system dialog
|
||||
systemDialogSelectClass: 'pf-system-dialog-select', // class for system select Element
|
||||
|
||||
// local storage
|
||||
mapLocalStoragePrefix: 'map_', // prefix for map local storage key
|
||||
|
||||
// system security classes
|
||||
systemSec: 'pf-system-sec',
|
||||
systemSecHigh: 'pf-system-sec-highSec',
|
||||
@@ -2011,7 +2015,7 @@ define([
|
||||
case 'add_first_waypoint':
|
||||
case 'add_last_waypoint':
|
||||
systemData = system.getSystemData();
|
||||
setDestination(systemData, action);
|
||||
Util.setDestination(systemData, action);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2063,68 +2067,6 @@ define([
|
||||
system.singleDoubleClick(single, double);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* set new destination for a system
|
||||
* -> CREST request
|
||||
* @param systemData
|
||||
* @param type
|
||||
*/
|
||||
var setDestination = function(systemData, type){
|
||||
|
||||
var description = '';
|
||||
switch(type){
|
||||
case 'set_destination':
|
||||
description = 'Set destination';
|
||||
break;
|
||||
case 'add_first_waypoint':
|
||||
description = 'Set first waypoint';
|
||||
break;
|
||||
case 'add_last_waypoint':
|
||||
description = 'Set new waypoint';
|
||||
break;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.setDestination,
|
||||
data: {
|
||||
clearOtherWaypoints: (type === 'set_destination') ? 1 : 0,
|
||||
first: (type === 'add_last_waypoint') ? 0 : 1,
|
||||
systemData: [{
|
||||
systemId: systemData.systemId,
|
||||
name: systemData.name
|
||||
}]
|
||||
},
|
||||
context: {
|
||||
description: description
|
||||
},
|
||||
dataType: 'json'
|
||||
}).done(function(responseData){
|
||||
if(
|
||||
responseData.systemData &&
|
||||
responseData.systemData.length > 0
|
||||
){
|
||||
for (var j = 0; j < responseData.systemData.length; j++) {
|
||||
Util.showNotify({title: this.description, text: 'System: ' + responseData.systemData[j].name, type: 'success'});
|
||||
}
|
||||
}
|
||||
|
||||
if(
|
||||
responseData.error &&
|
||||
responseData.error.length > 0
|
||||
){
|
||||
for(var i = 0; i < responseData.error.length; i++){
|
||||
Util.showNotify({title: this.description + ' error', text: 'System: ' + responseData.error[i].message, type: 'error'});
|
||||
}
|
||||
}
|
||||
|
||||
}).fail(function( jqXHR, status, error) {
|
||||
var reason = status + ' ' + error;
|
||||
Util.showNotify({title: jqXHR.status + ': ' + this.description, text: reason, type: 'warning'});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* mark a dom element (map, system, connection) as changed
|
||||
*/
|
||||
@@ -2883,9 +2825,6 @@ define([
|
||||
|
||||
var content = Mustache.render(template, data);
|
||||
|
||||
// disable modal focus event -> otherwise select2 is not working! -> quick fix
|
||||
$.fn.modal.Constructor.prototype.enforceFocus = function() {};
|
||||
|
||||
var systemDialog = bootbox.dialog({
|
||||
title: 'Add new system',
|
||||
message: content,
|
||||
@@ -3506,6 +3445,21 @@ define([
|
||||
function switchTabCallback( mapName, mapContainer ){
|
||||
Util.showNotify({title: 'Map initialized', text: mapName + ' - loaded', type: 'success'});
|
||||
|
||||
var mapWrapper = mapContainer.parents('.' + config.mapWrapperClass);
|
||||
|
||||
// auto scroll map to previous position
|
||||
var promiseStore = getMapData( mapContainer.data('id') );
|
||||
promiseStore.then(function(data) {
|
||||
// This code runs once the value has been loaded
|
||||
// from the offline store.
|
||||
if(
|
||||
data &&
|
||||
data.offsetX
|
||||
){
|
||||
mapWrapper.scrollToX(data.offsetX);
|
||||
}
|
||||
});
|
||||
|
||||
if( config.mapMagnetizer === true ){
|
||||
mapContainer.initMagnetizer();
|
||||
}
|
||||
@@ -3522,43 +3476,61 @@ define([
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* get stored map data from client cache (IndexedDB)
|
||||
* @param mapId
|
||||
* @returns {*} promise
|
||||
*/
|
||||
var getMapData = function(mapId){
|
||||
if(mapId > 0){
|
||||
var mapStorageKey = config.mapLocalStoragePrefix + mapId;
|
||||
return Util.localforage.getItem(mapStorageKey);
|
||||
}else{
|
||||
console.error('Map local storage requires mapId > 0');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* store local map config to client cache (IndexedDB)
|
||||
* @param mapId
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
var storeMapData = function(mapId, key, value){
|
||||
if(mapId > 0){
|
||||
// get current map config
|
||||
var mapStorageKey = config.mapLocalStoragePrefix + mapId;
|
||||
Util.localforage.getItem(mapStorageKey).then(function(data) {
|
||||
// This code runs once the value has been loaded
|
||||
// from the offline store.
|
||||
data = (data === null) ? {} : data;
|
||||
// set/update value
|
||||
data[key] = value;
|
||||
Util.localforage.setItem(mapStorageKey, data);
|
||||
}).catch(function(err) {
|
||||
// This code runs if there were any errors
|
||||
console.error('Map local storage can not be accessed!');
|
||||
});
|
||||
}else{
|
||||
console.error('Map local storage requires mapId > 0');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* init scrollbar for Map element
|
||||
*/
|
||||
$.fn.initMapScrollbar = function(){
|
||||
// get Map Scrollbar
|
||||
var scrollableElement = $(this).find('.' + config.mapWrapperClass);
|
||||
initCustomScrollbar( scrollableElement );
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// add map overlays after scrollbar is initialized
|
||||
// because of its absolute position
|
||||
scrollableElement.initMapOverlays();
|
||||
};
|
||||
|
||||
/**
|
||||
* init a custom scrollbar
|
||||
* @param scrollableElement
|
||||
*/
|
||||
var initCustomScrollbar = function( scrollableElement ){
|
||||
|
||||
// prevent multiple initialization
|
||||
$(scrollableElement).mCustomScrollbar('destroy');
|
||||
|
||||
// init custom scrollbars
|
||||
$(scrollableElement).mCustomScrollbar({
|
||||
axis: 'x',
|
||||
theme: 'light-thick',
|
||||
scrollInertia: 300,
|
||||
autoExpandScrollbar: false,
|
||||
scrollButtons:{
|
||||
scrollAmount: 30,
|
||||
enable: true
|
||||
},
|
||||
callbacks:{
|
||||
onTotalScrollOffset: 0,
|
||||
onTotalScrollBackOffset: 0,
|
||||
alwaysTriggerOffsets:true,
|
||||
scrollableElement.initCustomScrollbar({
|
||||
callbacks: {
|
||||
onScroll: function(){
|
||||
// scroll complete
|
||||
var mapElement = $(this).find('.' + config.mapClass);
|
||||
// store new map scrollOffset -> localDB
|
||||
storeMapData( mapElement.data('id'), 'offsetX', Math.abs(this.mcs.left) );
|
||||
},
|
||||
onScrollStart: function(){
|
||||
// hide all open xEditable fields
|
||||
$(this).find('.editable').editable('hide');
|
||||
@@ -3572,34 +3544,13 @@ define([
|
||||
$(mapElement).data('scrollLeft', this.mcs.left);
|
||||
$(mapElement).data('scrollTop', this.mcs.top);
|
||||
}
|
||||
},
|
||||
|
||||
advanced: {
|
||||
updateOnBrowserResize: true,
|
||||
updateOnContentResize: true,
|
||||
autoExpandHorizontalScroll: true,
|
||||
autoScrollOnFocus: "div"
|
||||
},
|
||||
mouseWheel:{
|
||||
enable: false, // scroll weel currently disabled
|
||||
scrollAmount: 'auto',
|
||||
axis: 'x',
|
||||
preventDefault: true
|
||||
},
|
||||
scrollbarPosition: 'inside',
|
||||
autoDraggerLength: true
|
||||
//autoHideScrollbar: false
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* scroll to a specific position in the map
|
||||
* @returns {*} // string or id
|
||||
*/
|
||||
$.fn.scrollTo = function(position){
|
||||
return this.each(function(){
|
||||
$(this).mCustomScrollbar('scrollTo', position);
|
||||
});
|
||||
// ---------------------------------------------------------------------------
|
||||
// add map overlays after scrollbar is initialized
|
||||
// because of its absolute position
|
||||
scrollableElement.initMapOverlays();
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
75
js/app/map/scrollbar.js
Normal file
75
js/app/map/scrollbar.js
Normal file
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* Created by Exodus on 26.06.2016.
|
||||
*/
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util'
|
||||
], function($, Init, Util) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* init map scrollbar
|
||||
* @param config
|
||||
* @returns {*}
|
||||
*/
|
||||
$.fn.initCustomScrollbar = function(config){
|
||||
|
||||
// default config -------------------------------------------------------------------------
|
||||
var defaultConfig = {
|
||||
axis: 'x',
|
||||
theme: 'light-thick',
|
||||
scrollInertia: 300,
|
||||
autoExpandScrollbar: false,
|
||||
scrollButtons:{
|
||||
scrollAmount: 30,
|
||||
enable: true
|
||||
},
|
||||
callbacks:{
|
||||
onTotalScrollOffset: 0,
|
||||
onTotalScrollBackOffset: 0,
|
||||
alwaysTriggerOffsets: true
|
||||
},
|
||||
|
||||
advanced: {
|
||||
updateOnBrowserResize: true,
|
||||
updateOnContentResize: true,
|
||||
autoExpandHorizontalScroll: true,
|
||||
autoScrollOnFocus: "div"
|
||||
},
|
||||
mouseWheel:{
|
||||
enable: false, // scroll weel currently disabled
|
||||
scrollAmount: 'auto',
|
||||
axis: 'x',
|
||||
preventDefault: true
|
||||
},
|
||||
scrollbarPosition: 'inside',
|
||||
autoDraggerLength: true
|
||||
//autoHideScrollbar: false
|
||||
};
|
||||
|
||||
// init -----------------------------------------------------------------------------------
|
||||
config = $.extend(true, {}, defaultConfig, config);
|
||||
|
||||
return this.each(function(){
|
||||
var scrollableElement = $(this);
|
||||
|
||||
// prevent multiple initialization
|
||||
scrollableElement.mCustomScrollbar('destroy');
|
||||
|
||||
// init custom scrollbars
|
||||
scrollableElement.mCustomScrollbar(config);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* scroll to a specific position in the map
|
||||
* demo: http://manos.malihu.gr/repository/custom-scrollbar/demo/examples/scrollTo_demo.html
|
||||
* @returns {*} // string or id
|
||||
*/
|
||||
$.fn.scrollToX = function(position){
|
||||
return this.each(function(){
|
||||
$(this).mCustomScrollbar('scrollTo', position);
|
||||
});
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user