From 6a30fbd239b31e293c0833c2bbcbb8def44707f1 Mon Sep 17 00:00:00 2001 From: s-ol Date: Sat, 26 Oct 2019 13:30:58 +0200 Subject: mmmfs cleanup --- .../examples/gallery/actual_image/image$png.png | Bin 0 -> 678429 bytes .../gallery/actual_image/preview: image$png.png | Bin 0 -> 31880 bytes .../examples/gallery/link_to_image/URL -> image$png | 1 + .../gallery/link_to_image/preview: URL -> image$png | 1 + .../preview: text$moonscript -> fn -> mmm$dom.moon | 7 +++++++ ...show: text$moonscript -> fn -> mmm$component.moon | 19 +++++++++++++++++++ .../gallery/text$moonscript -> fn -> mmm$dom.moon | 12 ++++++++++++ .../mmmfs/examples/gallery/title: text$plain | 1 + 8 files changed, 41 insertions(+) create mode 100644 root/articles/mmmfs/examples/gallery/actual_image/image$png.png create mode 100644 root/articles/mmmfs/examples/gallery/actual_image/preview: image$png.png create mode 100644 root/articles/mmmfs/examples/gallery/link_to_image/URL -> image$png create mode 100644 root/articles/mmmfs/examples/gallery/link_to_image/preview: URL -> image$png create mode 100644 root/articles/mmmfs/examples/gallery/preview: text$moonscript -> fn -> mmm$dom.moon create mode 100644 root/articles/mmmfs/examples/gallery/slideshow: text$moonscript -> fn -> mmm$component.moon create mode 100644 root/articles/mmmfs/examples/gallery/text$moonscript -> fn -> mmm$dom.moon create mode 100644 root/articles/mmmfs/examples/gallery/title: text$plain (limited to 'root/articles/mmmfs/examples/gallery') diff --git a/root/articles/mmmfs/examples/gallery/actual_image/image$png.png b/root/articles/mmmfs/examples/gallery/actual_image/image$png.png new file mode 100644 index 0000000..b499413 Binary files /dev/null and b/root/articles/mmmfs/examples/gallery/actual_image/image$png.png differ diff --git a/root/articles/mmmfs/examples/gallery/actual_image/preview: image$png.png b/root/articles/mmmfs/examples/gallery/actual_image/preview: image$png.png new file mode 100644 index 0000000..f9dbfad Binary files /dev/null and b/root/articles/mmmfs/examples/gallery/actual_image/preview: image$png.png differ diff --git a/root/articles/mmmfs/examples/gallery/link_to_image/URL -> image$png b/root/articles/mmmfs/examples/gallery/link_to_image/URL -> image$png new file mode 100644 index 0000000..7cf76ff --- /dev/null +++ b/root/articles/mmmfs/examples/gallery/link_to_image/URL -> image$png @@ -0,0 +1 @@ +https://picsum.photos/600/600/?image=101 diff --git a/root/articles/mmmfs/examples/gallery/link_to_image/preview: URL -> image$png b/root/articles/mmmfs/examples/gallery/link_to_image/preview: URL -> image$png new file mode 100644 index 0000000..2b2233b --- /dev/null +++ b/root/articles/mmmfs/examples/gallery/link_to_image/preview: URL -> image$png @@ -0,0 +1 @@ +https://picsum.photos/200/200/?image=101 diff --git a/root/articles/mmmfs/examples/gallery/preview: text$moonscript -> fn -> mmm$dom.moon b/root/articles/mmmfs/examples/gallery/preview: text$moonscript -> fn -> mmm$dom.moon new file mode 100644 index 0000000..5285629 --- /dev/null +++ b/root/articles/mmmfs/examples/gallery/preview: text$moonscript -> fn -> mmm$dom.moon @@ -0,0 +1,7 @@ +import div, img, br from require 'mmm.dom' + +=> div { + 'the first pic as a little taste:', + br!, + img src: @children[1]\get 'preview', 'URL -> image/png' +} diff --git a/root/articles/mmmfs/examples/gallery/slideshow: text$moonscript -> fn -> mmm$component.moon b/root/articles/mmmfs/examples/gallery/slideshow: text$moonscript -> fn -> mmm$component.moon new file mode 100644 index 0000000..0178ac2 --- /dev/null +++ b/root/articles/mmmfs/examples/gallery/slideshow: text$moonscript -> fn -> mmm$component.moon @@ -0,0 +1,19 @@ +import ReactiveVar, text, elements from require 'mmm.component' +import div, a, img from elements + +=> + index = ReactiveVar 1 + + prev = (i) -> math.max 1, i - 1 + next = (i) -> math.min #@children, i + 1 + + div { + div { + a 'prev', href: '#', onclick: -> index\transform prev + index\map (i) -> text " image ##{i} " + a 'next', href: '#', onclick: -> index\transform next + }, + index\map (i) -> + child = assert @children[i], "image not found!" + img src: @children[i]\gett 'URL -> image/png' + } diff --git a/root/articles/mmmfs/examples/gallery/text$moonscript -> fn -> mmm$dom.moon b/root/articles/mmmfs/examples/gallery/text$moonscript -> fn -> mmm$dom.moon new file mode 100644 index 0000000..9bdac54 --- /dev/null +++ b/root/articles/mmmfs/examples/gallery/text$moonscript -> fn -> mmm$dom.moon @@ -0,0 +1,12 @@ +import div, h1, a, img, br from require 'mmm.dom' + +=> + link = (child) -> a { + href: '#', + onclick: -> BROWSER\navigate child.path + img src: child\gett 'preview', 'URL -> image/png' + } + + content = [link child for child in *@children] + table.insert content, 1, h1 'gallery index' + div content diff --git a/root/articles/mmmfs/examples/gallery/title: text$plain b/root/articles/mmmfs/examples/gallery/title: text$plain new file mode 100644 index 0000000..ad74eec --- /dev/null +++ b/root/articles/mmmfs/examples/gallery/title: text$plain @@ -0,0 +1 @@ +A Gallery of 25 random pictures, come on in! -- cgit v1.2.3