diff --git a/clocko/script.js b/clocko/script.js index ae77c2a..9f23f87 100644 --- a/clocko/script.js +++ b/clocko/script.js @@ -26,10 +26,12 @@ const line3 = document.getElementById('line3'); // OPTIONS // ///////////// -const font = urlParams.get("font") || ""; const language = urlParams.get("language") || "en"; const timezone = urlParams.get("timezone") || ""; +const font = urlParams.get("font") || ""; +const textAlignment = urlParams.get("textAlignment") || "center"; + const enableLine1 = GetBooleanParam("enableLine1", true); const line1Format = urlParams.get("line1Format") || "hh:mm:ss A"; const line1FontSize = GetIntParam("line1FontSize", 50); @@ -37,7 +39,6 @@ const line1FontWeight = urlParams.get("line1FontWeight") || "700"; const line1FontColor = urlParams.get("line1FontColor") || "#ffffff"; const line1FontOpacity = urlParams.get("line1FontOpacity") || "1"; const line1TextTransform = urlParams.get("line1TextTransform") || "none"; -const line1TextAlignment = urlParams.get("line1TextAlignment") || "center"; const enableLine2 = GetBooleanParam("enableLine2", true); const line2Format = urlParams.get("line2Format") || "ddd, MMM D"; @@ -46,7 +47,6 @@ const line2FontWeight = urlParams.get("line2FontWeight") || "400"; const line2FontColor = urlParams.get("line2FontColor") || "#ffffff"; const line2FontOpacity = urlParams.get("line2FontOpacity") || "0.7"; const line2TextTransform = urlParams.get("line2TextTransform") || "none"; -const line2TextAlignment = urlParams.get("line2TextAlignment") || "center"; const enableLine3 = GetBooleanParam("enableLine3", false); const line3Format = urlParams.get("line3Format") || "ddd DD MMM YYYY hh:mm:ss A z"; @@ -55,7 +55,6 @@ const line3FontWeight = urlParams.get("line3FontWeight") || "600"; const line3FontColor = urlParams.get("line3FontColor") || "#ffffff"; const line3FontOpacity = urlParams.get("line3FontOpacity") || "1"; const line3TextTransform = urlParams.get("line3TextTransform") || "none"; -const line3TextAlignment = urlParams.get("line3TextAlignment") || "center"; @@ -130,7 +129,7 @@ document.head.appendChild(script); // STYLING // ///////////// -function ApplyStyling(el, fontSize, fontWeight, fontColor, fontOpacity, textTransform, textAlignment) { +function ApplyStyling(el, fontSize, fontWeight, fontColor, fontOpacity, textTransform) { el.style.fontSize = fontSize + "px"; el.style.fontWeight = fontWeight; el.style.color = fontColor; @@ -139,6 +138,6 @@ function ApplyStyling(el, fontSize, fontWeight, fontColor, fontOpacity, textTran el.style.textAlign = textAlignment; } -ApplyStyling(line1, line1FontSize, line1FontWeight, line1FontColor, line1FontOpacity, line1TextTransform, line1TextAlignment); -ApplyStyling(line2, line2FontSize, line2FontWeight, line2FontColor, line2FontOpacity, line2TextTransform, line2TextAlignment); -ApplyStyling(line3, line3FontSize, line3FontWeight, line3FontColor, line3FontOpacity, line3TextTransform, line3TextAlignment); \ No newline at end of file +ApplyStyling(line1, line1FontSize, line1FontWeight, line1FontColor, line1FontOpacity, line1TextTransform); +ApplyStyling(line2, line2FontSize, line2FontWeight, line2FontColor, line2FontOpacity, line2TextTransform); +ApplyStyling(line3, line3FontSize, line3FontWeight, line3FontColor, line3FontOpacity, line3TextTransform); \ No newline at end of file diff --git a/clocko/settings/settings.json b/clocko/settings/settings.json index d47db6e..7b81529 100644 --- a/clocko/settings/settings.json +++ b/clocko/settings/settings.json @@ -57,6 +57,19 @@ "defaultValue": "", "group": "Appearance" }, + { + "id": "textAlignment", + "label": "Text Alignment", + "description": "", + "type": "select", + "options": [ + { "value": "left", "label": "Left" }, + { "value": "center", "label": "Center" }, + { "value": "right", "label": "Right" } + ], + "defaultValue": "center", + "group": "Appearance" + }, { "id": "enableLine1", "label": "Enable Line 1", @@ -141,20 +154,6 @@ "showIf": "enableLine1", "group": "Appearance" }, - { - "id": "line1TextAlignment", - "label": "Text Alignment", - "description": "", - "type": "select", - "options": [ - { "value": "left", "label": "Left" }, - { "value": "center", "label": "Center" }, - { "value": "right", "label": "Right" } - ], - "defaultValue": "center", - "showIf": "enableLine1", - "group": "Appearance" - }, { "id": "enableLine2", "label": "Enable Line 2", @@ -239,20 +238,6 @@ "showIf": "enableLine2", "group": "Appearance" }, - { - "id": "line2TextAlignment", - "label": "Text Alignment", - "description": "", - "type": "select", - "options": [ - { "value": "left", "label": "Left" }, - { "value": "center", "label": "Center" }, - { "value": "right", "label": "Right" } - ], - "defaultValue": "center", - "showIf": "enableLine2", - "group": "Appearance" - }, { "id": "enableLine3", "label": "Enable Line 3", @@ -336,20 +321,6 @@ "defaultValue": "none", "showIf": "enableLine3", "group": "Appearance" - }, - { - "id": "line3TextAlignment", - "label": "Text Alignment", - "description": "", - "type": "select", - "options": [ - { "value": "left", "label": "Left" }, - { "value": "center", "label": "Center" }, - { "value": "right", "label": "Right" } - ], - "defaultValue": "center", - "showIf": "enableLine3", - "group": "Appearance" } ] } \ No newline at end of file