summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-07-25 14:30:04 +0200
committerYorhel <git@yorhel.nl>2019-07-25 14:36:21 +0200
commitf296495a912ce759df11c43e78b4552788bdbff2 (patch)
tree0c10802de65fb7c8475722e12234bff5eb980628 /static
parent0f3cfeb85caec6424bcbea47142eefbf8011636b (diff)
Merge the v3 branch into separate namespace + fix Docker stuff (again)
I was getting tired of having to keep two branches up-to-date with the latest developments, so decided to throw v3 into the same branch - just different files (...which will get mostly rewritten again soon). The two versions aren't very different in terms of dependencies, build system and support code, so they can now properly share files. Added a section to the README to avoid confusion. This merge also makes it easier to quickly switch between the different versions, which is handy for development. It's even possible to run both at the same time, but my scripts use the same port so that needs a workaround. And it's amazing how often I break the Docker scripts.
Diffstat (limited to 'static')
-rw-r--r--static/v3/apple.svg1
-rw-r--r--static/v3/bell.svg1
-rw-r--r--static/v3/camera-alt.svg1
-rw-r--r--static/v3/edit.svg1
-rw-r--r--static/v3/external-link-square-alt.svg1
-rw-r--r--static/v3/globe.svg1
-rw-r--r--static/v3/heavy/comment.svg1
-rw-r--r--static/v3/heavy/random.svg1
-rw-r--r--static/v3/heavy/search.svg1
-rw-r--r--static/v3/linux.svg1
-rw-r--r--static/v3/nsfw.svg8
-rw-r--r--static/v3/plus-circle.svg1
-rw-r--r--static/v3/plus.svg1
-rw-r--r--static/v3/popularity.svg9
-rw-r--r--static/v3/star.svg9
-rw-r--r--static/v3/vndb.js420
-rw-r--r--static/v3/windows.svg1
17 files changed, 459 insertions, 0 deletions
diff --git a/static/v3/apple.svg b/static/v3/apple.svg
new file mode 100644
index 00000000..0181ed8a
--- /dev/null
+++ b/static/v3/apple.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M247.2 137.6c-6.2 1.9-15.3 3.5-27.9 4.6 1.1-56.7 29.9-96.6 88-110.1 9.3 41.6-26.1 94.1-60.1 105.5zm121.3 72.7c6.4-9.4 16.6-19.9 30.6-31.7-22.3-27.6-48.1-44.3-85.1-44.3-35.4 0-65.2 18.2-87 18.2-18.5 0-51.9-16.1-84.5-16.1-69.6 0-106.5 68.1-106.5 139C36 354.2 95.7 480 156.2 480c23.8 0 45.2-18 73.5-18 29.3 0 52.8 17.2 80.3 17.2 46 0 88.6-77.5 102-119.7-46.8-14.3-84.4-90.2-43.5-149.2z"/></svg> \ No newline at end of file
diff --git a/static/v3/bell.svg b/static/v3/bell.svg
new file mode 100644
index 00000000..afcffe43
--- /dev/null
+++ b/static/v3/bell.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M425 331c-17-17-34-34-34-116 0-83-61-152-141-165a32 32 0 0 0 6-18 32 32 0 0 0-64 0 32 32 0 0 0 6 18C118 63 57 132 57 215c0 82-17 99-34 116a67 67 0 0 0 44 117h93a64 64 0 0 0 128 0h93c57 0 92-70 44-117zM224 472c-13 0-24-11-24-24h48c0 13-11 24-24 24zm157-72H67c-17 0-25-20-13-32 28-29 51-56 51-153a119 119 0 0 1 238 0c0 98 23 124 51 153 12 12 4 32-13 32z"/></svg> \ No newline at end of file
diff --git a/static/v3/camera-alt.svg b/static/v3/camera-alt.svg
new file mode 100644
index 00000000..3c2e12aa
--- /dev/null
+++ b/static/v3/camera-alt.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 408c-66.2 0-120-53.8-120-120s53.8-120 120-120 120 53.8 120 120-53.8 120-120 120zm0-208c-48.5 0-88 39.5-88 88s39.5 88 88 88 88-39.5 88-88-39.5-88-88-88zm-32 88c0-17.6 14.4-32 32-32 8.8 0 16-7.2 16-16s-7.2-16-16-16c-35.3 0-64 28.7-64 64 0 8.8 7.2 16 16 16s16-7.2 16-16zM324.3 64c3.3 0 6.3 2.1 7.5 5.2l22.1 58.8H464c8.8 0 16 7.2 16 16v288c0 8.8-7.2 16-16 16H48c-8.8 0-16-7.2-16-16V144c0-8.8 7.2-16 16-16h110.2l20.1-53.6c2.3-6.2 8.3-10.4 15-10.4h131m0-32h-131c-20 0-37.9 12.4-44.9 31.1L136 96H48c-26.5 0-48 21.5-48 48v288c0 26.5 21.5 48 48 48h416c26.5 0 48-21.5 48-48V144c0-26.5-21.5-48-48-48h-88l-14.3-38c-5.8-15.7-20.7-26-37.4-26z"/></svg> \ No newline at end of file
diff --git a/static/v3/edit.svg b/static/v3/edit.svg
new file mode 100644
index 00000000..d7b19146
--- /dev/null
+++ b/static/v3/edit.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M402.3 344.9l32-32c5-5 13.7-1.5 13.7 5.7V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V112c0-26.5 21.5-48 48-48h273.5c7.1 0 10.7 8.6 5.7 13.7l-32 32c-1.5 1.5-3.5 2.3-5.7 2.3H48v352h352V350.5c0-2.1.8-4.1 2.3-5.6zm156.6-201.8L296.3 405.7l-90.4 10c-26.2 2.9-48.5-19.2-45.6-45.6l10-90.4L432.9 17.1c22.9-22.9 59.9-22.9 82.7 0l43.2 43.2c22.9 22.9 22.9 60 .1 82.8zM460.1 174L402 115.9 216.2 301.8l-7.3 65.3 65.3-7.3L460.1 174zm64.8-79.7l-43.2-43.2c-4.1-4.1-10.8-4.1-14.8 0L436 82l58.1 58.1 30.9-30.9c4-4.2 4-10.8-.1-14.9z"/></svg> \ No newline at end of file
diff --git a/static/v3/external-link-square-alt.svg b/static/v3/external-link-square-alt.svg
new file mode 100644
index 00000000..131a7b6b
--- /dev/null
+++ b/static/v3/external-link-square-alt.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M400 32H48C21 32 0 53 0 80v352c0 27 21 48 48 48h352c27 0 48-21 48-48V80c0-27-21-48-48-48zm-6 400H54a6 6 0 0 1-6-6V86a6 6 0 0 1 6-6h340a6 6 0 0 1 6 6v340a6 6 0 0 1-6 6zm-54-304H204c-11 0-16 13-8 20l48 49-144 144c-5 5-5 12 0 17l22 22c5 5 12 5 17 0l144-144 49 48c7 8 20 3 20-8V140c0-7-5-12-12-12z"/></svg> \ No newline at end of file
diff --git a/static/v3/globe.svg b/static/v3/globe.svg
new file mode 100644
index 00000000..422636b2
--- /dev/null
+++ b/static/v3/globe.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 8a248 248 0 1 0 0 496 248 248 0 0 0 0-496zm180 160h-84c-8-37-20-72-36-103 54 17 96 55 120 103zm16 128h-94c2-26 3-53 0-80h94c5 26 5 54 0 80zm-250 0c-3-26-3-53 0-80h108c3 27 3 53 0 80H202zm100 48c-9 42-25 80-46 109-21-29-37-67-46-109h92zM60 216h94c-2 26-3 52 0 80H60c-5-26-5-54 0-80zm149-48c10-42 26-80 47-109 21 29 37 67 47 109h-94zM196 65c-16 31-28 66-36 103H76c24-48 66-86 120-103zM76 344h84c8 37 20 72 36 103-54-17-97-56-120-103zm240 103c16-31 28-66 36-103h84c-24 47-66 86-120 103z"/></svg> \ No newline at end of file
diff --git a/static/v3/heavy/comment.svg b/static/v3/heavy/comment.svg
new file mode 100644
index 00000000..f6332836
--- /dev/null
+++ b/static/v3/heavy/comment.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 32C114.6 32 0 125.1 0 240c0 49.6 21.4 95 57 130.7C44.5 421.1 2.7 466 2.2 466.5c-2.2 2.3-2.8 5.7-1.5 8.7S4.8 480 8 480c66.3 0 116-31.8 140.6-51.4 32.7 12.3 69 19.4 107.4 19.4 141.4 0 256-93.1 256-208S397.4 32 256 32z"/></svg> \ No newline at end of file
diff --git a/static/v3/heavy/random.svg b/static/v3/heavy/random.svg
new file mode 100644
index 00000000..4e720978
--- /dev/null
+++ b/static/v3/heavy/random.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M505 359c9 9 9 25 0 34l-80 80c-15 15-41 4-41-17v-40h-59a12 12 0 0 1-9-4l-70-75 53-58 53 57h32v-40c0-21 26-32 41-17l80 80zM12 176h84l53 57 53-58-70-75a12 12 0 0 0-9-4H12c-7 0-12 5-12 12v56c0 7 5 12 12 12zm372 0v40c0 21 26 32 41 17l80-80c9-9 9-25 0-34l-80-80c-15-15-41-4-41 17v40h-59a12 12 0 0 0-9 4L96 336H12c-7 0-12 5-12 12v56c0 7 5 12 12 12h111c3 0 6-1 9-4l220-236h32z"/></svg> \ No newline at end of file
diff --git a/static/v3/heavy/search.svg b/static/v3/heavy/search.svg
new file mode 100644
index 00000000..af3df931
--- /dev/null
+++ b/static/v3/heavy/search.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M505 443L405 343c-4-4-10-7-17-7h-16a208 208 0 1 0-36 36v16c0 7 3 13 7 17l100 100c9 9 24 9 34 0l28-28c9-10 9-25 0-34zM208 336a128 128 0 1 1 0-256 128 128 0 0 1 0 256z"/></svg> \ No newline at end of file
diff --git a/static/v3/linux.svg b/static/v3/linux.svg
new file mode 100644
index 00000000..95c14f6b
--- /dev/null
+++ b/static/v3/linux.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M196 124c0-2 2-3 3-3h6v1l-3 1-3 2-3-1zm25-1l3 2 3-1c0-2-2-3-4-3l-5-1-1 2 4 1zm214 311c0 8-6 13-13 18-15 9-38 16-51 32l-3-2 3 2a73 73 0 0 1-49 28c-16 1-32-6-40-23l-2-7c-22 1-41-5-55-4-22 1-36 6-49 7-5 10-14 17-26 20-16 3-36 0-56-11l2-3-2 3c-18-9-42-9-59-12-9-2-16-5-20-12-4-8-3-18 2-32 2-5 1-13-1-21l-1-12 3-12c5-9 12-12 19-15 6-2 12-4 17-8l16-20c-2-17 0-36 6-53 13-38 40-75 58-97 17-23 21-41 23-65 1-32-25-135 78-135 81 0 76 85 76 131-1 30 16 51 33 72 15 18 35 45 47 75 9 24 12 52 3 79l4 2 4 3c7 5 9 14 11 22s3 16 7 20c11 12 16 21 16 30zM222 109l13 5c-2-13 4-24 12-23 9 0 14 15 9 27l-4 4 12 5c8-9 11-26 5-40-10-21-34-22-44 0-3 8-4 15-3 22zm-46 19c7-6 7-5 6-6-8-6-7-27 1-28 7 0 11 11 10 20l10-5c2-19-9-33-19-33-19 0-24 37-8 52zm-10 21c2 5 6 10 15 15 8 5 12 12 20 15l10 2c18 1 27-11 38-15 11-3 20-11 22-18 4-8-2-14-10-18-11-5-16-5-23-9-10-7-19-9-26-9-14 0-23 10-28 14l-14 11c-4 3-5 7-4 12zm-33 253l-20-36c-7-9-14-15-22-16s-12 1-18 7c-4 5-8 12-14 18-8 6-9 6-19 10-7 2-12 4-15 11-3 5-2 12-1 20s3 16 0 24c-5 14-5 22-2 27 8 15 46 6 76 21 32 17 73 18 76-18 2-20-32-49-41-68zm154 35c3-11 6-21 6-29 1-15 2-28 5-39 3-13 9-24 21-28 2-21 19-21 38-12 19 8 27 16 23 26h5c5-17-15-28-31-35 3-12 2-24-1-36-6-25-22-47-35-59-2 0-2 2 3 7 11 11 37 49 23 85l-11-2c-5-29-17-53-23-64-12-22-30-66-38-96-4 6-12 12-22 15l-16 9c-14 8-30 9-42-1-5-4-8-8-13-10l-6-5c-2 38-27 86-39 113-9 20-13 41-14 62-22-29-6-67 3-83 9-17 11-22 8-21-8 14-22 37-27 60-3 12-3 24 0 35 4 11 11 21 25 30 0 0 25 14 38 32 8 10 10 19 8 25-3 7-10 9-17 9l14 20c38 25 83 15 115-8zm129-28c-10-12-7-34-17-42-7-6-14-6-23-5-7 9-26 19-38 16s-18-16-19-29h-1c-7 4-11 11-14 21l-4 39c-1 12-6 26-10 40-3 14-5 26-1 37 7 14 20 20 34 19s30-10 43-25c23-27 63-30 64-47 0-5-3-13-14-24zM173 149l8 7c7 5 16 10 28 10 11 0 22-6 31-10l15-11c4-3 6-6 3-6-2-1-2 2-6 5s-9 7-14 9c-7 5-19 11-29 11-11 0-19-5-25-10l-8-7c-2-1-2-5-4-5s-2 4 1 7z" class="st1"/></svg> \ No newline at end of file
diff --git a/static/v3/nsfw.svg b/static/v3/nsfw.svg
new file mode 100644
index 00000000..b330811c
--- /dev/null
+++ b/static/v3/nsfw.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 58.208333 31.750001" height="120" width="220">
+ <g transform="translate(-4.998675,4.0015319)">
+ <rect ry="2.3623512" y="4.9918275" x="21.408564" height="7.3399329" width="23.14588" style="fill:none;stroke:#ff0013;stroke-width:0.52899998;stroke-linejoin:round;stroke-miterlimit:4" />
+ <text y="11.251631" x="22.492025" style="font-size:1.58749998px;font-family:Sans"><tspan style="font-size:7.05555534px;fill:#ff0000" y="11.251631" x="22.492025">NSFW</tspan></text>
+ <text y="18.055201" x="17.540541" style="font-size:1.58749998px;font-family:Sans"><tspan style="font-size:4.93888903px" y="18.055201" x="17.540541">Click to show</tspan></text>
+ </g>
+</svg>
diff --git a/static/v3/plus-circle.svg b/static/v3/plus-circle.svg
new file mode 100644
index 00000000..a4e1614d
--- /dev/null
+++ b/static/v3/plus-circle.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M384 240v32c0 7-5 12-12 12h-88v88c0 7-5 12-12 12h-32c-7 0-12-5-12-12v-88h-88c-7 0-12-5-12-12v-32c0-7 5-12 12-12h88v-88c0-7 5-12 12-12h32c7 0 12 5 12 12v88h88c7 0 12 5 12 12zm120 16a248 248 0 1 1-496 0 248 248 0 0 1 496 0zm-48 0a200 200 0 1 0-400 0 200 200 0 0 0 400 0z"/></svg> \ No newline at end of file
diff --git a/static/v3/plus.svg b/static/v3/plus.svg
new file mode 100644
index 00000000..6abdb9c1
--- /dev/null
+++ b/static/v3/plus.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M436 228H252V44c0-7-5-12-12-12h-32c-7 0-12 5-12 12v184H12c-7 0-12 5-12 12v32c0 7 5 12 12 12h184v184c0 7 5 12 12 12h32c7 0 12-5 12-12V284h184c7 0 12-5 12-12v-32c0-7-5-12-12-12z"/></svg> \ No newline at end of file
diff --git a/static/v3/popularity.svg b/static/v3/popularity.svg
new file mode 100644
index 00000000..b5d38cbc
--- /dev/null
+++ b/static/v3/popularity.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="14px" height="14px" viewBox="0 0 14 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 52.6 (67491) - http://www.bohemiancoding.com/sketch -->
+ <title>popularity</title>
+ <desc>Created with Sketch.</desc>
+ <g id="popularity" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <path d="M7.6433049,0.653105611 C7.6433049,2.10227637 8.84868284,2.95829665 10.0314144,4.08172755 C11.1340394,5.12906825 12.2620799,6.4030691 12.2620799,8.76017967 C12.2620799,11.3800892 10.1843491,14 6.97982033,14 C3.77529154,14 1.74,11.3800898 1.74,8.76017967 C1.74,7.38566311 2.34076885,5.93401954 3.3040627,5.00374915 C3.65529761,4.66455522 4.360198,4.94624673 4.360198,5.43556101 C4.360198,6.15939813 4.38173711,6.73597201 4.360198,7.58760037 C4.31163435,9.50774315 6.0268408,9.96797041 7.03876191,9.40124534 C7.47734681,9.15561645 7.9688702,8.49858249 7.87293082,7.71221561 C7.79216421,7.05021241 7.24107638,6.33873909 6.45278408,5.62655348 C5.0451431,4.35481502 5.25278079,3.34974837 5.25278079,3.19634055 C5.25278079,2.26589186 5.94332373,1.08107326 6.45278408,0.302862128 C6.7860135,-0.206152645 7.6433049,-0.0630522052 7.6433049,0.653105611 Z" id="Path" fill="#000000" fill-rule="nonzero"></path>
+ </g>
+</svg> \ No newline at end of file
diff --git a/static/v3/star.svg b/static/v3/star.svg
new file mode 100644
index 00000000..665bfe3c
--- /dev/null
+++ b/static/v3/star.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="14px" height="14px" viewBox="0 0 14 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 52.6 (67491) - http://www.bohemiancoding.com/sketch -->
+ <title>star</title>
+ <desc>Created with Sketch.</desc>
+ <g id="star" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <path d="M6.33376841,1.07697421 C6.63337211,0.470154595 7.49412216,0.477766805 7.79119672,1.07697421 L9.44919563,4.43869486 L13.1587472,4.97950893 C13.8239849,5.07598811 14.0905859,5.89609838 13.6081651,6.36582383 L10.9243775,8.98105197 L11.5591416,12.6753791 C11.6733992,13.3431708 10.9701004,13.8408159 10.3810343,13.5310461 L7.06248257,11.7867093 L3.74393083,13.5310461 C3.15486478,13.8433451 2.45156598,13.3431708 2.56582352,12.6753791 L3.20058763,8.98105197 L0.516800006,6.36582383 C0.0343792811,5.89609838 0.300980208,5.07598811 0.966217956,4.97950893 L4.67576951,4.43869486 L6.33376841,1.07697421 Z" fill="#000000"></path>
+ </g>
+</svg> \ No newline at end of file
diff --git a/static/v3/vndb.js b/static/v3/vndb.js
new file mode 100644
index 00000000..2a2eb3f2
--- /dev/null
+++ b/static/v3/vndb.js
@@ -0,0 +1,420 @@
+/* Polyfill for classList.toggle() (mainly for IE) */
+(function() {
+ var historic = DOMTokenList.prototype.toggle;
+ DOMTokenList.prototype.toggle = function(token, force) {
+ if(arguments.length > 0 && this.contains(token) === force) {
+ return force;
+ }
+ return historic.call(this, token);
+ };
+})();
+
+
+/* Polyfill for Element.matches() and Element.closest() */
+if(!Element.prototype.matches)
+ Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
+if(!Element.prototype.closest)
+ Element.prototype.closest = function(s) {
+ var el = this;
+ if(!document.documentElement.contains(el)) return null;
+ do {
+ if(el.matches(s)) return el;
+ el = el.parentElement || el.parentNode;
+ } while(el !== null && el.nodeType === 1);
+ return null;
+ };
+
+
+function each(arr, cb) {
+ Array.prototype.forEach.call(arr, cb);
+}
+
+
+/* Elm FFI, see elm/Lib/Ffi.elm.
+ *
+ * All functions are passed a reference to _Json_wrap() to wrap Javascript
+ * values to values that Elm can work with; that function works differently
+ * depending on whether the Elm code was compiled with --optimize.
+ */
+window.elmFfi_openLightbox = function(wrap) { // _VirtualDom_property('onclick', _Json_wrap(function..))
+ return {
+ $: 'a2',
+ n: 'onclick',
+ o: wrap(function() { return window.openLightbox(this) })
+ }
+};
+window.elmFfi_innerHtml = function(wrap) { // \s -> _VirtualDom_property('innerHTML', _Json_wrap(s)
+ return function(s) {
+ return {
+ $: 'a2',
+ n: 'innerHTML',
+ o: wrap(s)
+ }
+ }
+};
+window.elmFfi_curYear = function() { return (new Date()).getFullYear() };
+
+
+/* Add the X-CSRF-Token header to every POST request. Based on:
+ * https://stackoverflow.com/questions/24196140/adding-x-csrf-token-header-globally-to-all-instances-of-xmlhttprequest/24196317#24196317
+ */
+(function() {
+ var open = XMLHttpRequest.prototype.open,
+ token = document.querySelector('meta[name=csrf-token]').content;
+
+ XMLHttpRequest.prototype.open = function(method, url) {
+ var ret = open.apply(this, arguments);
+ this.dataUrl = url;
+ if(method.toLowerCase() == 'post' && /^\//.test(url))
+ this.setRequestHeader('X-CSRF-Token', token);
+ return ret;
+ };
+})();
+
+
+/* Find all divs with a data-elm-module, and embed the given Elm module in the div */
+each(document.querySelectorAll('div[data-elm-module]'), function(el) {
+ var mod = el.getAttribute('data-elm-module').split('.').reduce(function(p, c) { return p[c] }, window.Elm);
+ var flags = el.getAttribute('data-elm-flags');
+ if(flags)
+ mod.init({ node: el, flags: JSON.parse(flags)});
+ else
+ mod.init({ node: el });
+});
+
+
+/* Navbar toggles */
+each(document.querySelectorAll('.navbar__toggler'), function(el) {
+ el.onclick = function() {
+ el.closest('.navbar').classList.toggle('navbar--expanded');
+ };
+});
+each(document.querySelectorAll('.nav-sidebar__selection'), function(el) {
+ el.onclick = function() {
+ el.closest('.nav-sidebar').classList.toggle('nav-sidebar--expanded');
+ };
+});
+
+
+/* Dropdown menus */
+each(document.querySelectorAll('.dropdown'), function(el) {
+ var visible = false;
+
+ function cancel() { visible = false; update() }
+
+ function update() {
+ el.classList.toggle('dropdown--open', visible);
+ setTimeout(function() {
+ if(visible)
+ document.body.addEventListener('click', cancel);
+ else
+ document.body.removeEventListener('click', cancel);
+ });
+ }
+
+ var toggle = el.querySelector('.dropdown__toggle');
+ if(toggle)
+ toggle.onclick = function() {
+ visible = !visible;
+ update();
+ return false;
+ };
+});
+
+
+/* Measure the height of each element within the views and place them in approximately equal columns */
+each(document.querySelectorAll('.js-columnize'), function(el) {
+ var columns = Number(el.dataset.columns || 2);
+ var children = Array.prototype.slice.apply(el.children);
+ var colHeight = children.reduce(function(a, n) { return a + n.offsetHeight }, 0) / columns;
+
+ var col;
+ var curHeight = 0;
+ var row = document.createElement('row');
+ row.className = 'row';
+
+ children.forEach(function(child) {
+ if(!col) {
+ col = document.createElement('div');
+ col.className = 'col-lg col-lg--1';
+ row.appendChild(col);
+ }
+ curHeight += child.offsetHeight;
+ col.appendChild(child);
+ if(curHeight >= colHeight) {
+ col = null;
+ curHeight = 0;
+ }
+ });
+ el.appendChild(row);
+});
+
+
+/* Ensure VN sidebar doesn't overlap header area */
+(function() {
+ var raisedTop = document.querySelector('.raised-top');
+ var sidebar = document.querySelector('.vn-page__top-details');
+ if (!raisedTop || !sidebar) return;
+
+ var img = sidebar.querySelector('.vn-img-desktop');
+ var nextEl = img && img.nextElementSibling;
+ if (!img || !nextEl) return;
+
+ function addMargin() {
+ // reset margin bottom, otherwise if we're called more than once, otherwise the numbers will be off
+ img.style.marginBottom = '25px';
+ // 29: default margin of img (25px) + .top-bar (4px)
+ if (sidebar.offsetTop + nextEl.offsetTop < raisedTop.offsetHeight + 29) {
+ img.style.marginBottom = (raisedTop.offsetHeight - (sidebar.offsetTop + img.offsetTop + img.offsetHeight) + 29) + 'px';
+ }
+ }
+
+ addMargin();
+ if (!img.complete) {
+ img.addEventListener('load', addMargin);
+ }
+ window.addEventListener('resize', function() {
+ setTimeout(addMargin, 0);
+ });
+})();
+
+
+/* NSFW Image toggle */
+each(document.querySelectorAll('img[data-toggle-img]'), function(el) {
+ el.onclick = function() {
+ var cur = this.src;
+ this.src = this.getAttribute('data-toggle-img');
+ this.setAttribute('data-toggle-img', cur);
+ return false;
+ };
+});
+
+
+/* VN tag collapsing, category toggles & spoiler level */
+(function() {
+ var tags = document.querySelector('.tag-summary__tags');
+ if(!tags)
+ return;
+
+ var collapsed = true;
+ var show_all = document.querySelector('.tag-summary__show-all');
+ var check_collapsable = function() {
+ show_all.classList.toggle('d-none', tags.scrollHeight <= 50);
+ };
+ check_collapsable();
+
+ show_all.onclick = function() {
+ collapsed = !collapsed;
+ tags.classList.toggle('tag-summary--collapsed', collapsed);
+ show_all.querySelector('.caret').classList.toggle('caret--up', !collapsed);
+ return false;
+ };
+
+ var toggle = function(cat) {
+ var sw = document.querySelector('.tag-summary__option--'+cat);
+ sw.onclick = function() {
+ sw.classList.toggle('switch--on');
+ tags.classList.toggle('tag-summary--hide-'+cat);
+ check_collapsable();
+ return false;
+ };
+ };
+ toggle('cont');
+ toggle('ero');
+ toggle('tech');
+
+ var spoil_label = document.querySelector('.tag-summary_option--spoil');
+ var spoil = function(lvl) {
+ var lnk = document.querySelector('.tag-summary_option--spoil-'+lvl);
+ lnk.onclick = function() {
+ spoil_label.innerHTML = lnk.innerHTML;
+ tags.classList.toggle('tag-summary--hide-spoil-1', lvl < 1);
+ tags.classList.toggle('tag-summary--hide-spoil-2', lvl < 2);
+ check_collapsable();
+ return false;
+ };
+ };
+ spoil(0);
+ spoil(1);
+ spoil(2);
+})();
+
+
+/* Char page spoiler level and sexual trait hiding */
+(function() {
+ var ero = document.querySelector('.page-inner-controls__option-ero');
+ if(!ero)
+ return;
+
+ var main = document.querySelector('.main-container');
+
+ ero.onclick = function() {
+ var on = main.classList.contains('charpage--hide-ero');
+ main.classList.toggle('charpage--hide-ero', !on);
+ ero.classList.toggle('switch--on', on);
+ return false;
+ };
+
+ var spoil_label = document.querySelector('.page-inner-controls__option-spoil');
+ var spoil = function(lvl) {
+ var lnk = document.querySelector('.page-inner-controls__option-spoil-'+lvl);
+ lnk.onclick = function() {
+ spoil_label.innerHTML = lnk.innerHTML;
+ main.classList.toggle('charpage--hide-spoil-1', lvl < 1);
+ main.classList.toggle('charpage--hide-spoil-2', lvl < 2);
+ return false;
+ };
+ };
+ spoil(0);
+ spoil(1);
+ spoil(2);
+})();
+
+
+/* Lightbox driver.
+ * Usage:
+ *
+ * <a href="dest-image" onclick="return openLightbox(this)" data-lightbox-id="x" data-lightbox-nfo="json">..</a>
+ *
+ * Similar links with the same id are grouped. nfo should be a JSON object
+ * that matches the "Image" type in Lightbox.elm. "full", "thumb" and "load"
+ * are inferred if not present.
+ */
+(function(){
+ var div;
+ var app;
+ var preload = {};
+
+ var create = function() {
+ if(div)
+ return;
+
+ div = document.createElement('div');
+ document.body.appendChild(div);
+ app = window.Elm.Lightbox.init({ node: div });
+
+ app.ports.close.subscribe(function() {
+ document.body.classList.remove('lightbox-open');
+ });
+
+ app.ports.preload.subscribe(function(url) {
+ if(!preload[url]) {
+ preload[url] = new Image();
+ preload[url].onload = function() { app.ports.preloaded.send(url); };
+ preload[url].src = url;
+ }
+ if(preload[url].complete)
+ preload[url].onload();
+ });
+ };
+
+ var model = function(ev) {
+ var l = document.querySelectorAll("a[data-lightbox-id="+ev.getAttribute('data-lightbox-id')+"]");
+ var mod = { width: 0, height: 0, images: [], current: 0 };
+ for(var i=0; i<l.length; i++) {
+ if(l[i] == ev)
+ mod.current = i;
+ var inf = JSON.parse(l[i].getAttribute('data-lightbox-nfo'));
+ if(!inf.full) inf.full = l[i].href;
+ if(!inf.thumb) inf.thumb = inf.full.replace("/sf/", "/st/");
+ if(!inf.rel) inf.rel = null;
+ inf.load = !!preload[inf.full];
+ mod.images.push(inf);
+ }
+ return mod;
+ };
+
+ window.openLightbox = function(ev) {
+ create();
+ document.body.classList.add('lightbox-open');
+ app.ports.open.send(model(ev));
+ return false;
+ };
+})();
+
+
+/* VN Gallery NSFW toggle */
+(function(){
+ var gallery = document.querySelector('.gallery');
+ if(!gallery)
+ return;
+
+ var show_nsfw = gallery.classList.contains('gallery--show-r18');
+ var toggle = gallery.querySelector('.gallery-r18-toggle');
+ if(toggle)
+ toggle.onclick = function() {
+ show_nsfw = !show_nsfw;
+ toggle.classList.toggle('switch--on', show_nsfw);
+ gallery.classList.toggle('gallery--show-r18', show_nsfw);
+ return false;
+ };
+
+ var images = gallery.querySelectorAll('.gallery__image-link');
+ each(images, function(el) {
+ el.onclick = function() {
+ // Fixup data-lightbox-id to exclude hidden images before opening the lightbox
+ each(images, function(img) {
+ img.setAttribute('data-lightbox-id', !show_nsfw && img.classList.contains('gallery__image--r18') ? 'scr-nsfw' : 'scr');
+ });
+ return openLightbox(this);
+ };
+ });
+})();
+
+
+/* VN character switcher.
+ * TODO: Update URL on switch?
+ */
+(function(){
+ var chars = document.querySelectorAll('#characters .character');
+ if(!chars)
+ return;
+ var links = document.querySelectorAll('.character-browser__top-items .character-browser__char');
+
+ each(links, function(el) {
+ el.onclick = function() {
+ var id = el.getAttribute('data-character');
+ each(chars, function(ch) { ch.classList.toggle('d-none', ch.getAttribute('data-character') != id); });
+ each(links, function(lk) { lk.classList.toggle('character-browser__char--active', el == lk); });
+ return false;
+ };
+ });
+})();
+
+
+/* User VN List */
+(function(){
+ function toggleExpand(el, contentClass) {
+ var arrow = el.querySelector('.expand-arrow');
+ arrow.classList.toggle('expand-arrow--open');
+
+ var nextRow = el.closest('tr').nextSibling;
+ while (nextRow) {
+ // skip over text nodes
+ while (nextRow && nextRow.nodeType == Node.TEXT_NODE) {
+ nextRow = nextRow.nextSibling;
+ }
+ if (nextRow) {
+ if (nextRow.classList.contains(contentClass)) {
+ // is this the row we're looking for?
+ nextRow.classList.toggle('d-none');
+ break;
+ }
+ // apparently not, so continue to next
+ nextRow = nextRow.nextSibling;
+ }
+ }
+ }
+
+ each(document.querySelectorAll('.vn-list .vn-list__expand-releases'), function(el) {
+ el.addEventListener('click', function() {
+ toggleExpand(el, 'vn-list__releases-row');
+ });
+ });
+
+ each(document.querySelectorAll('.vn-list .vn-list__expand-comment'), function(el) {
+ el.addEventListener('click', function() {
+ toggleExpand(el, 'vn-list__comment-row');
+ });
+ });
+})();
diff --git a/static/v3/windows.svg b/static/v3/windows.svg
new file mode 100644
index 00000000..586ba25d
--- /dev/null
+++ b/static/v3/windows.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M0 93.7l183.6-25.3v177.4H0V93.7zm0 324.6l183.6 25.3V268.4H0v149.9zm203.8 28L448 480V268.4H203.8v177.9zm0-380.6v180.1H448V32L203.8 65.7z"/></svg> \ No newline at end of file