2022-09-19 14:56:30 +02:00
|
|
|
/**
|
|
|
|
* This file is part of Zwii.
|
|
|
|
* For full copyright and license information, please see the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*
|
|
|
|
* @author Rémi Jean <remi.jean@outlook.com>
|
|
|
|
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
|
|
|
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
|
|
|
* @copyright Copyright (C) 2018-2022, Frédéric Tempez
|
|
|
|
* @license GNU General Public License, version 3
|
|
|
|
* @link http://zwiicms.fr/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
$(document).ready(function () {
|
2022-09-19 19:08:59 +02:00
|
|
|
var translateLayout = getCookie("translateLayout");
|
|
|
|
if (translateLayout == null) {
|
|
|
|
translateLayout = "ui";
|
|
|
|
setCookie("translateLayout", "ui");
|
2022-09-19 14:56:30 +02:00
|
|
|
}
|
2022-09-19 19:08:59 +02:00
|
|
|
$("#contentContainer").hide();
|
|
|
|
$("#uiContainer").hide();
|
|
|
|
$("#" + translateLayout + "Container").show();
|
|
|
|
$("#translate" + capitalizeFirstLetter(translateLayout) + "Button").addClass("activeButton");
|
2022-09-19 14:56:30 +02:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
// Sélecteur de fonctions
|
|
|
|
|
2022-09-19 19:08:59 +02:00
|
|
|
$("#translateUiButton").on("click", function () {
|
|
|
|
$("#contentContainer").hide();
|
|
|
|
$("#uiContainer").show();
|
|
|
|
$(this).addClass("activeButton");
|
|
|
|
$("#translateContentButton").removeClass("activeButton");
|
|
|
|
setCookie("translateLayout", "ui");
|
2022-09-19 14:56:30 +02:00
|
|
|
});
|
2022-09-19 19:08:59 +02:00
|
|
|
$("#translateContentButton").on("click", function () {
|
|
|
|
$("#uiContainer").hide();
|
|
|
|
$("#contentContainer").show();
|
|
|
|
$(this).addClass("activeButton");
|
|
|
|
$("#translateUiButton").removeClass("activeButton");
|
|
|
|
setCookie("translateLayout", "content");
|
2022-09-19 14:56:30 +02:00
|
|
|
});
|
|
|
|
|
2022-09-27 16:42:10 +02:00
|
|
|
/**
|
|
|
|
* Confirmation de suppression
|
|
|
|
*/
|
|
|
|
$(".translateDelete").on("click", function() {
|
|
|
|
var _this = $(this);
|
2022-09-29 19:20:10 +02:00
|
|
|
var message_delete = "<?php echo helper::translate('Confirmer la suppression de cette traduction du site'); ?>";
|
2022-09-27 16:42:10 +02:00
|
|
|
return core.confirm(message_delete, function() {
|
|
|
|
$(location).attr("href", _this.attr("href"));
|
|
|
|
});
|
|
|
|
});
|
2022-09-19 14:56:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Fonctions
|
|
|
|
function setCookie(name, value, days) {
|
|
|
|
var expires = "";
|
|
|
|
if (days) {
|
|
|
|
var date = new Date();
|
|
|
|
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
|
|
expires = "; expires=" + date.toUTCString();
|
|
|
|
}
|
|
|
|
document.cookie = name + "=" + (value || "") + expires + "; path=/; samesite=lax";
|
|
|
|
}
|
|
|
|
|
|
|
|
function getCookie(name) {
|
|
|
|
var nameEQ = name + "=";
|
|
|
|
var ca = document.cookie.split(';');
|
|
|
|
for (var i = 0; i < ca.length; i++) {
|
|
|
|
var c = ca[i];
|
|
|
|
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
|
|
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Define function to capitalize the first letter of a string
|
|
|
|
function capitalizeFirstLetter(string) {
|
|
|
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
|
|
}
|
|
|
|
|