-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #311 from GiovanH/mspfa
MSPFA Feature Support working draft
- Loading branch information
Showing
17 changed files
with
1,918 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,4 +33,7 @@ pnpm-debug.log* | |
install | ||
|
||
# generated file | ||
src/imods.tar | ||
src/imods.tar | ||
|
||
/tools/mspfa/*/ | ||
/tools/mspfa/*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<script> | ||
import MSPFAPage from '@/components/CustomContent/MSPFAPage.vue' | ||
import MSPFALog from '@/components/CustomContent/MSPFALog.vue' | ||
import MSPFAIndex from '@/components/CustomContent/MSPFAIndex.vue' | ||
function resolveStory(ctx, input) { | ||
const archive = (ctx?.$archive || ctx.parent.$archive) | ||
if (input in archive.mspfa) { | ||
return input | ||
} else { | ||
// Resolve numerical ID | ||
const query = Object.entries(archive.mspfa).filter(t => t[1].i == input) | ||
if (query.length > 0) { | ||
// If you have the same adventure installed twice, we're picking one. Sorry! | ||
return query[0][0] | ||
} else { | ||
throw Error(`MSPFA with id ${input} not loaded!`) | ||
} | ||
} | ||
} | ||
export default { | ||
name: 'MSPFADisambig', | ||
props: [ | ||
'tab', 'routeParams' | ||
], | ||
components: { | ||
MSPFALog, MSPFAPage, MSPFAIndex | ||
}, | ||
theme: () => "mspfa", | ||
title: function(ctx) { | ||
if (!ctx.routeParams.story) | ||
return 'MSPFA' | ||
else { | ||
const story_id = resolveStory(ctx, ctx.routeParams.story) | ||
const comic = ctx.$archive.mspfa[story_id].n | ||
if (ctx.routeParams.p == 'log') { | ||
return `Adventure Log - ${comic}` | ||
} else { | ||
const command = ctx.$archive.mspfa[story_id].p[Number(ctx.routeParams.p - 1)].c | ||
return command ? `${command} - ${comic}` : comic | ||
} | ||
} | ||
}, | ||
functional: true, | ||
render: function (h, ctx) { | ||
const options = ctx // pass through everything | ||
// some special changes here | ||
options['class'] = ctx.data.class | ||
options['ref'] = ctx.data.ref | ||
// compute props globally, yolo | ||
if (ctx.props.routeParams.story) { | ||
options.props['storyId'] = resolveStory(ctx, ctx.props.routeParams.story) | ||
options.props['pageNum'] = Number(ctx.props.routeParams.p) | ||
} | ||
// these will be invalid values sometimes but only on pages that don't use them | ||
// { | ||
// props: { | ||
// tab: ctx.props.tab | ||
// }, | ||
// data: { | ||
// ref: ctx.data.ref, | ||
// }, | ||
// class: ctx.data.class, | ||
// ref: ctx.data.ref | ||
// } | ||
if (!ctx.props.routeParams.story) | ||
return h(MSPFAIndex, options) | ||
else if (ctx.props.routeParams.p == 'log') { | ||
return h(MSPFALog, options) | ||
} else if (ctx.props.routeParams.p && ctx.props.routeParams.story) { | ||
return h(MSPFAPage, options) | ||
} else return h("pre", { | ||
text: ctx.props.routeParams | ||
}) | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<template> | ||
<GenericPage> | ||
<h2 class="pageTitle">MS Paint Fan Adventures</h2> | ||
<div class="adventureLinks"> | ||
<div class="adventure" v-for="advlink in mspfaLinks" :key="advlink.href"> | ||
<a :href="advlink.href" class="icon"> | ||
<MediaEmbed :url="advlink.img" /> | ||
<span v-text="advlink.label" /> | ||
<span class="date">{{ datestr(advlink) }}</span> | ||
<span class="date">{{ advlink.pageCount }} pages</span> | ||
</a> | ||
</div> | ||
</div> | ||
</GenericPage> | ||
</template> | ||
|
||
<script> | ||
import MediaEmbed from '@/components/UIElements/MediaEmbed.vue' | ||
import GenericPage from '@/components/UIElements/GenericPage.vue' | ||
const DateTime = require('luxon').DateTime | ||
export default { | ||
name: 'MSPFALog', | ||
props: [ | ||
], | ||
components: { | ||
GenericPage, MediaEmbed | ||
}, | ||
data: function() { | ||
return { } | ||
}, | ||
computed: { | ||
mspfaLinks(){ | ||
return (Object.keys(this.$archive.mspfa) || []).map(k => { | ||
const story = this.$archive.mspfa[k] | ||
return { | ||
href: `/mspfa/${k}/`, | ||
img: story.o || "assets://images/mspalogo_mspa.png", | ||
label: story.n, | ||
startDate: DateTime.fromMillis(story.d).setZone("America/New_York"), | ||
updatedDate: DateTime.fromMillis(story.u).setZone("America/New_York"), | ||
status: ['Inactive', 'Ongoing', 'Complete'][story.h-1], | ||
pageCount: story.p.length | ||
} | ||
}) | ||
} | ||
}, | ||
methods: { | ||
datestr(advlink){ | ||
const start_str = advlink.startDate.toFormat('LLL yyyy') | ||
const updated_str = (advlink.status == 'Ongoing') ? '' : advlink.updatedDate.toFormat('LLL yyyy') | ||
if (start_str == updated_str) { | ||
return start_str | ||
} else { | ||
return `${start_str} - ${updated_str}` | ||
} | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
a.icon { | ||
text-align: center; | ||
text-decoration: none; | ||
> span { | ||
display: block; | ||
text-decoration: underline; | ||
} | ||
.date { | ||
padding-top: 5px; | ||
font-family: Verdana, Arial, Helvetica, sans-serif; | ||
font-weight: normal; | ||
color: var(--page-nav-meta); | ||
font-size: 12px; | ||
text-decoration: none; | ||
} | ||
} | ||
h2.pageTitle { | ||
max-width: 590px; | ||
text-align: center; | ||
line-height: 1.1; | ||
font-size: 32px; | ||
padding: 15px 0; | ||
margin: 0 auto; | ||
} | ||
.adventureLinks { | ||
display: flex; | ||
flex-flow: row wrap; | ||
justify-content: space-around; | ||
margin: 0 auto; | ||
width: 600px; | ||
.adventure { | ||
margin-bottom: 20px; | ||
text-align: center; | ||
line-height: 1.1; | ||
font-size: 18px; | ||
width: 200px; | ||
img { | ||
object-fit: contain; | ||
width: 164px; | ||
height: 164px; | ||
display: inline-block; | ||
} | ||
} | ||
} | ||
</style> | ||
|
Oops, something went wrong.