use the following search parameters to narrow your results:
e.g. subreddit:pics site:imgur.com dog
subreddit:pics site:imgur.com dog
advanced search: by author, sub...
~1 user here now
This subsaidit is for demonstrating and testing fun little CSS features.
JS SVG test
submitted 5 years ago by wizzwizz4 from self.wizzwizz4_css_test_1
Does this one-box? https://wizzwizz4.github.io/mock-malice/alert.svg
[–]wizzwizz4[S] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - 5 years ago (0 children)
Huh. When an SVG-with-JavaScript is included in an img tag, the JavaScript doesn't run.
img
[–][deleted] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - 5 years ago (17 children)
Yeah we can't render svg here without stripping js, especially these days.
[–]wizzwizz4[S] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - 5 years ago (16 children)
In <img / > tags Firefox ignores the JavaScript. Is that the same in Chrome? You can use my example to test. (Don't worry; it doesn't mine crypto or use Meltdown to GET U.)
<img / >
Otherwise, you can just display the image in an <iframe></iframe>.
<iframe></iframe>
[–][deleted] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - 5 years ago (15 children)
Oh, iframe is a good idea. Yeah the js runs for me in Chrome once I leave the site and view it.
[–]wizzwizz4[S] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 0 fun3 insightful - 1 fun - 5 years ago (14 children)
That's expected. But does it run in Chrome in an <img /> tag? I tested it and it didn't, so there should be no problem with including SVGs.
<img />
[–][deleted] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - 5 years ago (13 children)
It looks like you're right, no internal js is run if rendered as an <img>
[–]wizzwizz4[S] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - 5 years ago (12 children)
So, add? (Please please please?) 🥺
[–][deleted] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - 5 years ago (11 children)
Alright, it's on our Todo list. I'll show you where the relevant code is if you're so inclined.
[–]wizzwizz4[S] 3 insightful - 1 fun3 insightful - 0 fun4 insightful - 0 fun4 insightful - 1 fun - 5 years ago* (10 children)
That'd be great; I can't actually find it right now (assuming it's Python).
Edit: https://github.com/libertysoft3/saidit/blob/master/r2/r2/public/static/js/expando-md.js
Edit #2: https://github.com/libertysoft3/saidit/pull/9
[–][deleted] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 0 fun3 insightful - 1 fun - 5 years ago (1 child)
Nice work! Supporting more url formats was a boss change too. I'll get around to adding this same image support for saidit posts proper too.
/u/magnora7 check it out the wizz added .svg support.
https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/mudflap.svg
https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/json.svg
You can embed rasters in vectors? Hmm..
https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/image.svg
[–]magnora7 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 0 fun3 insightful - 1 fun - 5 years ago (0 children)
Wow that's great! I love it when other users contribute code and add more functionality. I thanked them for it, that's awesome
[–]magnora7 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - 5 years ago* (7 children)
Hey nice coding wizzwizz, solid job! Very much appreciate the added functionality, and I'm sure the users will too. Thank you. We're proud to have more code contributions to the site by users like you.
[–]wizzwizz4[S] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - 5 years ago (6 children)
Adding your wishlist to GitHub Issues, and maybe setting up a Project Board or two would help to permit contributions.
[–]wizzwizz4[S] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - (0 children)
[–][deleted] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - (17 children)
[–]wizzwizz4[S] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - (16 children)
[–][deleted] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - (15 children)
[–]wizzwizz4[S] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 0 fun3 insightful - 1 fun - (14 children)
[–][deleted] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - (13 children)
[–]wizzwizz4[S] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - (12 children)
[–][deleted] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - (11 children)
[–]wizzwizz4[S] 3 insightful - 1 fun3 insightful - 0 fun4 insightful - 0 fun4 insightful - 1 fun - (10 children)
[–][deleted] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 0 fun3 insightful - 1 fun - (1 child)
[–]magnora7 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 0 fun3 insightful - 1 fun - (0 children)
[–]magnora7 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - (7 children)
[–]wizzwizz4[S] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 0 fun2 insightful - 1 fun - (6 children)