Added Lists page

This commit is contained in:
Jim Shepich III 2022-01-27 04:06:06 -05:00
parent e926d2e300
commit 25d65857a5
13 changed files with 229 additions and 91 deletions

104
data/lists.json Normal file
View File

@ -0,0 +1,104 @@
{
"master":{
"title":"Master List",
"description":"A lot of the things I want to convey on this website (my likes, my dislikes, useful links, helpful tips, etc.) can be sorted into lists. So, I thought that it would be a good idea to make a page of all my lists instead of having all this information scattered across a bunch of different articles. I was inspired in large part by a book I saw called Listography: Your Life in Lists, which is a journal with a bunch of prompts for making lists of things about yourself."
},
"quotes":{
"title":"My Favorite Quotes",
"description":"This list contains quotes that I think about a lot.",
"list":[
{
"quote":"You're not going crazy. You're going sane in a crazy world!",
"quotee":"The Tick (Ben Edlund)",
"source":"The Tick vs. The Idea Men"
},
{
"quote":"Disrespect is a two-way street.",
"quotee":"Henry Rollins",
"source":"Get in the Van: On the Road with Black Flag"
},
{
"quote":"No man has the right to be an amateur in the matter of physical training. It is a shame for a man to grow old without seeing the beauty and strength of which his body is capable.",
"quotee":"Socrates",
"translated":true
},
{
"quote":"A fascist worked out today. Did you?"
},
{
"quote":"To progress again, man must remake himself. And he cannot remake himself without suffering. For he is both the marble and the sculptor. In order to uncover his true visage he must shatter his own substance with heavy blows of his hammer.",
"quotee":"Alexis Carrel",
"source":"Man, The Unknown",
"translated":true
},
{
"quote":"To train the mind, first train the body.",
"quotee":"Izumi Curtis (Hiromu Arakawa)",
"source":"Fullmetal Alchemist",
"translated":true
},
{
"title":"Bene Gesserit Litany Against Fear",
"quote":"I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has gone past, I will turn the inner eye to see its path. Where the fear has gone there will be nothing. Only I will remain.",
"quotee":"Frank Herbert",
"source":"Dune"
},
{
"quote":"It's not a bug, it's a feature."
},
{
"quote":"...do these things happen to other people or am I just the chosen one? I decided it was the latter...",
"quotee":"Charles Bukowski",
"source":"the freeway life"
},
{
"quote":"There are two possible outcomes: if the result confirms the hypothesis, then you've made a measurement. If the result is contrary to the hypothesis, then you've made a discovery",
"quotee":"Enrico Fermi"
},
{
"quote":"No gods, no masters"
},
{
"quote":"One must imagine Sisyphus happy.",
"quotee":"Albert Camus",
"source":"The Myth of Sisyphus",
"translated":true
},
{
"quote":"It is important to draw wisdom from many different places. If we take it from only one place, it becomes rigid and stale. Understanding others, the other elements, and the other nations will help you become whole.",
"quotee":"Uncle Iroh",
"source":"Avatar: the Last Airbender"
},
{
"quote":"It is better to be a warrior in a garden than a gardener in a war."
},
{
"quote":"Sucking at something is the first step towards being sorta good at someething.",
"quotee":"Jake the Dog",
"source":"Adventure Time"
},
{
"quote":"You know, I mean, like, Old-Lady Science, you know? She's a real — You got to hang on tight, you know? Because she — she — she bucks pretty hard.",
"quotee":"Morty Smith (Justin Roiland)",
"source":"Rick & Morty"
},
{
"quote":"Through even our darkest days, we must never cease creating. Each new invention brings value to the world, be it beauty, utility, or both.",
"quotee":"Rashmi, Aether-Seer",
"source":"Magic: the Gathering",
"card":"Ornithopter of Paradise"
},
{
"quote":"What senses do we lack that we cannot see or hear another world all around us?",
"quotee":"Frank Herbert",
"source":"Dune"
}
]
},
"words":{
"title":"Words I Like",
"description":"This list contains a bunch of words I like. Some of them I like because of how they sound, some of them I like because of what they mean, and some of them I like because of what I associate with them.",
"list":["guppy","wrought","confectionery","immaculate","phantasmal","imperious","chevalier","glisten","hasami","genuflect","spectre","delineate","confluence","libation","Pythonic"]
}
}

View File

@ -23,7 +23,14 @@
"epics" : { "epics" : {
"name" : "Epics & Emprises", "name" : "Epics & Emprises",
"query_value" : "epics", "query_value" : "epics",
"link" : "https://shepich.com/epics", "link" : "https://epics.shepich.com",
"index" : -1 "index" : -1
},
"lists" : {
"name" : "Lists",
"query_value" : "lists",
"file" : "lists.html",
"index" : 2
} }
} }

View File

@ -1,84 +0,0 @@
[
{
"quote":"You're not going crazy. You're going sane in a crazy world!",
"quotee":"The Tick (Ben Edlund)",
"source":"The Tick vs. The Idea Men"
},
{
"qutoe":"Disrespect is a two-way street.",
"quotee":"Henry Rollins",
"source":"Get in the Van: On the Road with Black Flag"
},
{
"quote":"No man has the right to be an amateur in the matter of physical training. It is a shame for a man to grow old without seeing the beauty and strength of which his body is capable.",
"quotee":"Socrates",
"translated":true
},
{
"quote":"A fascist worked out today. Did you?"
},
{
"quote":"To progress again, man must remake himself. And he cannot remake himself without suffering. For he is both the marble and the sculptor. In order to uncover his true visage he must shatter his own substance with heavy blows of his hammer.",
"quotee":"Alexis Carrel",
"source":"Man, The Unknown",
"translated":true
},
{
"quote":"To train the mind, first train the body.",
"quotee":"Izumi Curtis (Hiromu Arakawa)",
"source":"Fullmetal Alchemist",
"translated":true
},
{
"title":"Bene Gesserit Litany Against Fear",
"quote":"I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has gone past, I will turn the inner eye to see its path. Where the fear has gone there will be nothing. Only I will remain.",
"quotee":"Frank Herbert",
"source":"Dune"
},
{
"quote":"It's not a bug, it's a feature."
},
{
"quote":"...do these things happen to other people or am I just the chosen one? I decided it was the latter...",
"quotee":"Charles Bukowski",
"source":"the freeway life"
},
{
"quote":"There are two possible outcomes: if the result confirms the hypothesis, then you've made a measurement. If the result is contrary to the hypothesis, then you've made a discovery",
"quotee":"Enrico Fermi"
},
{
"quote":"No gods, no masters"
},
{
"quote":"One must imagine Sisyphus happy.",
"quotee":"Albert Camus",
"source":"The Myth of Sisyphus",
"translated":true
},
{
"quote":"It is important to draw wisdom from many different places. If we take it from only one place, it becomes rigid and stale. Understanding others, the other elements, and the other nations will help you become whole.",
"quotee":"Uncle Iroh",
"source":"Avatar: the Last Airbender"
},
{
"quote":"It is better to be a warrior in a garden than a gardener in a war."
},
{
"quote":"Sucking at something is the first step towards being sorta good at someething.",
"quotee":"Jake the Dog",
"source":"Adventure Time"
},
{
"quote":"You know, I mean, like, Old-Lady Science, you know? She's a real — You got to hang on tight, you know? Because she — she — she bucks pretty hard.",
"quotee":"Morty Smith (Justin Roiland)",
"source":"Rick & Morty"
},
{
"quote":"Through even our darkest days, we must never cease creating. Each new invention brings value to the world, be it beauty, utility, or both.",
"quotee":"Rashmi, Aether-Seer",
"source":"Magic: the Gathering",
"card":"Ornithopter of Paradise"
}
]

View File

@ -3,9 +3,9 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<head> <head>
<script src="scripts/jquery-3.6.0.min.js"></script> <script src="scripts/vendor/jquery-3.6.0.min.js"></script>
<script src="scripts/vendor/loadfile.js"></script>
<script src="https://kit.fontawesome.com/09beb7ae4a.js" crossorigin="anonymous"></script> <script src="https://kit.fontawesome.com/09beb7ae4a.js" crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="styles/reset.css"> <link rel="stylesheet" type="text/css" href="styles/reset.css">
<link rel="stylesheet" type="text/css" href="styles/common.css"> <link rel="stylesheet" type="text/css" href="styles/common.css">
<link rel="stylesheet" type="text/css" href="styles/layout.css"> <link rel="stylesheet" type="text/css" href="styles/layout.css">
@ -26,7 +26,7 @@
<main> <main>
<?php <?php
//echo "<iframe id='content' src='pages/".$page->file."'></iframe>"; //echo "<iframe id='content' src='pages/".$page->file."'></iframe>";
echo file_get_contents(__DIR__ ."/pages/".$page->file) echo file_get_contents(__DIR__ ."/pages/".$page->file);
?> ?>
</main> </main>
<footer> <footer>

9
pages/lists.html Normal file
View File

@ -0,0 +1,9 @@
<!--<details></details>-->
<article id="lists">
<h1 id="list-title">Master List</h1>
<hr />
<p id="list-description"></p>
<br />
<span id="list-container"></span>
<script src="scripts/lists.js"></script>
</article>

View File

@ -7,5 +7,5 @@
echo "<a href='" . $s->link . "'><span class='fab fa-" . $s->icon . "' title='".$s->platform."'></span></a>&nbsp;&nbsp;&nbsp;"; echo "<a href='" . $s->link . "'><span class='fab fa-" . $s->icon . "' title='".$s->platform."'></span></a>&nbsp;&nbsp;&nbsp;";
} }
echo "<br /><span class='copyright'>Copyright &copy;".date("Y")." Jim Shepich</span>"; echo "<br /><span class='copyright'>Copyright &copy; 2021-".date("Y")." Jim Shepich</span>";
?> ?>

65
scripts/lists.js Normal file
View File

@ -0,0 +1,65 @@
var lists = JSON.parse(loadFile("data/lists.json"));
//Load list data from lists.json file using vendor loadfile.js.
var list_id = $("#query-list")[0].innerText;
//Get list id from <var> tag created in query-handler.php.
var list = null;
if(lists.hasOwnProperty(list_id)){
list = lists[list_id];
} else {
list = lists["master"];
//If the list id in the query is invalid, go back to the main list.
}
$("#list-title")[0].innerText = list.title;
if(list.hasOwnProperty("description")){
$("#list-description")[0].innerText = list.description;
}
if(list.hasOwnProperty("ordered") && list.ordered){
$("#list-container")[0].innerHTML += "<ol id='list'></ol>";
//Create an ordered list of the list has attribute "ordered":true.
} else {
$("#list-container")[0].innerHTML += "<ul id='list'></ul>";
//By default, lists are unordered.
}
$("#lists")[0].innerHTML += "<br /><a id='list-return-link' href='index.php?page=lists&list=master'>Return to Master List &#11148;</a>";
//Add a return link to the bottom of the article.
switch(list_id){
case "master":
for(id in lists){
var item = `<li><a href='index.php?page=lists&list=${id}'>${lists[id].title}</a></li>`;
$("#list")[0].innerHTML += item;
//The Master List contains a link to every other list in the JSON file.
}
$("#list-return-link")[0].style.display="none";
//"Return to Master List" link is not needed on Master List itself.
break;
case "quotes":
for(quote of list.list){
var item = "<p>";
if(quote.hasOwnProperty("title")){
item += `<b>${quote.title}</b><br />`;
//Add a title if the quote has one (e.g. "The Litany Against Fear").
}
item += `"${quote.quote}"<br>`;
//Add the text of the quote.
item += `&nbsp;&mdash; ${quote.hasOwnProperty("quotee") ? quote.quotee : "Unknown"}`;
//Add the quotee's name, or "Unknown" if one is not specified.
if(quote.hasOwnProperty("source")){
item += `, ${quote.source}`;
//Add the source if the quote has one.
}
item += "</p><hr />";
//Delimit the quotes with a horizontal rule.
$("#list")[0].innerHTML += item;
}
break;
default:
for(item of list.list){
$("#list")[0].innerHTML += `<li>${item}</li>`;
}
}

View File

@ -2,5 +2,8 @@
$pages = json_decode(file_get_contents(__DIR__ ."/../data/pages.json")); $pages = json_decode(file_get_contents(__DIR__ ."/../data/pages.json"));
$query_page = (isset($_REQUEST['page']) && !empty($_REQUEST['page'])) ? $_GET['page'] : "home"; $query_page = (isset($_REQUEST['page']) && !empty($_REQUEST['page'])) ? $_GET['page'] : "home";
$page = (isset($pages->$query_page)) ? $pages->$query_page : $pages->{404}; $page = (isset($pages->$query_page)) ? $pages->$query_page : $pages->{404};
echo "<span style='display:none;' class='var' name='query_page'>".$query_page."</span>" echo "<var id='query-page'>".$query_page."</var>";
$list = (isset($_REQUEST['list']) && !empty($_REQUEST['list'])) ? $_GET['list'] : "master";
echo "<var id='query-list'>".$list."</var>";
?> ?>

26
scripts/vendor/loadfile.js vendored Normal file
View File

@ -0,0 +1,26 @@
// Synchronously read a text file from the web server with Ajax
//
// The filePath is relative to the web page folder.
// Example: myStuff = loadFile("Chuuk_data.txt");
//
// You can also pass a full URL, like http://sealevel.info/Chuuk1_data.json, but there
// might be Access-Control-Allow-Origin issues. I found it works okay in Firefox, Edge,
// or Opera, and works in IE 11 if the server is configured properly, but in Chrome it only
// works if the domains exactly match (and note that "xyz.com" & "www.xyz.com" don't match).
// Otherwise Chrome reports an error:
//
// No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://sealevel.info' is therefore not allowed access.
//
// That happens even when "Access-Control-Allow-Origin *" is configured in .htaccess,
// and even though I verified the headers returned (you can use a header-checker site like
// http://www.webconfs.com/http-header-check.php to check it). I think it's a Chrome bug.
function loadFile(filePath) {
var result = null;
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", filePath, false);
xmlhttp.send();
if (xmlhttp.status==200) {
result = xmlhttp.responseText;
}
return result;
}

View File

@ -65,3 +65,7 @@
font-family: Floral; font-family: Floral;
src: url('fonts/FloralCapitals.ttf'); src: url('fonts/FloralCapitals.ttf');
} }
var{
display:none;
}

View File

@ -100,3 +100,7 @@ main{
display:inline-block; display:inline-block;
text-align:center; text-align:center;
} }
ol, ul {
padding-left:2rem;
}

View File

@ -32,7 +32,7 @@ body {
line-height: 1; line-height: 1;
} }
ol, ul { ol, ul {
list-style: none; list-style: disc;
} }
blockquote, q { blockquote, q {
quotes: none; quotes: none;