This commit is contained in:
MeowcaTheoRange 2023-01-05 14:58:03 -06:00
parent 3fd3805552
commit 1b9904aa02
23 changed files with 228 additions and 202 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 953 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 429 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 798 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 MiB

View file

@ -1,17 +1,4 @@
html {
--main: #35FF00;
--main-fg: #0D4F00;
--secondary: #2ACC00;
--general-bg: #4F4F4F;
--general-fg: #808080;
--bg-transparency: #4F4F4F80;
--background-image: url(/assets/goo.png);
--page-bg: #000000AA;
--page-fg: #D8FFCC;
--tag-fg: #FFFFFF;
}
html.Meta {
--main: #cccccc;
--main-fg: #202020;
--secondary: #808080;
@ -22,17 +9,8 @@ html.Meta {
--page-bg: #000000AA;
--page-fg: #ffffff;
--tag-fg: #FFFFFF;
}
html.MikeyLore {
--main: #0080ff;
--main-fg: #002040;
--secondary: #004080;
--general-bg: #4F4F4F;
--general-fg: #808080;
--bg-transparency: #4F4F4F80;
--background-image: none;
--page-bg: #000000AA;
--page-fg: #ccddff;
--tag-fg: #FFFFFF;
--font-families: "Lato", sans-serif;
--title-font-families: "Montserrat", sans-serif;
--tag-font-families: monospace;
--title-font-weights: 800;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 658 KiB

View file

@ -3,7 +3,7 @@ body, html {
min-height: 100vh;
margin: 0;
padding: 0;
font-family: "JetBrains Mono", monospace;
font-family: var(--font-families);
overflow: hidden;
font-size: 18px;
}
@ -16,6 +16,7 @@ body {
#header {
background-color: var(--main);
color: var(--main-fg);
font-family: var(--title-font-families);
font-weight: bold;
width: 100%;
display: flex;
@ -31,9 +32,9 @@ body {
color: var(--main-fg);
font-weight: bold;
border: none;
font-family: "JetBrains Mono", monospace;
font-size: 18px;
height: 32px;
font-size: 24px;
line-height: 32px;
cursor: pointer;
}
@ -74,6 +75,7 @@ body {
#sbheader, #inheader {
background-color: var(--main);
font-family: var(--title-font-families);
height: 48px;
display: flex;
flex-direction: row;
@ -134,6 +136,7 @@ body {
color: var(--page-fg);
font-weight: bold;
height: 48px;
font-family: var(--title-font-families);
}
.fullwidthlink .linkname {
@ -163,7 +166,7 @@ body {
color: var(--tag-fg);
font-size: 18px;
padding: 0;
font-family: "JetBrains Mono", monospace;
font-family: var(--tag-font-families);
user-select: none;
cursor: pointer;
}
@ -181,7 +184,7 @@ body {
height: 32px;
padding: 8px;
box-sizing: border-box;
font-family: "JetBrains Mono", monospace;
font-family: var(--font-families);
font-size: 18px;
border: 2px var(--general-fg) solid;
background-color: var(--general-bg);
@ -206,7 +209,7 @@ body {
white-space: nowrap;
overflow: hidden;
box-sizing: border-box;
font-family: "JetBrains Mono", monospace;
font-family: var(--font-families);
font-size: 18px;
border: 2px var(--general-fg) solid;
background-color: var(--general-bg);
@ -222,7 +225,6 @@ body {
overflow: hidden;
padding: 0;
box-sizing: border-box;
font-family: "JetBrains Mono", monospace;
font-size: 18px;
border-radius: 0 8px 8px 0;
color: var(--general-bg);
@ -254,12 +256,11 @@ body {
#sidebar {
position:relative;
left: 0;
}
#sidebar[data-okanimate] {
transition: left 0.25s, width 0.25s;
}
#sidebar .overinput {
transition: left 0.25s, width 0.25s;
}
#body {
#body[data-okanimate] {
transition: grid-template-columns 0.25s;
}
@ -282,10 +283,10 @@ body {
grid-template-columns: 0px auto;
}
#body.sidebarOpen {
#body[data-sidebar-open="true"] {
grid-template-columns: 300px auto;
}
#body.sidebarOpen #sidebar {
#body[data-sidebar-open="true"] #sidebar {
position:relative;
left: 0;
}
@ -301,7 +302,6 @@ body {
}
#sidebar {
left: -800px !important;
width: 100vw !important;
}
@ -309,19 +309,11 @@ body {
width: calc(100vw - 46px) !important;
}
#body {
#body[data-sidebar-open="true"] {
grid-template-columns: 0px auto;
}
#body.sidebarOpen {
grid-template-columns: 0px auto;
}
#sidebar, #sidebar .overinput {
transition: left 0.25s, width 0s !important;
}
#body.sidebarOpen #sidebar {
#body[data-sidebar-open="true"] #sidebar {
left: 0 !important;
}
}

View file

@ -3,6 +3,7 @@
border-bottom: 2px solid var(--main);
color: var(--main);
font-size: 32px;
font-family: var(--title-font-families);
margin: 16px 0;
}
#page h2 {
@ -12,6 +13,7 @@
width: 100%;
color: var(--main);
font-size: 24px;
font-family: var(--title-font-families);
margin: 16px 0;
}
#page p {
@ -26,4 +28,9 @@
}
#page a {
color: var(--main);
}
#page code {
background-color: var(--general-bg);
padding: 2px;
border-radius: 4px;
}

View file

@ -2,15 +2,15 @@ var page = document.getElementById("page");
var search = document.getElementById("searchbar");
var overinput = document.querySelector(".overinput");
var clearinput = document.querySelector(".clearinput");
var bodyele = document.getElementById("body");
var searchNodes = [...document.getElementById("searchNodes").children];
var searchNodesCont = document.getElementById("searchNodes");
var sbheader = document.getElementById("sbheader");
search.addEventListener('input', onsearch);
function onsearch () {
search.value = search.value.replace(/Redirects to /i, "|=> " );
search.value = search.value.replace(/Redirects /i, "|=> ");
search.value = search.value.replace(/^Redirects to /i, ">> " );
search.value = search.value.replace(/^Redirects /i, ">> ");
search.value = search.value.replace(/^\>\> to /i, ">> " );
if (sessionStorage.getItem("searchvalue") === "()" && search.value === ")")
search.value = "";
if (sessionStorage.getItem("searchvalue") === "()" && search.value === "(")
@ -30,10 +30,10 @@ function onsearch () {
searchNodes.forEach(child => child.style.display = "")
}
var value = search.value.replace(/>/g, "&gt;").replace(/</g, "&lt;");
if (search.value.startsWith("|=>")) {
var value = search.value.replace(/>/g, "&gt;").replace(/</g, "&lt;").replace(/\\/g, "");
if (search.value.startsWith(">>")) {
overinput.style.display = "inline-block";
overinput.innerHTML = "Redirects " + (search.value.length > 4 && search.value !== "|=> " ? search.value.replace(/^\|\=\>/, "to ") : "");
overinput.innerHTML = "Redirects " + (search.value.length > 3 && search.value !== ">> " ? search.value.replace(/^\>\>/, "to ") : "");
searchNodes.forEach(child => {
child.style.display = "none";
var name = child.querySelector(".linkname");
@ -66,29 +66,8 @@ function onsearch () {
sessionStorage.setItem("searchvalue", search.value);
};
function toggleSidebar() {
document.querySelector('#body').classList.toggle('sidebarOpen');
sessionStorage.setItem("sidebar", document.querySelector("#body").className);
}
function opensearch(sq) {
search.value = sq;
onsearch();
document.querySelector('#body').classList.add('sidebarOpen');
sessionStorage.setItem("sidebar", document.querySelector("#body").className);
}
if (window.innerWidth > 800) {
document.querySelector("#body").className = sessionStorage.getItem("sidebar");
}
search.value = sessionStorage.getItem("searchvalue");
onsearch();
overinput.addEventListener("click", () => {
search.focus();
})
clearinput.addEventListener("click", () => {
search.value = "";
onsearch();
})
search.addEventListener('input', onsearch);
overinput.addEventListener("click", () => {search.focus();});
clearinput.addEventListener("click", () => {search.value = "";onsearch();});
onsearch();

23
assets/system/sidebar.js Normal file
View file

@ -0,0 +1,23 @@
var bodyele = document.getElementById("body");
var sidebarele = document.getElementById("sidebar");
function toggleSidebar(override) {
bodyele.dataset.sidebarOpen = override ?? (bodyele.dataset.sidebarOpen == "false");
sessionStorage.setItem("sidebar", bodyele.dataset.sidebarOpen);
}
function opensearch(sq) {
search.value = sq;
onsearch();
toggleSidebar(true);
}
if (window.innerWidth > 800) {
bodyele.dataset.sidebarOpen = sessionStorage.getItem("sidebar") == "true";
} else {
bodyele.dataset.sidebarOpen = true;
setTimeout(() => {
bodyele.dataset.sidebarOpen = false;
}, 1)
}
setTimeout(() => {
sidebarele.dataset.okanimate = true;
bodyele.dataset.okanimate = true;
}, 1)

View file

@ -6,34 +6,51 @@ var app = express();
app.set('view engine', 'ejs');
app.use("/a", express.static(path.join(__dirname, 'assets')));
app.use("/assets", express.static(path.join(__dirname, 'assets', "Files")));
var templateIndex = (x, y) => ({"type": "page","pageName": x,"pageData": y,"allPages": pages});
var templateErrPage = (sc) => ({"tags": ["Meta",sc],"location": "system/" + sc});
var templateTag = (x, y) => ({"shortname": x,"color": y});
var pages;
var getPages = () => {
var __pg = JSON.parse(fs.readFileSync(path.join(__dirname, "views", "pages.json"), 'utf8'));
__pg.tags["Meta"] = templateTag("//","#808080");
__pg.tags["404"] = templateTag("404","#008000");
__pg.tags["500"] = templateTag("500","#FF0080");
__pg.wikiData.fullName = __pg.wikiData.name.join(" ");
pages = __pg;
}
setInterval(getPages, 10000);
getPages();
var getPages = () => JSON.parse(fs.readFileSync(path.join(__dirname, "views", "pages.json"), 'utf8'));
var getPage = (page) => {
var pageindexes = getPages();
console.log(pageindexes.pages, page, pageindexes.pages[page]);
if (pageindexes.pages[page].link.redirect)
return getPage(pageindexes.pages[page].link.location);
return {
name: page,
page: pageindexes.pages[page],
all: pageindexes
if (!(pages.pages[page] || pages.redirects[page])) return {
type: "invaildrequest"
};
if (pages.redirects[page]) return {
type: "redirect",
page: pages.redirects[page]
};
return templateIndex(page, pages.pages[page]);
}
app.get('/', (_,r) => r.redirect("/wiki/Welcome"));
app.get('/wiki', (_,r) => r.redirect("/wiki/Welcome"));
app.get('/wiki/:page', function(req, res, next) {
try {
if (!getPages().pages[req.params.page]) next();
var page = getPage(req.params.page);
res.render('index', page);
} catch (error) {
next(error);
var page = getPage(req.params.page);
switch (page.type) {
case "invaildrequest":
next();
break;
case "redirect":
res.redirect(page.page);
break;
case "page":
res.render('index', page, (err, html) => {
if (err) res.status(500).render('index', templateIndex("500_Internal_Server_Error", templateErrPage("500")));
else res.send(html);
});
}
});
app.use(function(req,res){
res.status(404).render('index', getPage("404_Not_Found"));
});
app.listen(8080, () => {
console.log('Server is listening on port 8080');
});
app.use((_,r) => r.status(404).render('index', templateIndex("404_Not_Found", templateErrPage("404"))));
app.listen(80, () => console.log('http://127.0.0.1:80/'));

View file

@ -0,0 +1,16 @@
<p>Welcome to the AWE installation guide!</p>
<p>This guide will assist you while installing the Avalon Wiki Engine on a local server.</p>
<p>Make sure you have your 80 port open on this server.</p>
<%- include("blocks/MessageBox.ejs", {
title: "Docker support",
content: "This guide will not contain resources for installing AWE on Docker. You are purely on your own for that."
}) %>
<h1>Installing locally or on a Node server</h1>
<p>If you just want AWE for your local network, or on your own real server.</p>
<h1>Installing on Replit</h1>
<p>If you want quickly get AWE up and running.</p>
<%- include("blocks/MessageBox.ejs", {
title: "Cycles required",
content: "In order to use AWE on Replit, you will have to use Cycles to make your AWE Repl Always On.",
notice: "2 cycles/day for Always On"
}) %>

View file

@ -1,24 +0,0 @@
<%- include("blocks/MessageBox.ejs", {
title: "Hello, world!",
content: "Sex is real and it's a danger to society",
notice: "This is a small notice."
}) %>
<%- include("blocks/MessageBox.ejs") %>
<h1>Header 1</h1>
<p>This is a paragraph. Hello!</p>
<h2>Header 2</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deleniti cumque aut, natus labore id voluptate quaerat hic enim tempore est sed sunt, sint praesentium culpa illum, ea autem modi! Expedita!</p>
<h3>Header 3</h3>
<small>Psssst! I'm small!</small>
<%- include("blocks/LunchBox.ejs", {
width: "200",
imageURL: "/assets/ramin1.png",
fullName: "Ramin",
pronouns: "she/her, they/them",
birthday: "April 13, 2026",
gender: "Female",
preference: "Pansexual",
attribution: "Avalonian Vineyards",
description: `Ramin is a FUCK.`
}) %>
<%- include("blocks/LunchBox.ejs") %>

View file

@ -0,0 +1,35 @@
<p>Searching in the Avalon Wiki Engine is possible.</p>
<p>Use the searchbar element on the top-left to type text in and look for articles using a filter.</p>
<h1>Search methods</h1>
<h2>Searching by name</h2>
<p>This is the default behaviour, typing in a name, and getting your result.</p>
<p>Simply type <code>QUERY</code> (replace "QUERY" with your desired search) into the searchbar.</p>
<h2>Searching by tag</h2>
<p>Searching for articles using their tag is also very easy.</p>
<p>Simply wrap your tag name search in parentheses, like this: <code>(QUERY)</code></p>
<p>There are two ways to search for a tag name:</p>
<ul>
<li>Short name (e.g. <code>//</code> for Meta)</li>
<li>Full name (found by hovering over tag)</li>
</ul>
<h2>Searching for redirects</h2>
<p>Searching for redirects is enabled by default when searching, but there's another mode where you can search for redirects only.</p>
<p>Make your search a &gt;&gt;, like this: <code>&gt;&gt;</code></p>
<p>Use two greater than symbols (>) to write the entire thing.</p>
<p>If you want to search for redirects that lead to a specific page, you can type <code>&gt;&gt; QUERY</code>, adding an article page (not tag) at the very end.</p>
<h1>Shortcuts (Longcuts?)</h1>
<h2>Tagged</h2>
<code>Tagged QUERY</code>
<code>(QUERY</code>
<h2>Redirects</h2>
<code>Redirects QUERY</code>
<code>Redirects to QUERY</code>
<code>&gt;&gt; to QUERY</code>
<h2>Preventing shortcut corrections</h2>
<p>Preventing corrections is easy, simply put a <code>\</code> anywhere within your query to cancel a redirect.</p>
<p>For example, if the article you want to look for is called "Redirects and Tags", the <code>Redirects QUERY</code> shortcut would not let you type <code>Redirects </code>.</code></p>
<p>So, you can simply cancel the shortcut by placing a <code>\</code> anywhere it would block a shortcut - usally at the start or in the middle of the word.</p>
<code>\Redirects </code>
<code>\(</code>
<code>\Redirects to</code>
<code>\Tagged</code>

View file

@ -1,10 +1,11 @@
<%- include("blocks/MessageBox.ejs", {
title: "Welcome!",
content: "Welcome to the Avalonian Districts Wiki!"
content: "Welcome to the " + allPages.wikiData.fullName + " development resource!"
}) %>
<h1>Avalonian Districts Wiki</h1>
<p>This wiki is dedicated to making a public resource of all <a href="#" onclick="opensearch('(MikeyLore)')">MikeyLore</a> and <a href="#" onclick="opensearch('(Avalonian_Vineyards)')">Avalonian Vineyards</a> content.</p>
<h1><%- allPages.wikiData.fullName %></h1>
<p>The Avalon Wiki Engine (also known as AWE) is a free and open-source piece of software, that lets site administrators manage content in a simple format.</p>
<h2>About</h2>
<p>The wiki is run by <a href="https://twitter.com/Dizzy_Miles_">MikeyHX</a> and <a href="https://twitter.com/RaminDetergent">RaminDetergent</a>, and so is the lore. We are the admins of this page, and unlike normal wikis, this wiki is only editable through the source code. Feel free to look through it, I guess?</p>
<h1>The Avalon Wiki Engine</h1>
<p>Shortcuts for the Avalon Wiki Engine can be found here.</p>
<p>The Avalon Wiki Engine is a bit tacky, but it functions well, allowing end users to easily navigate content, with fancy tricks like searching - by name or by tags.</p>
<p>Formatting is based on individual EJS files - see <a href="https://ejs.co">ejs.co</a> for more info on EJS templating.</p>
<h2>Installation and Source</h2>
<p>An installation guide can be found at <a href="/wiki/Installation">Installation</a>.</p>

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html class="<%- page.tags.join(' ') %>">
<html class="<%- pageData.tags.join(' ') %>">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
@ -10,45 +10,59 @@
<link rel="stylesheet" href="/assets/theme.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@200;400;600&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Lato&family=Montserrat:wght@800;900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,500,1,200" />
<noscript><style> .ois { display: none }</style></noscript>
</head>
<body>
<div id="header">
<button class="menubutton" onclick="toggleSidebar()">&lt;|</button>
<span class="title">Avalonian Districts <span class="hideonmobile">Wiki</span></span>
<button class="menubutton material-symbols-outlined" onclick="toggleSidebar()">toc</button>
<span class="title"><%- allPages.wikiData.name[0] %> <span class="hideonmobile"><%- allPages.wikiData.name[1] %></span></span>
</div>
<div id="body">
<div id="sidebar">
<div id="sbheader">
<input type="text" id="searchbar" placeholder="Type here to search..." />
<button class="overinput"></button>
<button class="clearinput">X</button>
<input type="text" id="searchbar" class="ois" placeholder="Type here to search..." />
<button class="overinput ois"></button>
<button class="clearinput ois material-symbols-outlined">clear</button>
</div>
<div id="searchNodes">
<% Object.entries(all.pages).forEach(function([namey, jsony]){ %>
<% if (!jsony.hidden) { %>
<%- include('system/fullwidth', {namey,jsony,tags:all.tags}); %>
<% } %>
<% Object.entries(allPages.pages).forEach(function([name, data]){ %>
<%- include('system/fullwidth', {
name,
data,
allPages,
redirect:false
}); %>
<% }); %>
<% Object.entries(allPages.redirects).forEach(function([name, data]){ %>
<%- include('system/fullwidth', {
name,
data,
allPages,
redirect:true
}); %>
<% }); %>
</div>
</div>
<div id="index">
<div id="inheader">
<span id="headertext"><%- name.replace(/_/g, " ") %></span>
<span id="headertext"><%- pageName.replace(/_/g, " ") %></span>
<div class="taglist">
<% page.tags.forEach(function(tagname){ %>
<% pageData.tags.forEach(function(tag){ %>
<%- include("system/tag", {
implcl: locals,
tagname
allPages,
tag
}) %>
<% }); %>
</div>
</div>
<div id="page">
<%- include(page.link.location); %>
<%- include(pageData.location); %>
</div>
</div>
</div>
<script src="/a/system/searchNodes.js"></script>
<script src="/a/system/sidebar.js"></script>
</body>
</html>

View file

@ -1,61 +1,45 @@
{
"wikiData": {
"name": [
"Avalon",
"Wiki Engine"
]
},
"tags": {
"404": {
"shortname": "404",
"color": "#008000"
"Accessibility": {
"shortname": "ACC",
"color": "#000080"
},
"MikeyLore": {
"shortname": "MLR",
"color": "#0080ff"
"Help": {
"shortname": "HLP",
"color": "#ff0080"
},
"Avalonian_Vineyards": {
"shortname": "AVY",
"color": "#35ff00"
},
"Avalonian_Districts": {
"shortname": "M+A",
"color": "#1BC080"
},
"Meta": {
"shortname": "//",
"color": "#808080"
"Installation_Guide": {
"shortname": "INS",
"color": "#000000"
}
},
"redirects": {
"Searchbar": "Searching"
},
"pages": {
"Welcome!": {
"Welcome": {
"tags": [
"Avalonian_Districts",
"Meta"
],
"color": "#808080",
"link": {
"redirect": false,
"location": "articles/Welcome"
}
"location": "articles/Welcome"
},
"Sandbox": {
"Searching": {
"tags": [
"Avalonian_Districts",
"Meta"
"Help"
],
"hidden": true,
"color": "#808080",
"link": {
"redirect": false,
"location": "articles/Sandbox"
}
"location": "articles/Searching"
},
"404_Not_Found": {
"Installation": {
"tags": [
"Meta",
"404"
"Help", "Installation_Guide"
],
"hidden": true,
"color": "#000000",
"link": {
"redirect": false,
"location": "articles/404"
}
"location": "articles/Installation"
}
}
}

4
views/system/500.ejs Normal file
View file

@ -0,0 +1,4 @@
There was an internal server error while rendering this article.<br />
Possibly, this article's page <b>index</b> exists, but it is redirecting to or referencing a non-existent article.<br />
<br />
If possible, please notify the wiki managers.

View file

@ -1,15 +1,15 @@
<div class="fullwidthlink <%- jsony.link.redirect ? "showsearch" : "" %>" style="background-color: <%- jsony.color ?? "var(--bg)" %>;">
<% if (!jsony.link.redirect) { %>
<div class="fullwidthlink <%- redirect ? "showsearch" : "" %>" style="background-color: <%- data.color ?? "var(--main-fg)" %>;">
<a class="linkname" href="/wiki/<%- name %>">
<%- name.replace(/_/g, " ") %> <%- redirect ? (">> " + data.replace(/_/g, " ")) : "" %>
</a>
<% if (!redirect) { %>
<div class="taglist">
<% jsony.tags.forEach(function(tagname){ %>
<% data.tags.forEach(function(tag){ %>
<%- include("tag", {
implcl: locals,
tagname
allPages,
tag
}) %>
<% }); %>
</div>
<% } %>
<a class="linkname" href="/wiki/<%- namey %>">
<%- namey.replace(/_/g, " ") %> <%- jsony.link.redirect ? ("|=> " + jsony.link.location.replace(/_/g, " ")) : "" %>
</a>
</div>

View file

@ -1,3 +1,3 @@
<button class="tagLabel" title="<%- tagname %>" onclick="opensearch('(<%- tagname %>)')" style="background-color: <%- implcl.all.tags[tagname].color %>;">
<%- implcl.all.tags[tagname].shortname %>
<button class="tagLabel" title="<%- tag %>" onclick="opensearch('(<%- tag %>)')" style="background-color: <%- allPages.tags[tag].color %>;">
<%- allPages.tags[tag].shortname %>
</button>