- Introduced `auth.setup.js` to handle authentication against the live site and store the session state. - Created `live-race.spec.js` to test loading a live race page with an authenticated session, including cookie validation. - Added utility functions in `live-site-test-utils.js` for managing authentication, dismissing cookie banners, and checking UI states. - Included a temporary JSON file for live state inspection. - Updated deployment manifest to reflect new and modified files. - Implemented `_inc_faceai_identity.jsp` for managing FaceAI identity cookies and included it in relevant JSP files. - Added language management JavaScript in `lang.js`. - Adjusted `fotoCR-en.jsp` and `fotoCR.jsp` to include the FaceAI identity logic. - Created a tarball for staging deployment.
55 lines
No EOL
2 KiB
JavaScript
55 lines
No EOL
2 KiB
JavaScript
// JavaScript Document
|
|
////////////////////////////////////////////
|
|
// gestione cambio lingua
|
|
////////////////////////////////////////////
|
|
var userLang = navigator.language || navigator.userLanguage;
|
|
console.log(userLang);
|
|
|
|
function changeLang(lang) {
|
|
var page = window.location.href;
|
|
var idx = page.lastIndexOf(".");
|
|
|
|
if (idx > 0) {
|
|
var ext = page.substring(idx, page.length);
|
|
|
|
if (ext.indexOf("eu") >= 0 || ext.indexOf("com") >= 0 || ext.indexOf("net") >= 0 || ext.indexOf("it") >= 0) {
|
|
ext = "";
|
|
var page1 = page;
|
|
}
|
|
else
|
|
|
|
var page1 = page.substring(0, idx);
|
|
}
|
|
else {
|
|
// caso di pagina root www.xxxx.com/
|
|
var ext = "";
|
|
var page1 = page;
|
|
}
|
|
// 1 se ho pagine del tipo xxx.html --> aggiungo -lang.html
|
|
// 2 se ho pagine del tipo xxx_xxx-xxx-xxx-.html --> sostituisco l'ultima parte con xxx-lang.html
|
|
// 3 se ho pagine del tipo xxx_xxx-xx-xx-lang.html --> sostituisco l'ultima parte
|
|
// 4 se non ho estensione sono nella root e finisce con /(www.xxxx.com/) --> vado su index-lang
|
|
// 5 altrimenti vado su index-lang.jsp
|
|
// 6 caso Ordine.abl --> ritorno alla home
|
|
|
|
if (ext == ".abl") {
|
|
theSvlt = "index-" + lang + ".html";
|
|
}
|
|
else if (ext == "") {
|
|
theSvlt = page1 + "index-" + lang + ".html";
|
|
}
|
|
else if (page1.lastIndexOf("-") == (page1.length - 1)) {
|
|
theSvlt = page1 + lang + ext;
|
|
}
|
|
else if (page1.lastIndexOf("-") == (page1.length - 3)) {
|
|
theSvlt = page1.substring(0, page1.length - 2) + lang + ext;
|
|
}
|
|
else if (page1.substring(page1.length - 1, page1.length) != "-") {
|
|
theSvlt = page1 + "-" + lang + ext;
|
|
}
|
|
else {
|
|
theSvlt = "index-" + lang + ".jsp";
|
|
}
|
|
|
|
location.href = theSvlt;
|
|
} |