From 753053e586fbdbfa4e848b51b7bfe815c15e6cca Mon Sep 17 00:00:00 2001 From: jr-k Date: Mon, 26 Aug 2024 15:53:53 +0200 Subject: [PATCH] text wip --- data/www/js/lib/jquery-more.js | 27 ++++++ data/www/js/slideshow/content-composition.js | 4 +- data/www/js/slideshow/content-text.js | 11 ++- data/www/scss/components/_animation.scss | 12 +++ views/slideshow/contents/edit-text.jinja.html | 83 ++++++++++--------- 5 files changed, 94 insertions(+), 43 deletions(-) create mode 100644 data/www/scss/components/_animation.scss diff --git a/data/www/js/lib/jquery-more.js b/data/www/js/lib/jquery-more.js index b043be6..445e1c3 100644 --- a/data/www/js/lib/jquery-more.js +++ b/data/www/js/lib/jquery-more.js @@ -53,5 +53,32 @@ jQuery(function () { updateCheckboxActiveClass(); }); + $.fn.serializeObject = function() { + const obj = {}; + + this.find('input, select, textarea').each(function() { + const field = $(this); + const name = field.attr('name'); + + if (!name) return; // Ignore fields without a name + + if (field.is(':checkbox')) { + const isOnOff = field.val() === 'on' || field.val() === '1'; + obj[name] = field.is(':checked') ? field.val() : (isOnOff ? false : null); + } else if (field.is(':radio')) { + if (field.is(':checked')) { + obj[name] = field.val(); + } else if (!(name in obj)) { + obj[name] = false; + } + } else { + const tryInt = parseInt(field.val()); + obj[name] = isNaN(tryInt) ? field.val() : tryInt; + } + }); + + return obj; + }; + }); }); diff --git a/data/www/js/slideshow/content-composition.js b/data/www/js/slideshow/content-composition.js index 58672c2..540d44b 100644 --- a/data/www/js/slideshow/content-composition.js +++ b/data/www/js/slideshow/content-composition.js @@ -388,8 +388,8 @@ jQuery(document).ready(function ($) { $(document).on('submit', 'form.form', function (e) { unfocusElements(); - const layers = getLocationPayload(); - $('#content-edit-location').val(JSON.stringify(layers)); + const location = getLocationPayload(); + $('#content-edit-location').val(JSON.stringify(location)); }); function updateZIndexes() { diff --git a/data/www/js/slideshow/content-text.js b/data/www/js/slideshow/content-text.js index bdd7d6d..d90de8a 100644 --- a/data/www/js/slideshow/content-text.js +++ b/data/www/js/slideshow/content-text.js @@ -70,6 +70,13 @@ jQuery(document).ready(function ($) { draw(); - - + $(document).on('submit', 'form.form', function (e) { + const location = getLocationPayload(); + $('#content-edit-location').val(JSON.stringify(location)); + }); }); + + +const getLocationPayload = function() { + return $('form#elementForm').serializeObject(); +}; diff --git a/data/www/scss/components/_animation.scss b/data/www/scss/components/_animation.scss new file mode 100644 index 0000000..3572c42 --- /dev/null +++ b/data/www/scss/components/_animation.scss @@ -0,0 +1,12 @@ +@keyframes blink{50%{opacity:0;}} +.cfx-blink{animation:1.5s linear infinite blink;} +.cfx-ffff-speed {animation-delay: 0.1s;} +.cfx-fff-speed {animation-delay: 0.3s;} +.cfx-ff-speed {animation-delay: 0.5s;} +.cfx-f-speed {animation-delay: 0.8s;} +.cfx-m-speed {animation-delay: 1s;} +.cfx-s-speed {animation-delay: 1.3s;} +.cfx-ss-speed {animation-delay: 1.5s;} +.cfx-sss-speed {animation-delay: 1.8s;} +.cfx-ssss-speed {animation-delay: 2s;} +.cfx-sssss-speed {animation-delay: 3s;} \ No newline at end of file diff --git a/views/slideshow/contents/edit-text.jinja.html b/views/slideshow/contents/edit-text.jinja.html index 81b78cc..ca8e158 100644 --- a/views/slideshow/contents/edit-text.jinja.html +++ b/views/slideshow/contents/edit-text.jinja.html @@ -117,11 +117,13 @@ Text + {% set contentStyles = json_loads(content.location) %} +
+ value="{{ contentStyles.textLabel }}">
@@ -135,7 +137,7 @@
+ class="numeric-input chars-3" value="{{ contentStyles.fontSize }}"> pt
@@ -144,7 +146,7 @@
+ data-jscolor="{ value: '#{{ contentStyles.color }}', backgroundColor: '#333333', shadowColor: '#000000', width: 120, height: 120 }"/>
@@ -152,26 +154,33 @@
+ {% set fonts = [ + {"value": "Arial", "name": "Arial"}, + {"value": "Arial Black", "name": "Arial Black"}, + {"value": "Verdana", "name": "Verdana"}, + {"value": "Trebuchet MS", "name": "Trebuchet MS"}, + {"value": "Georgia", "name": "Georgia"}, + {"value": "Times New Roman", "name": "Times New Roman"}, + {"value": "Courier New", "name": "Courier New"}, + {"value": "Comic Sans MS", "name": "Comic Sans MS"}, + {"value": "Impact", "name": "Impact"}, + {"value": "Tahoma", "name": "Tahoma"}, + {"value": "Gill Sans", "name": "Gill Sans"}, + {"value": "Helvetica", "name": "Helvetica"}, + {"value": "Optima", "name": "Optima"}, + {"value": "Garamond", "name": "Garamond"}, + {"value": "Baskerville", "name": "Baskerville"}, + {"value": "Copperplate", "name": "Copperplate"}, + {"value": "Futura", "name": "Futura"}, + {"value": "Monaco", "name": "Monaco"}, + {"value": "Andale Mono", "name": "Andale Mono"} + ] %}
@@ -182,16 +191,15 @@
- + - + - + @@ -202,17 +210,15 @@
- + - + - + @@ -230,7 +236,7 @@
+ data-jscolor="{ value: '#{{ contentStyles.backgroundColor }}', backgroundColor: '#333333', shadowColor: '#000000', width: 120, height: 120 }"/>
@@ -243,7 +249,7 @@
- +
@@ -252,11 +258,11 @@
- + - + @@ -266,7 +272,7 @@
- +
@@ -282,7 +288,7 @@
- +
@@ -291,8 +297,7 @@
- + pt