mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Update data-toggle with bsTarget
This commit is contained in:
parent
80aca6a971
commit
2d4960a3ab
@ -732,20 +732,19 @@ function setDhcpFieldsDisabled() {
|
|||||||
Array.range = (start, end) => Array.from({length: (end - start)}, (v, k) => k + start);
|
Array.range = (start, end) => Array.from({length: (end - start)}, (v, k) => k + start);
|
||||||
|
|
||||||
$(document).on("click", ".js-toggle-password", function(e) {
|
$(document).on("click", ".js-toggle-password", function(e) {
|
||||||
var button = $(e.target)
|
var button = $(e.currentTarget);
|
||||||
var field = $(button.data("target"));
|
var field = $(button.data("bsTarget"));
|
||||||
|
|
||||||
if (field.is(":input")) {
|
if (field.is(":input")) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (!button.data("__toggle-with-initial")) {
|
if (!button.data("__toggle-with-initial")) {
|
||||||
$("i", this).removeClass("fas fa-eye").addClass(button.attr("data-toggle-with"));
|
$("i", button).removeClass("fas fa-eye").addClass(button.attr("data-toggle-with"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field.attr("type") === "password") {
|
if (field.attr("type") === "password") {
|
||||||
field.attr("type", "text");
|
field.attr("type", "text");
|
||||||
} else {
|
} else {
|
||||||
$("i", this).removeClass("fas fa-eye-slash").addClass("fas fa-eye");
|
$("i", button).removeClass("fas fa-eye-slash").addClass("fas fa-eye");
|
||||||
field.attr("type", "password");
|
field.attr("type", "password");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -755,15 +754,12 @@ $(function() {
|
|||||||
$('#theme-select').change(function() {
|
$('#theme-select').change(function() {
|
||||||
var theme = themes[$( "#theme-select" ).val() ];
|
var theme = themes[$( "#theme-select" ).val() ];
|
||||||
|
|
||||||
var hasDarkTheme = theme === 'custom.php' ||
|
var hasDarkTheme = theme === 'custom.php';
|
||||||
theme === 'material-light.php';
|
|
||||||
var nightModeChecked = $("#night-mode").prop("checked");
|
var nightModeChecked = $("#night-mode").prop("checked");
|
||||||
|
|
||||||
if (nightModeChecked && hasDarkTheme) {
|
if (nightModeChecked && hasDarkTheme) {
|
||||||
if (theme === "custom.php") {
|
if (theme === "custom.php") {
|
||||||
set_theme("lightsout.php");
|
set_theme("lightsout.php");
|
||||||
} else if (theme === "material-light.php") {
|
|
||||||
set_theme("material-dark.php");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
set_theme(theme);
|
set_theme(theme);
|
||||||
@ -780,7 +776,7 @@ function set_theme(theme) {
|
|||||||
$(function() {
|
$(function() {
|
||||||
var currentTheme = getCookie('theme');
|
var currentTheme = getCookie('theme');
|
||||||
// Check if the current theme is a dark theme
|
// Check if the current theme is a dark theme
|
||||||
var isDarkTheme = currentTheme === 'lightsout.php' || currentTheme === 'material-dark.php';
|
var isDarkTheme = currentTheme === 'lightsout.php';
|
||||||
|
|
||||||
$('#night-mode').prop('checked', isDarkTheme);
|
$('#night-mode').prop('checked', isDarkTheme);
|
||||||
$('#night-mode').change(function() {
|
$('#night-mode').change(function() {
|
||||||
@ -790,14 +786,10 @@ $(function() {
|
|||||||
if (state == true) {
|
if (state == true) {
|
||||||
if (currentTheme == 'custom.php') {
|
if (currentTheme == 'custom.php') {
|
||||||
set_theme('lightsout.php');
|
set_theme('lightsout.php');
|
||||||
} else if (currentTheme == 'material-light.php') {
|
|
||||||
set_theme('material-dark.php');
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (currentTheme == 'lightsout.php') {
|
if (currentTheme == 'lightsout.php') {
|
||||||
set_theme('custom.php');
|
set_theme('custom.php');
|
||||||
} else if (currentTheme == 'material-dark.php') {
|
|
||||||
set_theme('material-light.php');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user