This commit is contained in:
Aevann1 2021-09-17 15:40:13 +02:00
parent ed16b7e0a3
commit 658923db45
3 changed files with 91 additions and 133 deletions

View file

@ -157,12 +157,6 @@
block.i(local); block.i(local);
} }
} }
const globals = (typeof window !== 'undefined'
? window
: typeof globalThis !== 'undefined'
? globalThis
: global);
function mount_component(component, target, anchor, customElement) { function mount_component(component, target, anchor, customElement) {
const { fragment, on_mount, on_destroy, after_update } = component.$$; const { fragment, on_mount, on_destroy, after_update } = component.$$;
fragment && fragment.m(target, anchor); fragment && fragment.m(target, anchor);
@ -324,6 +318,13 @@
else else
dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value }); dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value });
} }
function set_data_dev(text, data) {
data = '' + data;
if (text.wholeText === data)
return;
dispatch_dev('SvelteDOMSetData', { node: text, data });
text.data = data;
}
function validate_each_argument(arg) { function validate_each_argument(arg) {
if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) { if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) {
let msg = '{#each} only iterates over array-like objects.'; let msg = '{#each} only iterates over array-like objects.';
@ -362,7 +363,6 @@
/* src\App.svelte generated by Svelte v3.42.6 */ /* src\App.svelte generated by Svelte v3.42.6 */
const { console: console_1 } = globals;
const file = "src\\App.svelte"; const file = "src\\App.svelte";
function get_each_context(ctx, list, i) { function get_each_context(ctx, list, i) {
@ -372,12 +372,13 @@
return child_ctx; return child_ctx;
} }
// (50:7) {#if award.owned < 1} // (53:7) {#if award.owned < 1}
function create_if_block_2(ctx) { function create_if_block_2(ctx) {
let input; let input;
let t0; let t0;
let label; let label;
let i; let i;
let i_class_value;
let br; let br;
let t1; let t1;
let span1; let span1;
@ -411,20 +412,20 @@
attr_dev(input, "id", /*index*/ ctx[9]); attr_dev(input, "id", /*index*/ ctx[9]);
attr_dev(input, "class", "svelte-13ovg7j"); attr_dev(input, "class", "svelte-13ovg7j");
toggle_class(input, "disabled", /*award*/ ctx[7].owned < 1); toggle_class(input, "disabled", /*award*/ ctx[7].owned < 1);
add_location(input, file, 50, 8, 1291); add_location(input, file, 53, 8, 1321);
attr_dev(i, "class", "" + (/*award*/ ctx[7].icon + " " + /*award*/ ctx[7].color + " svelte-13ovg7j")); attr_dev(i, "class", i_class_value = "" + (/*award*/ ctx[7].icon + " " + /*award*/ ctx[7].color + " svelte-13ovg7j"));
add_location(i, file, 52, 9, 1469); add_location(i, file, 55, 9, 1499);
add_location(br, file, 52, 51, 1511); add_location(br, file, 55, 51, 1541);
attr_dev(span0, "class", "text-muted"); attr_dev(span0, "class", "text-muted");
add_location(span0, file, 54, 9, 1629); add_location(span0, file, 57, 9, 1659);
attr_dev(span1, "class", "d-block pt-2"); attr_dev(span1, "class", "d-block pt-2");
set_style(span1, "font-weight", "bold"); set_style(span1, "font-weight", "bold");
set_style(span1, "font-size", "14px"); set_style(span1, "font-size", "14px");
add_location(span1, file, 53, 9, 1528); add_location(span1, file, 56, 9, 1558);
attr_dev(label, "class", "card svelte-13ovg7j"); attr_dev(label, "class", "card svelte-13ovg7j");
attr_dev(label, "for", /*index*/ ctx[9]); attr_dev(label, "for", /*index*/ ctx[9]);
toggle_class(label, "disabled", /*award*/ ctx[7].owned < 1); toggle_class(label, "disabled", /*award*/ ctx[7].owned < 1);
add_location(label, file, 51, 8, 1389); add_location(label, file, 54, 8, 1419);
}, },
m: function mount(target, anchor) { m: function mount(target, anchor) {
insert_dev(target, input, anchor); insert_dev(target, input, anchor);
@ -451,6 +452,21 @@
if (dirty & /*picked*/ 2) { if (dirty & /*picked*/ 2) {
set_input_value(input, /*picked*/ ctx[1]); set_input_value(input, /*picked*/ ctx[1]);
} }
if (dirty & /*awards*/ 4) {
toggle_class(input, "disabled", /*award*/ ctx[7].owned < 1);
}
if (dirty & /*awards*/ 4 && i_class_value !== (i_class_value = "" + (/*award*/ ctx[7].icon + " " + /*award*/ ctx[7].color + " svelte-13ovg7j"))) {
attr_dev(i, "class", i_class_value);
}
if (dirty & /*awards*/ 4 && t2_value !== (t2_value = /*award*/ ctx[7].title + "")) set_data_dev(t2, t2_value);
if (dirty & /*awards*/ 4 && t4_value !== (t4_value = /*award*/ ctx[7].owned + "")) set_data_dev(t4, t4_value);
if (dirty & /*awards*/ 4) {
toggle_class(label, "disabled", /*award*/ ctx[7].owned < 1);
}
}, },
d: function destroy(detaching) { d: function destroy(detaching) {
if (detaching) detach_dev(input); if (detaching) detach_dev(input);
@ -465,14 +481,14 @@
block, block,
id: create_if_block_2.name, id: create_if_block_2.name,
type: "if", type: "if",
source: "(50:7) {#if award.owned < 1}", source: "(53:7) {#if award.owned < 1}",
ctx ctx
}); });
return block; return block;
} }
// (49:6) {#each awards as award, index} // (52:6) {#each awards as award, index}
function create_each_block(ctx) { function create_each_block(ctx) {
let if_block_anchor; let if_block_anchor;
let if_block = /*award*/ ctx[7].owned < 1 && create_if_block_2(ctx); let if_block = /*award*/ ctx[7].owned < 1 && create_if_block_2(ctx);
@ -487,7 +503,18 @@
insert_dev(target, if_block_anchor, anchor); insert_dev(target, if_block_anchor, anchor);
}, },
p: function update(ctx, dirty) { p: function update(ctx, dirty) {
if (/*award*/ ctx[7].owned < 1) if_block.p(ctx, dirty); if (/*award*/ ctx[7].owned < 1) {
if (if_block) {
if_block.p(ctx, dirty);
} else {
if_block = create_if_block_2(ctx);
if_block.c();
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
}, },
d: function destroy(detaching) { d: function destroy(detaching) {
if (if_block) if_block.d(detaching); if (if_block) if_block.d(detaching);
@ -499,14 +526,14 @@
block, block,
id: create_each_block.name, id: create_each_block.name,
type: "each", type: "each",
source: "(49:6) {#each awards as award, index}", source: "(52:6) {#each awards as award, index}",
ctx ctx
}); });
return block; return block;
} }
// (61:5) {#if picked != null} // (64:5) {#if picked != null}
function create_if_block_1(ctx) { function create_if_block_1(ctx) {
let div2; let div2;
let div1; let div1;
@ -544,24 +571,24 @@
textarea = element("textarea"); textarea = element("textarea");
set_style(i, "font-size", "35px"); set_style(i, "font-size", "35px");
attr_dev(i, "class", "" + (/*pickedAward*/ ctx[4].icon + " " + /*pickedAward*/ ctx[4].color + " svelte-13ovg7j")); attr_dev(i, "class", "" + (/*pickedAward*/ ctx[4].icon + " " + /*pickedAward*/ ctx[4].color + " svelte-13ovg7j"));
add_location(i, file, 63, 8, 1829); add_location(i, file, 66, 8, 1859);
add_location(strong, file, 65, 9, 1961); add_location(strong, file, 68, 9, 1991);
add_location(br, file, 65, 51, 2003); add_location(br, file, 68, 51, 2033);
attr_dev(span, "class", "text-muted"); attr_dev(span, "class", "text-muted");
add_location(span, file, 66, 9, 2020); add_location(span, file, 69, 9, 2050);
set_style(div0, "margin-left", "15px"); set_style(div0, "margin-left", "15px");
add_location(div0, file, 64, 8, 1918); add_location(div0, file, 67, 8, 1948);
attr_dev(div1, "class", "award-desc p-3 svelte-13ovg7j"); attr_dev(div1, "class", "award-desc p-3 svelte-13ovg7j");
add_location(div1, file, 62, 7, 1791); add_location(div1, file, 65, 7, 1821);
attr_dev(label, "for", "note"); attr_dev(label, "for", "note");
attr_dev(label, "class", "pt-4"); attr_dev(label, "class", "pt-4");
add_location(label, file, 69, 7, 2117); add_location(label, file, 72, 7, 2147);
attr_dev(textarea, "id", "note"); attr_dev(textarea, "id", "note");
attr_dev(textarea, "name", "note"); attr_dev(textarea, "name", "note");
attr_dev(textarea, "class", "form-control"); attr_dev(textarea, "class", "form-control");
attr_dev(textarea, "placeholder", "Note to include in award notification"); attr_dev(textarea, "placeholder", "Note to include in award notification");
add_location(textarea, file, 70, 7, 2181); add_location(textarea, file, 73, 7, 2211);
add_location(div2, file, 61, 6, 1777); add_location(div2, file, 64, 6, 1807);
}, },
m: function mount(target, anchor) { m: function mount(target, anchor) {
insert_dev(target, div2, anchor); insert_dev(target, div2, anchor);
@ -600,14 +627,14 @@
block, block,
id: create_if_block_1.name, id: create_if_block_1.name,
type: "if", type: "if",
source: "(61:5) {#if picked != null}", source: "(64:5) {#if picked != null}",
ctx ctx
}); });
return block; return block;
} }
// (83:3) {:else} // (86:3) {:else}
function create_else_block(ctx) { function create_else_block(ctx) {
let button; let button;
let mounted; let mounted;
@ -621,7 +648,7 @@
attr_dev(button, "class", "btn btn-link"); attr_dev(button, "class", "btn btn-link");
attr_dev(button, "id", "awardButton"); attr_dev(button, "id", "awardButton");
toggle_class(button, "disabled", /*pickedAward*/ ctx[4] === null); toggle_class(button, "disabled", /*pickedAward*/ ctx[4] === null);
add_location(button, file, 83, 4, 2713); add_location(button, file, 86, 4, 2743);
}, },
m: function mount(target, anchor) { m: function mount(target, anchor) {
insert_dev(target, button, anchor); insert_dev(target, button, anchor);
@ -643,14 +670,14 @@
block, block,
id: create_else_block.name, id: create_else_block.name,
type: "else", type: "else",
source: "(83:3) {:else}", source: "(86:3) {:else}",
ctx ctx
}); });
return block; return block;
} }
// (78:3) {#if pending} // (81:3) {#if pending}
function create_if_block(ctx) { function create_if_block(ctx) {
let button; let button;
let span; let span;
@ -664,11 +691,11 @@
attr_dev(span, "class", "spinner-border spinner-border-sm"); attr_dev(span, "class", "spinner-border spinner-border-sm");
attr_dev(span, "role", "status"); attr_dev(span, "role", "status");
attr_dev(span, "aria-hidden", "true"); attr_dev(span, "aria-hidden", "true");
add_location(span, file, 79, 5, 2576); add_location(span, file, 82, 5, 2606);
attr_dev(button, "class", "btn btn-warning"); attr_dev(button, "class", "btn btn-warning");
attr_dev(button, "type", "button"); attr_dev(button, "type", "button");
button.disabled = true; button.disabled = true;
add_location(button, file, 78, 4, 2514); add_location(button, file, 81, 4, 2544);
}, },
m: function mount(target, anchor) { m: function mount(target, anchor) {
insert_dev(target, button, anchor); insert_dev(target, button, anchor);
@ -685,7 +712,7 @@
block, block,
id: create_if_block.name, id: create_if_block.name,
type: "if", type: "if",
source: "(78:3) {#if pending}", source: "(81:3) {#if pending}",
ctx ctx
}); });
@ -713,7 +740,7 @@
let div3; let div3;
let button1; let button1;
let t7; let t7;
let each_value = /*awards*/ ctx[3]; let each_value = /*awards*/ ctx[2];
validate_each_argument(each_value); validate_each_argument(each_value);
let each_blocks = []; let each_blocks = [];
@ -724,7 +751,7 @@
let if_block0 = /*picked*/ ctx[1] != null && create_if_block_1(ctx); let if_block0 = /*picked*/ ctx[1] != null && create_if_block_1(ctx);
function select_block_type(ctx, dirty) { function select_block_type(ctx, dirty) {
if (/*pending*/ ctx[2]) return create_if_block; if (/*pending*/ ctx[3]) return create_if_block;
return create_else_block; return create_else_block;
} }
@ -765,40 +792,40 @@
attr_dev(input, "type", "hidden"); attr_dev(input, "type", "hidden");
attr_dev(input, "id", "awardTarget"); attr_dev(input, "id", "awardTarget");
input.value = ""; input.value = "";
add_location(input, file, 36, 0, 664); add_location(input, file, 39, 0, 694);
attr_dev(h5, "class", "modal-title"); attr_dev(h5, "class", "modal-title");
add_location(h5, file, 40, 4, 872); add_location(h5, file, 43, 4, 902);
attr_dev(i, "class", "far fa-times"); attr_dev(i, "class", "far fa-times");
add_location(i, file, 42, 30, 1025); add_location(i, file, 45, 30, 1055);
attr_dev(span, "aria-hidden", "true"); attr_dev(span, "aria-hidden", "true");
add_location(span, file, 42, 5, 1000); add_location(span, file, 45, 5, 1030);
attr_dev(button0, "type", "button"); attr_dev(button0, "type", "button");
attr_dev(button0, "class", "close"); attr_dev(button0, "class", "close");
attr_dev(button0, "data-dismiss", "modal"); attr_dev(button0, "data-dismiss", "modal");
attr_dev(button0, "aria-label", "Close"); attr_dev(button0, "aria-label", "Close");
add_location(button0, file, 41, 4, 917); add_location(button0, file, 44, 4, 947);
attr_dev(div0, "class", "modal-header"); attr_dev(div0, "class", "modal-header");
add_location(div0, file, 39, 3, 840); add_location(div0, file, 42, 3, 870);
attr_dev(div1, "class", "card-columns awards-wrapper svelte-13ovg7j"); attr_dev(div1, "class", "card-columns awards-wrapper svelte-13ovg7j");
add_location(div1, file, 47, 5, 1172); add_location(div1, file, 50, 5, 1202);
attr_dev(form, "class", "pt-3 pb-0"); attr_dev(form, "class", "pt-3 pb-0");
add_location(form, file, 46, 4, 1141); add_location(form, file, 49, 4, 1171);
attr_dev(div2, "id", "awardModalBody"); attr_dev(div2, "id", "awardModalBody");
attr_dev(div2, "class", "modal-body"); attr_dev(div2, "class", "modal-body");
add_location(div2, file, 45, 3, 1091); add_location(div2, file, 48, 3, 1121);
attr_dev(button1, "type", "button"); attr_dev(button1, "type", "button");
attr_dev(button1, "class", "btn btn-link text-muted"); attr_dev(button1, "class", "btn btn-link text-muted");
attr_dev(button1, "data-dismiss", "modal"); attr_dev(button1, "data-dismiss", "modal");
add_location(button1, file, 76, 3, 2400); add_location(button1, file, 79, 3, 2430);
attr_dev(div3, "class", "modal-footer"); attr_dev(div3, "class", "modal-footer");
add_location(div3, file, 75, 2, 2369); add_location(div3, file, 78, 2, 2399);
attr_dev(div4, "class", "modal-content"); attr_dev(div4, "class", "modal-content");
add_location(div4, file, 38, 2, 808); add_location(div4, file, 41, 2, 838);
attr_dev(div5, "class", "modal-dialog modal-dialog-scrollable modal-dialog-centered"); attr_dev(div5, "class", "modal-dialog modal-dialog-scrollable modal-dialog-centered");
attr_dev(div5, "role", "document"); attr_dev(div5, "role", "document");
add_location(div5, file, 37, 1, 716); add_location(div5, file, 40, 1, 746);
attr_dev(div6, "id", "svelte-app2"); attr_dev(div6, "id", "svelte-app2");
add_location(div6, file, 35, 0, 640); add_location(div6, file, 38, 0, 670);
}, },
l: function claim(nodes) { l: function claim(nodes) {
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
@ -833,8 +860,8 @@
if_block1.m(div3, null); if_block1.m(div3, null);
}, },
p: function update(ctx, [dirty]) { p: function update(ctx, [dirty]) {
if (dirty & /*awards, picked*/ 10) { if (dirty & /*awards, picked*/ 6) {
each_value = /*awards*/ ctx[3]; each_value = /*awards*/ ctx[2];
validate_each_argument(each_value); validate_each_argument(each_value);
let i; let i;
@ -910,8 +937,11 @@
let pending = false; let pending = false;
let note = ""; let note = "";
let picked = null; let picked = null;
const awards = document.getElementById("user_awards").value; let awards = null;
console.log(awards);
fetch('/awards').then(response => response.json()).then(json => {
$$invalidate(2, awards = json);
});
function pickedAward() { function pickedAward() {
if (picked !== null) { if (picked !== null) {
@ -924,7 +954,7 @@
const writable_props = []; const writable_props = [];
Object.keys($$props).forEach(key => { Object.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console_1.warn(`<App> was created with unknown prop '${key}'`); if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<App> was created with unknown prop '${key}'`);
}); });
function input_change_handler() { function input_change_handler() {
@ -947,9 +977,10 @@
}); });
$$self.$inject_state = $$props => { $$self.$inject_state = $$props => {
if ('pending' in $$props) $$invalidate(2, pending = $$props.pending); if ('pending' in $$props) $$invalidate(3, pending = $$props.pending);
if ('note' in $$props) $$invalidate(0, note = $$props.note); if ('note' in $$props) $$invalidate(0, note = $$props.note);
if ('picked' in $$props) $$invalidate(1, picked = $$props.picked); if ('picked' in $$props) $$invalidate(1, picked = $$props.picked);
if ('awards' in $$props) $$invalidate(2, awards = $$props.awards);
}; };
if ($$props && "$$inject" in $$props) { if ($$props && "$$inject" in $$props) {
@ -959,8 +990,8 @@
return [ return [
note, note,
picked, picked,
pending,
awards, awards,
pending,
pickedAward, pickedAward,
input_change_handler, input_change_handler,
textarea_input_handler textarea_input_handler

View file

@ -23,53 +23,6 @@ defaultcolor = environ.get("DEFAULT_COLOR", "fff").strip()
defaulttimefilter = environ.get("DEFAULT_TIME_FILTER", "all").strip() defaulttimefilter = environ.get("DEFAULT_TIME_FILTER", "all").strip()
cardview = bool(int(environ.get("CARD_VIEW", 1))) cardview = bool(int(environ.get("CARD_VIEW", 1)))
# if site_name == "Drama":
# AWARDS = {
# "ban": {
# "kind": "ban",
# "title": "One-Day Ban",
# "description": "Bans the author for a day.",
# "icon": "fas fa-gavel",
# "color": "text-danger",
# "price": 5000
# },
# "shit": {
# "kind": "shit",
# "title": "Shit",
# "description": "Makes flies swarm a post.",
# "icon": "fas fa-poop",
# "color": "text-black-50",
# "price": 1000
# },
# "stars": {
# "kind": "stars",
# "title": "Stars",
# "description": "Puts stars on the post.",
# "icon": "fas fa-sparkles",
# "color": "text-warning",
# "price": 1000
# }
# }
# else:
# AWARDS = {
# "shit": {
# "kind": "shit",
# "title": "shit",
# "description": "Makes flies swarm a post.",
# "icon": "fas fa-poop",
# "color": "text-black-50",
# "price": 1000
# },
# "stars": {
# "kind": "stars",
# "title": "Stars",
# "description": "Puts stars on the post.",
# "icon": "fas fa-sparkles",
# "color": "text-warning",
# "price": 1000
# }
# }
class User(Base, Stndrd, Age_times): class User(Base, Stndrd, Age_times):
__tablename__ = "users" __tablename__ = "users"
id = Column(Integer, primary_key=True) id = Column(Integer, primary_key=True)
@ -180,17 +133,6 @@ class User(Base, Stndrd, Age_times):
super().__init__(**kwargs) super().__init__(**kwargs)
# @property
# @lazy
# def user_awards(v):
# return_value = list(AWARDS.values())
# user_awards = v.awards
# for val in return_value: val['owned'] = user_awards.filter_by(kind=val['kind'], submission_id=None, comment_id=None).count()
# return jsonify(return_value)
@property @property
@lazy @lazy
def referral_count(self): def referral_count(self):

View file

@ -696,19 +696,4 @@
{% endif %} {% endif %}
{% endblock %}
{% block GIFtoast %}
<div class="toast" id="toast-error-gif" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 1000" role="alert" aria-live="assertive" aria-atomic="true" data-animation="true" data-autohide="true" data-delay="5000">
<div class="toast-body bg-danger text-center text-white">
<i class="fas fa-exclamation-circle mr-2"></i>Unable to snag gifs :(
</div>
</div>
{% endblock %}
{% block GIFpicker %}
{% if v %}
{% include "award_modal.html" %}
{% endif %}
{% include "expanded_image_modal.html" %}
{% endblock %} {% endblock %}