mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-21 18:13:55 +00:00
Redundant assignments fix
This commit is contained in:
@@ -75,10 +75,13 @@ app.whenReady().then(async () => {
|
||||
let color2 = "#7b68ee";
|
||||
|
||||
// Simple string parsing approach - more secure than regex
|
||||
if (gradientCss.startsWith("linear-gradient(") && gradientCss.endsWith(")")) {
|
||||
if (
|
||||
gradientCss.startsWith("linear-gradient(") &&
|
||||
gradientCss.endsWith(")")
|
||||
) {
|
||||
const content = gradientCss.slice(16, -1); // Remove "linear-gradient(" and ")"
|
||||
const parts = content.split(",").map(part => part.trim());
|
||||
|
||||
const parts = content.split(",").map((part) => part.trim());
|
||||
|
||||
if (parts.length >= 3) {
|
||||
direction = parts[0];
|
||||
color1 = parts[1];
|
||||
@@ -92,30 +95,30 @@ app.whenReady().then(async () => {
|
||||
y2 = "100%";
|
||||
|
||||
if (direction === "to right") {
|
||||
x1 = "0%";
|
||||
y1 = "0%";
|
||||
// x1 = "0%"; // Already set to default value
|
||||
// y1 = "0%"; // Already set to default value
|
||||
x2 = "100%";
|
||||
y2 = "0%";
|
||||
} else if (direction === "to bottom") {
|
||||
x1 = "0%";
|
||||
y1 = "0%";
|
||||
// x1 = "0%"; // Already set to default value
|
||||
// y1 = "0%"; // Already set to default value
|
||||
x2 = "0%";
|
||||
y2 = "100%";
|
||||
} else if (direction === "45deg") {
|
||||
x1 = "0%";
|
||||
// x1 = "0%"; // Already set to default value
|
||||
y1 = "100%";
|
||||
x2 = "100%";
|
||||
y2 = "0%";
|
||||
} else if (direction === "135deg") {
|
||||
x1 = "0%";
|
||||
y1 = "0%";
|
||||
// x1 = "0%"; // Already set to default value
|
||||
// y1 = "0%"; // Already set to default value
|
||||
x2 = "100%";
|
||||
y2 = "100%";
|
||||
// y2 = "100%"; // Already set to default value
|
||||
} else if (direction === "225deg") {
|
||||
x1 = "100%";
|
||||
y1 = "0%";
|
||||
// y1 = "0%"; // Already set to default value
|
||||
x2 = "0%";
|
||||
y2 = "100%";
|
||||
// y2 = "100%"; // Already set to default value
|
||||
} else if (direction === "315deg") {
|
||||
x1 = "100%";
|
||||
y1 = "100%";
|
||||
|
||||
Reference in New Issue
Block a user