Adaptation script d'intégration au site segal.bzh

This commit is contained in:
Fabrice PENHOËT 2023-03-12 19:41:55 +01:00
parent d40f5e9d2d
commit a76ea60192
15 changed files with 70 additions and 66 deletions

View File

@ -13,7 +13,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
@ -43,52 +43,52 @@ var initialise = function () { return __awaiter(void 0, void 0, void 0, function
case 0:
_a.trys.push([0, 2, , 3]);
converter = new FreeDatas2HTML("CSV");
converter.parser.setRemoteSource({ url: "https://www.segal.bzh/data/medias/partenaires/partenaires.csv" });
converter.parser.setRemoteSource({ url: "http://localhost:8080/datas/partenaires.csv" });
return [4, converter.run()];
case 1:
_a.sent();
renderSettings = {
allBegining: "<ul class=\"ulpartenairelvl1\">",
allEnding: "</ul>",
datasLinesDisplaying: "<li><h3>##0##</h3><ul class=\"ulpartenairelvl2\"><li>##1##</li>##2##<li>Lieu(x) d'exercice : ##4####5##.</li>##6####7####8##</ul></li>"
datasLinesDisplaying: "<li><h3>##0##</h3><ul class=\"ulpartenairelvl2\"><li>##1##</li>##2##<li>Lieu(x) d'exercice : ##4####5##</li>##6####7####8##</ul></li>"
};
rendName2HTML = function (values) {
if (values["Fiche partenaire"] !== undefined && values["Fiche partenaire"].trim() !== "")
return "<a href=\"" + values['Fiche partenaire'].trim() + "\" title=\"Fiche partenaire de " + values["Nom commercial"].trim() + "\">" + values["Nom commercial"].trim() + "</a>";
return "<a href=\"".concat(values['Fiche partenaire'].trim(), "\" title=\"Fiche partenaire de ").concat(values["Nom commercial"].trim(), "\">").concat(values["Nom commercial"].trim(), "</a>");
else
return values["Nom commercial"].trim();
};
rendSSDomaine2HTML = function (values) {
if (values["Sous activités"] !== undefined && values["Sous activités"].trim() !== "")
return "<li>" + values["Sous activités"].trim() + "</li>";
return "<li>".concat(values["Sous activités"].trim(), "</li>");
else
return "";
};
rendLieuxVente2HTML = function (values) {
if (values["Ville (si adresse pertinente)"] !== undefined && values["Ville (si adresse pertinente)"].trim() !== "")
return values["Adresse (si pertinente)"].trim() + ", " + values["Ville (si adresse pertinente)"].trim();
return "".concat(values["Adresse (si pertinente)"].trim(), ", ").concat(values["Ville (si adresse pertinente)"].trim(), ". ");
else
return "";
};
rendTel2HTML = function (values) {
if (values["Téléphone"].trim() !== "")
return "<li>&#9990; <a href=\"tel:" + values['Téléphone'].trim() + "\" title=\"Appelez " + values['Nom commercial'].trim() + "\">" + values['Téléphone'].trim() + "</a></li>";
return "<li>&#9990; <a href=\"tel:".concat(values['Téléphone'].trim(), "\" title=\"Appelez ").concat(values['Nom commercial'].trim(), "\">").concat(values['Téléphone'].trim(), "</a></li>");
else
return "";
};
rendEmail2HTML = function (values) {
if (values["Courriel"].trim() !== "")
return "<li>&#128231 <a href=\"mailto:" + values['Courriel'].trim() + "?subject=Le segal\">Courriel</a></li>";
return "<li>&#128231 <a href=\"mailto:".concat(values['Courriel'].trim(), "?subject=Le segal\">Courriel</a></li>");
else
return "";
};
rendSite2HTML = function (values) {
if (values["www"].trim() !== "")
return "<li><a href=\"" + values['www'].trim() + "\" target=\"_blank\" rel='noopener'>Sa page internet</a></li>";
return "<li><a href=\"".concat(values['www'].trim(), "\" target=\"_blank\" rel='noopener'>Sa page internet</a></li>");
else if (values["FB"].trim() !== "")
return "<li><a href=\"" + values['FB'].trim() + "\" target=\"_blank\" rel='noopener'>Sa page facebook</a></li>";
return "<li><a href=\"".concat(values['FB'].trim(), "\" target=\"_blank\" rel='noopener'>Sa page facebook</a></li>");
else if (values["IG"].trim() !== "")
return "<li><a href=\"" + values['IG'].trim() + "\" target=\"_blank\" rel='noopener'>Sa page instagram</a></li>";
return "<li><a href=\"".concat(values['IG'].trim(), "\" target=\"_blank\" rel='noopener'>Sa page instagram</a></li>");
else
return "";
};

View File

@ -13,7 +13,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
@ -84,28 +84,28 @@ var FreeDatas2HTML = (function () {
set: function (elt) {
this._datasViewElt = FreeDatas2HTML.checkInDOMById(elt);
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(FreeDatas2HTML.prototype, "datas", {
get: function () {
return this._datas;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(FreeDatas2HTML.prototype, "fields", {
get: function () {
return this._fields;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(FreeDatas2HTML.prototype, "nbDatasValid", {
get: function () {
return this._nbDatasValid;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(FreeDatas2HTML.prototype, "fields2Rend", {
@ -126,14 +126,14 @@ var FreeDatas2HTML = (function () {
}
}
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(FreeDatas2HTML.prototype, "datas2Rend", {
get: function () {
return this._datas2Rend;
},
enumerable: true,
enumerable: false,
configurable: true
});
FreeDatas2HTML.prototype.getSortingFunctionForField = function (datasFieldNb) {
@ -216,7 +216,7 @@ var FreeDatas2HTML = (function () {
this._datasSortingFunctions.push(checkedFunction);
}
},
enumerable: true,
enumerable: false,
configurable: true
});
FreeDatas2HTML.prototype.refreshView = function (paginationSelected) {

View File

@ -26,7 +26,7 @@ var Pagination = (function () {
}
this._selectedValue = value;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(Pagination.prototype, "options", {
@ -55,14 +55,14 @@ var Pagination = (function () {
}
this._options = options;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(Pagination.prototype, "pages", {
get: function () {
return this._pages;
},
enumerable: true,
enumerable: false,
configurable: true
});
Pagination.prototype.options2HTML = function () {

View File

@ -13,7 +13,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
@ -71,7 +71,7 @@ var ParserForCSV = (function () {
get: function () {
return this._datasRemoteSource;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(ParserForCSV.prototype, "datas2Parse", {
@ -84,21 +84,21 @@ var ParserForCSV = (function () {
else
this._datas2Parse = datas.trim();
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(ParserForCSV.prototype, "parseResults", {
get: function () {
return this._parseResults;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(ParserForCSV.prototype, "privateOptions", {
get: function () {
return this._privateOptions;
},
enumerable: true,
enumerable: false,
configurable: true
});
ParserForCSV.prototype.parse = function () {

View File

@ -13,7 +13,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
@ -55,14 +55,14 @@ var ParserForHTML = (function () {
get: function () {
return this._datasRemoteSource;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(ParserForHTML.prototype, "document2Parse", {
get: function () {
return this._document2Parse;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(ParserForHTML.prototype, "fieldsSelector", {
@ -75,7 +75,7 @@ var ParserForHTML = (function () {
else
this._fieldsSelector = selector.trim();
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(ParserForHTML.prototype, "rowsSelector", {
@ -88,7 +88,7 @@ var ParserForHTML = (function () {
else
this._rowsSelector = selector.trim();
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(ParserForHTML.prototype, "datasSelector", {
@ -101,14 +101,14 @@ var ParserForHTML = (function () {
else
this._datasSelector = selector.trim();
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(ParserForHTML.prototype, "parseResults", {
get: function () {
return this._parseResults;
},
enumerable: true,
enumerable: false,
configurable: true
});
ParserForHTML.prototype.parse = function () {

View File

@ -13,7 +13,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
@ -52,7 +52,7 @@ var ParserForJSON = (function () {
get: function () {
return this._datasRemoteSource;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(ParserForJSON.prototype, "datas2Parse", {
@ -65,14 +65,14 @@ var ParserForJSON = (function () {
else
this._datas2Parse = datas.trim();
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(ParserForJSON.prototype, "parseResults", {
get: function () {
return this._parseResults;
},
enumerable: true,
enumerable: false,
configurable: true
});
ParserForJSON.prototype.parse = function () {

View File

@ -32,7 +32,7 @@ var RemoteSource = (function () {
this._url = url.trim();
}
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(RemoteSource.prototype, "headers", {
@ -50,7 +50,7 @@ var RemoteSource = (function () {
this._headers.push({ key: header.key, value: header.value.trim() });
}
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(RemoteSource.prototype, "withCredentials", {
@ -60,7 +60,7 @@ var RemoteSource = (function () {
set: function (credentials) {
this._withCredentials = credentials;
},
enumerable: true,
enumerable: false,
configurable: true
});
RemoteSource.prototype.getFetchSettings = function () {

View File

@ -16,7 +16,7 @@ var Render = (function () {
else
this._fields = fields;
},
enumerable: true,
enumerable: false,
configurable: true
});
Render.prototype.rend2HTML = function () {

View File

@ -39,14 +39,14 @@ var SearchEngine = (function () {
get: function () {
return this._converter;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(SearchEngine.prototype, "datasViewElt", {
get: function () {
return this._datasViewElt;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(SearchEngine.prototype, "btnTxt", {
@ -59,21 +59,21 @@ var SearchEngine = (function () {
else
console.error(errors.searchBtnTxtFail);
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(SearchEngine.prototype, "inputValue", {
get: function () {
return this._inputValue;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(SearchEngine.prototype, "fields2Search", {
get: function () {
return this._fields2Search;
},
enumerable: true,
enumerable: false,
configurable: true
});
SearchEngine.prototype.filter2HTML = function () {
@ -81,13 +81,13 @@ var SearchEngine = (function () {
this.placeholder = "Please enter at least NB characters.";
var html = "<form id=\"freeDatas2HTMLSearch\">";
if (this.label !== "")
html += "<label for=\"freeDatas2HTMLSearchTxt\">" + this.label + "</label>";
html += "<label for=\"freeDatas2HTMLSearchTxt\">".concat(this.label, "</label>");
html += "<input type=\"search\" id=\"freeDatas2HTMLSearchTxt\" name=\"freeDatas2HTMLSearchTxt\"";
if (this.nbCharsForSearch > 0)
html += " placeholder=\"" + this.placeholder.replace("NB", "" + this.nbCharsForSearch) + "\"";
html += " placeholder=\"".concat(this.placeholder.replace("NB", "" + this.nbCharsForSearch), "\"");
else if (this.placeholder !== "")
html += " placeholder=\"" + this.placeholder + "\"";
html += ">&nbsp;<input type=\"submit\" id=\"freeDatas2HTMLSearchBtn\" value=\"" + this._btnTxt + "\"></form>";
html += " placeholder=\"".concat(this.placeholder, "\"");
html += ">&nbsp;<input type=\"submit\" id=\"freeDatas2HTMLSearchBtn\" value=\"".concat(this._btnTxt, "\"></form>");
this._datasViewElt.eltDOM.innerHTML = html;
var searchInput = document.getElementById("freeDatas2HTMLSearchTxt"), mySearch = this;
searchInput.addEventListener("input", function (e) {

View File

@ -26,49 +26,49 @@ var Selector = (function () {
get: function () {
return this._converter;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(Selector.prototype, "datasViewElt", {
get: function () {
return this._datasViewElt;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(Selector.prototype, "datasFieldNb", {
get: function () {
return this._datasFieldNb;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(Selector.prototype, "name", {
get: function () {
return this._name;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(Selector.prototype, "selectedValues", {
get: function () {
return this._selectedValues;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(Selector.prototype, "separator", {
get: function () {
return this._separator;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(Selector.prototype, "values", {
get: function () {
return this._values;
},
enumerable: true,
enumerable: false,
configurable: true
});
Selector.prototype.setValues = function () {

View File

@ -17,21 +17,21 @@ var SortingField = (function () {
get: function () {
return this._converter;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(SortingField.prototype, "datasFieldNb", {
get: function () {
return this._datasFieldNb;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(SortingField.prototype, "fieldsDOMSelector", {
get: function () {
return this._fieldsDOMSelector;
},
enumerable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(SortingField.prototype, "order", {
@ -41,7 +41,7 @@ var SortingField = (function () {
set: function (setting) {
this._order = setting;
},
enumerable: true,
enumerable: false,
configurable: true
});
SortingField.prototype.field2HTML = function () {

View File

@ -16,7 +16,7 @@ var MixedFieldsRender = (function () {
else
this._fields = fields;
},
enumerable: true,
enumerable: false,
configurable: true
});
MixedFieldsRender.prototype.rend2HTML = function () {

View File

@ -1 +1,2 @@
;
export {};

View File

@ -0,0 +1 @@
export {};

View File

@ -7,6 +7,7 @@ const initialise=async () =>
{
// Création d'un convertisseur parsant des données transmises en JSON :
const converter=new FreeDatas2HTML("CSV");
//converter.parser.setRemoteSource({ url: "http://localhost:8080/datas/partenaires.csv"});
converter.parser.setRemoteSource({ url: "https://www.segal.bzh/data/medias/partenaires/partenaires.csv"});
// Parsage des données, qui ne sont pas encore affichées :
await converter.run();
@ -15,8 +16,9 @@ const initialise=async () =>
{
allBegining: "<ul class=\"ulpartenairelvl1\">",
allEnding: "</ul>",
datasLinesDisplaying: `<li><h3>##0##</h3><ul class=\"ulpartenairelvl2\"><li>##1##</li>##2##<li>Lieu(x) d'exercice : ##4####5##.</li>##6####7####8##</ul></li>`
datasLinesDisplaying: `<li><h3>##0##</h3><ul class=\"ulpartenairelvl2\"><li>##1##</li>##2##<li>Lieu(x) d'exercice : ##4####5##</li>##6####7####8##</ul></li>`
};
// Fonctions spécifiques pour créer les liens hypertextes :
const rendName2HTML=(values: {[index: string]:string} ) : string =>
{
@ -37,10 +39,10 @@ const initialise=async () =>
const rendLieuxVente2HTML=(values: {[index: string]:string} ) : string =>
{
if(values["Ville (si adresse pertinente)"] !== undefined && values["Ville (si adresse pertinente)"].trim() !== "")
return `${values["Adresse (si pertinente)"].trim()}, ${values["Ville (si adresse pertinente)"].trim()}`;
return `${values["Adresse (si pertinente)"].trim()}, ${values["Ville (si adresse pertinente)"].trim()}. `;
else
return "";
};
};
const rendTel2HTML=(values: {[index: string]:string} ) : string =>
{