From fbf33df7879c91cbd43ff3b9691cacf4bc6a729b Mon Sep 17 00:00:00 2001 From: Lenin Compres Date: Fri, 22 Nov 2024 20:03:37 -0500 Subject: [PATCH] refactoring --- index.html | 2 +- {src => lib}/Copy.js | 5 + DOM.js => lib/DOM.js | 0 {src => lib}/Pager.js | 0 main.js | 21 ++-- src/pages/bio.js | 12 +- src/pages/contact.js | 2 +- src/{ => pages/data}/news.js | 76 ++++++----- src/{ => pages/data}/projects.js | 210 ++++++++++++------------------- src/{ => pages/data}/social.js | 0 src/pages/data/tags.js | 41 ++++++ src/pages/projects.js | 6 +- test/index.html | 14 --- test/main.js | 63 ---------- 14 files changed, 183 insertions(+), 269 deletions(-) rename {src => lib}/Copy.js (98%) rename DOM.js => lib/DOM.js (100%) rename {src => lib}/Pager.js (100%) rename src/{ => pages/data}/news.js (57%) rename src/{ => pages/data}/projects.js (63%) rename src/{ => pages/data}/social.js (100%) create mode 100644 src/pages/data/tags.js delete mode 100644 test/index.html delete mode 100644 test/main.js diff --git a/index.html b/index.html index a0cd5b4..5f6d6d3 100755 --- a/index.html +++ b/index.html @@ -1,7 +1,7 @@ - + - - - - - - \ No newline at end of file diff --git a/test/main.js b/test/main.js deleted file mode 100644 index 0165ec6..0000000 --- a/test/main.js +++ /dev/null @@ -1,63 +0,0 @@ -let control = new BinderSet({ - s1: true, - s2: true, - s3: true, - name: '', -}); - -DOM.set({ - //backgroundColor: Binder.with(control._s1, control._s2, control._s3).as((s1, s2, s3) => ["maroon", "chocolate", "orange", "limegreen"][(s1 ? 1 :0) + (s2 ? 1 :0) + (s3 ? 1 :0)]), - div: { - padding: '1em', - margin: "1em", - content: [{ - backgroundColor: control.with("s1").as("red", "lime"), - p: control._s1, - onclick(e) { - control.s1 = !control.s1; - control.name += "

1 clicked

"; - }, - }, { - backgroundColor: { - with: control._s2, - as: { - false: "red", - true: "lime" - } - }, - p: control.with("s2"), - onclick(e) { - control.s2 = !control.s2; - control.name += "

2 clicked

"; - }, - }, { - backgroundColor: { - with: control._s3, - as: ["red", "lime"], - }, - p: control.bind({ - with: "s3", - }), - onclick(e) { - control.s3 = !control.s3; - control.name += "

3 clicked

"; - }, - }] - }, - p: control.bind({ - with: ["s2", "s3"], - as: (s2, s3) => `${s2} === ${s3}: ${s2 === s3}`, - }), - footer: control._name, -}); - -//document.body.bind("backgroundColor").with(control._s1, control._s2, control._s3).as((s1, s2, s3) => ["maroon", "chocolate", "orange", "limegreen"][(s1 ? 1 : 0) + (s2 ? 1 : 0) + (s3 ? 1 : 0)]); - -control.bind(document.body, "backgroundColor").with("s1", "s2", "s3").as((s1, s2, s3) => ["maroon", "chocolate", "orange", "limegreen"][(s1 ? 1 : 0) + (s2 ? 1 : 0) + (s3 ? 1 : 0)]); - -control.bind({ - target: document.body, - station: "backgroundColor", - with: ["s1", "s2", "s3"], - as: (s1, s2, s3) => ["maroon", "chocolate", "orange", "limegreen"][(s1 ? 1 : 0) + (s2 ? 1 : 0) + (s3 ? 1 : 0)], -}); \ No newline at end of file