mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-26 11:19:55 +03:00
fixes #2345 create piwigo standard pages
create new theme standard pages with tpl, css, js and images update backend to handle pages add config use_standard_pages on update set config to false, on install set config to true add standard pages to no be ingored in git
This commit is contained in:
parent
d44ac01a48
commit
f88472fa9c
23 changed files with 1273 additions and 29 deletions
115
themes/standard_pages/js/identification_register.js
Normal file
115
themes/standard_pages/js/identification_register.js
Normal file
|
@ -0,0 +1,115 @@
|
|||
let modeCookie = getCookie("mode");
|
||||
if("" != modeCookie)
|
||||
{
|
||||
toggle_mode(modeCookie);
|
||||
}
|
||||
|
||||
jQuery( document ).ready(function() {
|
||||
jQuery("#selected-language").textContent = selected_language;
|
||||
|
||||
//Override empty input message
|
||||
jQuery("form").on("submit", function (e) {
|
||||
let isValid = true;
|
||||
|
||||
jQuery(".column-flex").each(function () {
|
||||
let input = jQuery(this).find("input");
|
||||
let errorMessage = jQuery(this).find(".error-message");
|
||||
if (!input.val().trim()) {
|
||||
|
||||
e.preventDefault();
|
||||
input[0].setCustomValidity(""); // Override browser tooltip (empty space hides it)
|
||||
errorMessage.show();
|
||||
isValid = false;
|
||||
} else {
|
||||
input[0].setCustomValidity("");
|
||||
errorMessage.hide();
|
||||
}
|
||||
});
|
||||
|
||||
return isValid;
|
||||
});
|
||||
|
||||
// Hide error message and reset validation on input
|
||||
jQuery(".column-flex input").on("input", function () {
|
||||
let errorMessage = jQuery(this).closest(".column-flex").find(".error-message");
|
||||
jQuery(this)[0].setCustomValidity(""); // Reset browser tooltip
|
||||
errorMessage.hide();
|
||||
});
|
||||
|
||||
|
||||
// Hide error message when user starts typing
|
||||
jQuery(".column-flex input").on("input", function () {
|
||||
jQuery(this).closest(".column-flex").find(".error-message").hide();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function toggle_mode(mode) {
|
||||
setCookie("mode",mode,30);
|
||||
if ("dark" == mode)
|
||||
{
|
||||
//Dark mode
|
||||
jQuery( "#toggle_mode_light" ).hide();
|
||||
jQuery( "#toggle_mode_dark" ).show();
|
||||
jQuery( "#mode" ).addClass("dark");
|
||||
jQuery( "#mode" ).removeClass("light");
|
||||
jQuery( "#piwigo-logo" ).attr("src", url_logo_dark);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Light mode
|
||||
jQuery( "#toggle_mode_dark" ).hide();
|
||||
jQuery( "#toggle_mode_light" ).show();
|
||||
jQuery( "#mode" ).addClass("light");
|
||||
jQuery( "#mode" ).removeClass("dark");
|
||||
jQuery( "#piwigo-logo" ).attr("src", url_logo_light);
|
||||
}
|
||||
}
|
||||
|
||||
function setCookie(cname, cvalue, exdays) {
|
||||
const d = new Date();
|
||||
d.setTime(d.getTime() + (exdays*24*60*60*1000));
|
||||
let expires = "expires="+ d.toUTCString();
|
||||
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
|
||||
if (cname == "lang")
|
||||
{
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
function getCookie(cname) {
|
||||
let name = cname + "=";
|
||||
let decodedCookie = decodeURIComponent(document.cookie);
|
||||
let ca = decodedCookie.split(';');
|
||||
for(let i = 0; i <ca.length; i++) {
|
||||
let c = ca[i];
|
||||
while (c.charAt(0) == ' ') {
|
||||
c = c.substring(1);
|
||||
}
|
||||
if (c.indexOf(name) == 0) {
|
||||
return c.substring(name.length, c.length);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
jQuery(".togglePassword").click(function(e){
|
||||
var toggle = jQuery(e.target);
|
||||
var input = (jQuery(toggle).siblings('input'))[0];
|
||||
if (input.type === "password") {
|
||||
input.type = "text";
|
||||
jQuery(toggle).css("color", "#ff7700");
|
||||
} else {
|
||||
input.type = "password";
|
||||
jQuery(toggle).css("color","#898989");
|
||||
}
|
||||
});
|
||||
|
||||
jQuery("#other-languages a").click(function(e){
|
||||
let clickedUrl = new URL(jQuery(e.target).attr('href'));
|
||||
let selectedLang = clickedUrl.searchParams.get("lang");
|
||||
|
||||
if (selectedLang) {
|
||||
setCookie('lang',selectedLang,1);
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue