Skip to content

Commit

Permalink
corrections pour la compilation d'openlayers et leaflet
Browse files Browse the repository at this point in the history
  • Loading branch information
pjjmunier committed Apr 20, 2018
1 parent b964613 commit 56d60c5
Show file tree
Hide file tree
Showing 57 changed files with 800 additions and 404 deletions.
20 changes: 12 additions & 8 deletions src/Common/Controls/DrawingDOM.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import Logger from "../../Common/Utils/LoggerByDefault";

var logger = Logger.getLogger("DrawingDOM");

var DrawingDOM = {

/**
Expand Down Expand Up @@ -255,7 +259,7 @@ var DrawingDOM = {
var ul = document.createElement("ul");
ul.className = "drawing-tools-flex-display";
var context = this;
/** li click handler function */
// li click handler function
function liClickHandler (e) {
/* jshint validthis: true */
// this == elem clicked
Expand Down Expand Up @@ -318,18 +322,18 @@ var DrawingDOM = {
* @returns {Object} hex and opacity formated values
*/
rgbaToHex : function (rgba) {
/** number to hex conversion */
// number to hex conversion
function hex (number) {
if (number > 255) {
throw "'" + number + "'' is greater than 255(0xff);";
throw new Error("'" + number + "'' is greater than 255(0xff);");
}
var str = Number(number).toString(16);
return ("0" + str).slice(-2);
}
var regex = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(0?.?\d+)\s*)?\)/;
var parsed = regex.exec(rgba);
if (!parsed) {
throw "Invalid format: " + rgba;
throw new Error("Invalid format: " + rgba);
}
var red = parsed[1];
var green = parsed[2];
Expand All @@ -356,7 +360,7 @@ var DrawingDOM = {
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
if (!hex) {
throw "Invalid format";
throw new Error("Invalid format");
}
hex = hex.replace(shorthandRegex, function (m, r, g, b) {
return r + r + g + g + b + b;
Expand Down Expand Up @@ -560,7 +564,7 @@ var DrawingDOM = {
ul.appendChild(li);
break;
default:
console.log("Unhandled geometry type for styling.");
logger.log("Unhandled geometry type for styling.");
}
div.appendChild(ul);
// apply button
Expand Down Expand Up @@ -632,11 +636,11 @@ var DrawingDOM = {
inputLabel.placeholder = options.placeholder;
inputLabel.id = options.inputId;
popup.appendChild(inputLabel);
/** blur */
// blur
inputLabel.onblur = function () {
options.applyFunc.call(this, inputLabel.value, true);
};
/** keyup */
// keyup
inputLabel.onkeyup = function (evtk) {
if (options.geomType === "Text" && evtk.keyCode === 13) {
options.applyFunc.call(this, inputLabel.value, true);
Expand Down
9 changes: 6 additions & 3 deletions src/Common/Controls/LocationSelectorDOM.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import ID from "../Utils/SelectorID";
import Logger from "../../Common/Utils/LoggerByDefault";

var logger = Logger.getLogger("LocationSelectorDOM");

var LocationSelectorDOM = {

Expand Down Expand Up @@ -163,21 +166,21 @@ var LocationSelectorDOM = {

switch (charCode) {
case 38: // arrow up
console.log("arrow up");
logger.log("arrow up");
current.className = "GPautoCompleteProposal";
prev.className = "GPautoCompleteProposal current";
prev.style.color = "#000000";
prev.style["background-color"] = "#CEDBEF";
break;
case 40: // arrow down
console.log("arrow down");
logger.log("arrow down");
current.className = "GPautoCompleteProposal";
next.className = "GPautoCompleteProposal current";
next.style.color = "#000000";
next.style["background-color"] = "#CEDBEF";
break;
case 13: // enter
console.log("enter");
logger.log("enter");
current.click(e);
break;
}
Expand Down
45 changes: 30 additions & 15 deletions src/Common/Controls/RouteDOM.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import ID from "../Utils/SelectorID";
import Logger from "../../Common/Utils/LoggerByDefault";

var logger = Logger.getLogger("RouteDOM");

var RouteDOM = {

Expand Down Expand Up @@ -156,7 +159,7 @@ var RouteDOM = {
form.setAttribute("onkeypress", "return event.keyCode != 13;"); // FIXME hack pour desactiver l'execution via 'enter' au clavier !

form.addEventListener("submit", function (e) {
console.log(e);
logger.log(e);
e.preventDefault();

// points
Expand All @@ -168,10 +171,10 @@ var RouteDOM = {
var startID = ID.index(start);
var endID = ID.index(end);

if ((document.getElementById(self._addUID("GPlocationOrigin_" + startID)).value == "" &&
document.getElementById(self._addUID("GPlocationOriginCoords_" + startID)).value == "") ||
(document.getElementById(self._addUID("GPlocationOrigin_" + endID)).value == "" &&
document.getElementById(self._addUID("GPlocationOriginCoords_" + endID)).value == "")) {
if ((document.getElementById(self._addUID("GPlocationOrigin_" + startID)).value === "" &&
document.getElementById(self._addUID("GPlocationOriginCoords_" + startID)).value === "") ||
(document.getElementById(self._addUID("GPlocationOrigin_" + endID)).value === "" &&
document.getElementById(self._addUID("GPlocationOriginCoords_" + endID)).value === "")) {
return false;
}

Expand All @@ -181,7 +184,7 @@ var RouteDOM = {
for (var i = 0; i < points.length; i++) {
var tag = points[i].childNodes[0].id;
id = ID.index(tag);
if (document.getElementById(self._addUID("GPlocationPoint_" + id)).className == "GPflexInput GPlocationStageFlexInput") {
if (document.getElementById(self._addUID("GPlocationPoint_" + id)).className === "GPflexInput GPlocationStageFlexInput") {
var resultStage = document.createElement("div");
resultStage.className = "GProuteResultsStages";
var resultStageLabel = document.createElement("div");
Expand All @@ -193,13 +196,13 @@ var RouteDOM = {
var elementCoords = document.getElementById(self._addUID("GPlocationOriginCoords_" + id));
var stageCoords = elementCoords.value;
var visible = (elementCoords.className === "GPlocationOriginVisible");
if (stageCoords != null && stageCoords != "" && visible) {
if (stageCoords !== null && stageCoords !== "" && visible) {
resultStageValue.innerHTML = stageCoords;
} else {
resultStageValue.innerHTML = document.getElementById(self._addUID("GPlocationOrigin_" + id)).value;
}
resultStage.appendChild(resultStageValue);
if (resultStageValue.innerHTML != "") {
if (resultStageValue.innerHTML !== "") {
document.getElementById(self._addUID("GProuteResultsStages")).appendChild(resultStage);
}
}
Expand Down Expand Up @@ -397,6 +400,9 @@ var RouteDOM = {
* Add Results Duration and Distance
* (results dynamically generate !)
* see event!
* @param {Number} distance - distance
* @param {Number} duration - duration
* @param {Function} fconvert - fconvert
*
* @returns {DOMElement} DOM element
*/
Expand Down Expand Up @@ -481,6 +487,8 @@ var RouteDOM = {
/**
* Add Results Details
* (results dynamically generate !)
* @param {Object[]} instructions - instructions
* @param {Function} fconvert - fconvert
*
* @returns {DOMElement} DOM element
*/
Expand Down Expand Up @@ -558,6 +566,9 @@ var RouteDOM = {
* see event !
* OVERWRITTEN BY LOCATIONSELECTOR !
* (version initial without LOCATIONSELECTOR PLUGIN)
* @param {Integer} n - n
* @param {String} text - text
* @param {Boolean} visibility - visibility
*
* @returns {DOMElement} DOM element
*/
Expand Down Expand Up @@ -636,9 +647,9 @@ var RouteDOM = {
var i = this.id.charAt(this.id.length - 1);
var j;
for (j = 1; j < 8; j++) {
if (i != j) {
if (i !== j) {
document.getElementById("GProuteOriginPointer" + j).checked = false;
if (document.getElementById("GProuteOriginCoords" + j).value == "Pointer un lieu sur la carte") {
if (document.getElementById("GProuteOriginCoords" + j).value === "Pointer un lieu sur la carte") {
document.getElementById("GProuteOriginCoords" + j).value = "";
document.getElementById("GProuteOrigin" + j).className = "GProuteOriginVisible";
document.getElementById("GProuteOriginCoords" + j).className = "GProuteOriginHidden";
Expand All @@ -657,7 +668,7 @@ var RouteDOM = {
} else {
document.getElementById("GProuteOriginCoords" + i).value = "Pointer un lieu sur la carte";
for (j = 1; j < 8; j++) {
if (i == j) {
if (i === j) {
document.getElementById("GProutePoint" + j).style.display = "flex";
} else {
document.getElementById("GProutePoint" + j).style.display = "none";
Expand All @@ -682,6 +693,7 @@ var RouteDOM = {
* see event !
* OVERWRITTEN BY LOCATIONSELECTOR !
* (version initial without LOCATIONSELECTOR PLUGIN)
* @param {Integer} n - n
*
* @returns {DOMElement} DOM element
*/
Expand All @@ -693,7 +705,7 @@ var RouteDOM = {
divRm.id = "GProuteStageRemove" + n;
divRm.className = "GProuteStageRemove";
divRm.title = "Supprimer l'étape";
if (n != 1 && n != 7) {
if (n !== 1 && n !== 7) {
divRm.addEventListener("click", function (e) {
var i = this.id.charAt(this.id.length - 1);
document.getElementById("GProutePoint" + i).className = "GPflexInput GProuteStageFlexInputHidden";
Expand Down Expand Up @@ -732,8 +744,8 @@ var RouteDOM = {
var lastStage = 1;
var nbStages = 0;
for (var i = 2; i < 7; i++) {
if (document.getElementById("GProutePoint" + i).className == "GPflexInput GProuteStageFlexInputHidden") {
if (lastStage == 1) {
if (document.getElementById("GProutePoint" + i).className === "GPflexInput GProuteStageFlexInputHidden") {
if (lastStage === 1) {
lastStage = i;
}
} else {
Expand All @@ -746,7 +758,7 @@ var RouteDOM = {
var exclusionsPictoTop = document.getElementById("GPshowRouteExclusionsPicto").style.top;
document.getElementById("GPshowRouteExclusionsPicto").style.top = (parseInt(exclusionsPictoTop, 10) + 33).toString() + "px";
}
if (nbStages == 4) {
if (nbStages === 4) {
document.getElementById("GProuteStageAdd").style.display = "none";
}
// gestionnaire d'evenement :
Expand All @@ -762,6 +774,7 @@ var RouteDOM = {
* see event!
* OVERWRITTEN BY LOCATIONSELECTOR !
* (version initial without LOCATIONSELECTOR PLUGIN)
* @param {Integer} n - n
*
* @returns {DOMElement} DOM element
*/
Expand Down Expand Up @@ -836,6 +849,7 @@ var RouteDOM = {
* Create Mode choice transport
* see event !
* FIXME event not useful
* @param {String[]} transports - transports
*
* @returns {DOMElement} DOM element
*/
Expand Down Expand Up @@ -1038,6 +1052,7 @@ var RouteDOM = {
* Create Exclusions Options
* see event !
* FIXME event not useful
* @param {Object[]} exclusions - exclusions
*
* @returns {DOMElement} DOM element
*/
Expand Down
29 changes: 24 additions & 5 deletions src/Common/Controls/SearchEngineDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ var SearchEngineDOM = {

/**
* Simple search input
* @param {String} placeholder - placeholder
*
* @returns {DOMElement} DOM element
*/
Expand Down Expand Up @@ -383,7 +384,9 @@ var SearchEngineDOM = {
// ############### Geocoding with advanced container ################# //
// ################################################################### //

/** ... */
/**
* @returns {DOMElement} DOM element
*/
_createAdvancedSearchPanelHeaderElement : function () {
// contexte d'execution
var self = this;
Expand Down Expand Up @@ -424,7 +427,11 @@ var SearchEngineDOM = {
return container;
},

/** ... */
/**
* @param {Object[]} advancedSearchCodes - codes
*
* @returns {DOMElement} DOM element
*/
_createAdvancedSearchPanelFormElement : function (advancedSearchCodes) {
// contexte d'execution
var self = this;
Expand Down Expand Up @@ -479,7 +486,10 @@ var SearchEngineDOM = {
return form;
},

/** ... */
/**
* @param {Object[]} codes - codes
* @returns {DOMElement} DOM element
*/
_createAdvancedSearchFormCodeElement : function (codes) {
// contexte d'execution
var self = this;
Expand Down Expand Up @@ -522,7 +532,9 @@ var SearchEngineDOM = {
return select;
},

/** ... */
/**
* @returns {DOMElement} DOM element
*/
_createAdvancedSearchFormInputElement : function () {
var input = document.createElement("input");
input.type = "submit";
Expand All @@ -549,6 +561,9 @@ var SearchEngineDOM = {
* "PositionOfInterest", "StreetAddress", ...
*
* @param {String} code - code of geocoding resource
* @param {Boolean} display - display
*
* @returns {DOMElement} DOM element
*/
_createAdvancedSearchFiltersTableElement : function (code, display) {
var container = document.createElement("div");
Expand All @@ -571,6 +586,8 @@ var SearchEngineDOM = {
* @param {String} filterAttributes.title - label
* @param {String} filterAttributes.description - description
* @param {String} filterAttributes.value - value
*
* @returns {DOMElement} DOM element
*/
_createAdvancedSearchFiltersAttributElement : function (filterAttributes) {
// INFORMATION
Expand Down Expand Up @@ -620,7 +637,9 @@ var SearchEngineDOM = {
// ################## Geocoding results container #################### //
// ################################################################### //

/** ... */
/**
* @returns {DOMElement} DOM element
*/
_createGeocodeResultsHeaderElement : function () {
var self = this;

Expand Down
Loading

0 comments on commit 56d60c5

Please sign in to comment.