diff --git a/files/assets/js/svelte.js b/files/assets/js/svelte.js index 10cb367fc..f9fbb1bf3 100644 --- a/files/assets/js/svelte.js +++ b/files/assets/js/svelte.js @@ -1,8 +1,12 @@ (function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); -(function () { +(function (marked) { 'use strict'; + function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + + var marked__default = /*#__PURE__*/_interopDefaultLegacy(marked); + function noop() { } function add_location(element, file, line, column, char) { element.__svelte_meta = { @@ -24,14 +28,6 @@ function safe_not_equal(a, b) { return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); } - let src_url_equal_anchor; - function src_url_equal(element_src, url) { - if (!src_url_equal_anchor) { - src_url_equal_anchor = document.createElement('a'); - } - src_url_equal_anchor.href = url; - return element_src === src_url_equal_anchor.href; - } function is_empty(obj) { return Object.keys(obj).length === 0; } @@ -50,6 +46,13 @@ function space() { return text(' '); } + function empty() { + return text(''); + } + function listen(node, event, handler, options) { + node.addEventListener(event, handler, options); + return () => node.removeEventListener(event, handler, options); + } function attr(node, attribute, value) { if (value == null) node.removeAttribute(attribute); @@ -59,11 +62,47 @@ function children(element) { return Array.from(element.childNodes); } + function set_input_value(input, value) { + input.value = value == null ? '' : value; + } function custom_event(type, detail, bubbles = false) { const e = document.createEvent('CustomEvent'); e.initCustomEvent(type, bubbles, false, detail); return e; } + class HtmlTag { + constructor() { + this.e = this.n = null; + } + c(html) { + this.h(html); + } + m(html, target, anchor = null) { + if (!this.e) { + this.e = element(target.nodeName); + this.t = target; + this.c(html); + } + this.i(anchor); + } + h(html) { + this.e.innerHTML = html; + this.n = Array.from(this.e.childNodes); + } + i(anchor) { + for (let i = 0; i < this.n.length; i += 1) { + insert(this.t, this.n[i], anchor); + } + } + p(html) { + this.d(); + this.h(html); + this.i(this.a); + } + d() { + this.n.forEach(detach); + } + } let current_component; function set_current_component(component) { @@ -277,6 +316,19 @@ dispatch_dev('SvelteDOMRemove', { node }); detach(node); } + function listen_dev(node, event, handler, options, has_prevent_default, has_stop_propagation) { + const modifiers = options === true ? ['capture'] : options ? Array.from(Object.keys(options)) : []; + if (has_prevent_default) + modifiers.push('preventDefault'); + if (has_stop_propagation) + modifiers.push('stopPropagation'); + dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers }); + const dispose = listen(node, event, handler, options); + return () => { + dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers }); + dispose(); + }; + } function attr_dev(node, attribute, value) { attr(node, attribute, value); if (value == null) @@ -312,41 +364,67 @@ } /* src\App.svelte generated by Svelte v3.42.6 */ - const file = "src\\App.svelte"; function create_fragment(ctx) { - let h1; - let t1; - let img; - let img_src_value; + let textarea; + let t; + let html_tag; + let raw_value = marked__default['default'](/*text*/ ctx[0]) + ""; + let html_anchor; + let mounted; + let dispose; const block = { c: function create() { - h1 = element("h1"); - h1.textContent = "Average svelte enjoyer:"; - t1 = space(); - img = element("img"); - add_location(h1, file, 5, 0, 112); - if (!src_url_equal(img.src, img_src_value = /*src*/ ctx[0])) attr_dev(img, "src", img_src_value); - attr_dev(img, "alt", /*name*/ ctx[1]); - add_location(img, file, 6, 0, 145); + textarea = element("textarea"); + t = space(); + html_tag = new HtmlTag(); + html_anchor = empty(); + attr_dev(textarea, "form", "submitform"); + attr_dev(textarea, "id", "post-text"); + attr_dev(textarea, "class", "form-control rounded"); + attr_dev(textarea, "aria-label", "With textarea"); + attr_dev(textarea, "placeholder", "Optional if you have a link or an image."); + attr_dev(textarea, "rows", "3"); + attr_dev(textarea, "name", "body"); + attr_dev(textarea, "oninput", "charLimit('post-text','character-count-submit-text-form');checkForRequired()"); + attr_dev(textarea, "maxlength", "10000"); + textarea.required = true; + add_location(textarea, file, 5, 0, 66); + html_tag.a = html_anchor; }, l: function claim(nodes) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: function mount(target, anchor) { - insert_dev(target, h1, anchor); - insert_dev(target, t1, anchor); - insert_dev(target, img, anchor); + insert_dev(target, textarea, anchor); + set_input_value(textarea, /*text*/ ctx[0]); + insert_dev(target, t, anchor); + html_tag.m(raw_value, target, anchor); + insert_dev(target, html_anchor, anchor); + + if (!mounted) { + dispose = listen_dev(textarea, "input", /*textarea_input_handler*/ ctx[1]); + mounted = true; + } + }, + p: function update(ctx, [dirty]) { + if (dirty & /*text*/ 1) { + set_input_value(textarea, /*text*/ ctx[0]); + } + + if (dirty & /*text*/ 1 && raw_value !== (raw_value = marked__default['default'](/*text*/ ctx[0]) + "")) html_tag.p(raw_value); }, - p: noop, i: noop, o: noop, d: function destroy(detaching) { - if (detaching) detach_dev(h1); - if (detaching) detach_dev(t1); - if (detaching) detach_dev(img); + if (detaching) detach_dev(textarea); + if (detaching) detach_dev(t); + if (detaching) detach_dev(html_anchor); + if (detaching) html_tag.d(); + mounted = false; + dispose(); } }; @@ -364,26 +442,29 @@ function instance($$self, $$props, $$invalidate) { let { $$slots: slots = {}, $$scope } = $$props; validate_slots('App', slots, []); - let src = 'https://rdrama.net/assets/images/emojis/gigachad2.webp'; - let name = 'Gigachad'; + let text = ``; const writable_props = []; Object.keys($$props).forEach(key => { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); }); - $$self.$capture_state = () => ({ src, name }); + function textarea_input_handler() { + text = this.value; + $$invalidate(0, text); + } + + $$self.$capture_state = () => ({ marked: marked__default['default'], text }); $$self.$inject_state = $$props => { - if ('src' in $$props) $$invalidate(0, src = $$props.src); - if ('name' in $$props) $$invalidate(1, name = $$props.name); + if ('text' in $$props) $$invalidate(0, text = $$props.text); }; if ($$props && "$$inject" in $$props) { $$self.$inject_state($$props.$$inject); } - return [src, name]; + return [text, textarea_input_handler]; } class App extends SvelteComponentDev { @@ -404,5 +485,5 @@ target: document.querySelector('#svelte-app') }); -}()); +}(marked)); //# sourceMappingURL=bundle.js.map diff --git a/files/routes/static.py b/files/routes/static.py index f0e2417d8..a6802d218 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -8,10 +8,6 @@ from os import path site = environ.get("DOMAIN").strip() site_name = environ.get("SITE_NAME").strip() -@app.route("/svelte") -def svelte(): - return render_template('svelte.html') - @app.get('/rules') @auth_desired def static_rules(v): diff --git a/files/templates/submit.html b/files/templates/submit.html index 6c5727b3c..f35376364 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -4,8 +4,6 @@ {% include "bootstrap.html" %} - - diff --git a/files/templates/svelte.html b/files/templates/svelte.html deleted file mode 100644 index dd46b9b86..000000000 --- a/files/templates/svelte.html +++ /dev/null @@ -1,3 +0,0 @@ - -fuck yes -
\ No newline at end of file