[TASK] Optimize code

This commit is contained in:
Xaver Maierhofer 2018-08-03 20:08:08 +02:00
parent e1aa152055
commit 9c596531e2
No known key found for this signature in database
GPG Key ID: 7FDCE23FD2EC9FE8
4 changed files with 15 additions and 23 deletions

View File

@ -97,8 +97,7 @@ define(['filters/nodefilter'], function (NodeFilter) {
setData: setData,
addFilter: addFilter,
removeFilter: removeFilter,
watchFilters: watchFilters,
refresh: refresh
watchFilters: watchFilters
};
};
});

View File

@ -27,8 +27,7 @@ define(['map/clientlayer', 'map/labellayer', 'map/button', 'leaflet', 'map/activ
document.querySelector('.leaflet-control-layers').classList.add('leaflet-control-layers-expanded');
}
function setActiveArea() {
setTimeout(function () {
function mapActiveArea() {
map.setActiveArea({
position: 'absolute',
left: sidebar.getWidth() + 'px',
@ -36,20 +35,17 @@ define(['map/clientlayer', 'map/labellayer', 'map/button', 'leaflet', 'map/activ
top: 0,
bottom: 0
});
}, 300);
}
function setActiveArea() {
setTimeout(mapActiveArea, 300);
}
var el = document.createElement('div');
el.classList.add('map');
map = L.map(el, options);
map.setActiveArea({
position: 'absolute',
left: sidebar.getWidth() + 'px',
right: 0,
top: 0,
bottom: 0
});
mapActiveArea();
var now = new Date();
config.mapLayers.forEach(function (item, i) {

View File

@ -22,7 +22,7 @@ define(['polyglot', 'moment', 'helper'], function (Polyglot, moment, helper) {
}
function getLocale(input) {
var language = input || navigator.languages && navigator.languages[0] || navigator.language || navigator.userLanguage;
var language = input || navigator.languages && navigator.languages[0] || navigator.language;
var locale = config.supportedLocale[0];
config.supportedLocale.some(function (item) {
if (language.indexOf(item) !== -1) {

View File

@ -50,10 +50,7 @@ define(function () {
var ca = a.split('');
var cb = b.split('');
var diff = this.findIndex(ca, function (c, index) {
if (cb[index] && c === cb[index]) {
return false;
}
return true;
return !(cb[index] && c === cb[index]);
});
if (diff === -1) {
if (cb.length > ca.length) {