Skip to content

Commit

Permalink
Update, access key no longer used
Browse files Browse the repository at this point in the history
  • Loading branch information
harrymkt committed Sep 2, 2024
1 parent 6f3b7a1 commit 9c922c5
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 193 deletions.
8 changes: 8 additions & 0 deletions Source/_data/nav.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- name: "Home"
url: "/"
- name: "Projects"
url: "/projects"
- name: "Useful communities"
url: "/community"
- name: "Blog"
url: "/blog"
27 changes: 26 additions & 1 deletion Source/_includes/footer.liquid
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
</div>
<div class="beforefooter" id="footersection">
<div id="cometome">
<h1>Come to me</h1>
<p>If you want to send a message and get in touch with me, check out below.</p>
<ul>
<li><a href="https://facebook.com/harry.mk.64">Add friend / follow on Facebook</a></li>
<li><a href="https://t.me/harrymkt">Message on Telegram</a></li>
</ul>
</div>

<h1>Keep in touch with me</h1>
<p>Don't let miss anything from me!</p>
<ul>
<li><a href="https://github.com/harrymkt">My GitHub</a></li>
<li><a href="https://youtube.com/@harry_mk">Subscribe to my YouTube Channel</a></li>
<li><a href="https://t.me/harrymktg">My Telegram Channel</a></li>
</ul>

<h1>Useful links</h1>
<p><a href="/about">About me</a></p>
<p><a href="/contact">Contact me</a></p>
<p><a href="/community_policy">Community Policy</a></p>
<p><a href="/privacy">Privacy Policy</a></p>
<p><a href="/accessibility" title="Learn more about the accessibility of the site!">Accessibility</a></p>
</div>
<script>addfooter();</script>
</body>
</html>
</html>
24 changes: 23 additions & 1 deletion Source/_includes/header.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,27 @@
{% endif %}
</head>
<body>
<a href="/config">Config site</a>
<h1>Accessibility links</h1>
<a href="#mainc" class="skip-link">Skip to main content</a>
<a href="#navigation" class="skip-link">Skip to navigation</a>
<a href="#footersection" class="skip-link">Skip to footer</a>
<script>navstart();</script>
<div id="mainc">
<nav id="navigation" role="navigation" aria-label="Main menu">
<h1>Main Menu</h1>
{%assign permalink="/" | append: page.permalink%}
<ul style="list-style-type:none;">
{%if site.data.nav%}
{%for pn in site.data.nav%}
{%if pn.url== permalink%}
<li><a aria-current="page" href="{{pn.url}}">{{pn.name}}</a></li>
{%else%}
<li><a href="{{pn.url}}">{{pn.name}}</a></li>
{%endif%}
{%endfor%}
{%else%}
<p>No navigation page available.</p>
{%endif%}
</ul>
</nav>
<div id="mainc">
3 changes: 3 additions & 0 deletions Source/accessibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ I use the structure of the site clean and accessible as possible, especially wit
## Headings
You can use Headings to navigate around each section. For example, each game is listed on each Heading at my Projects page.

## Lists
You can use lists to navigate, for example, in navigation menu.

## Unability
I am unable to process the colour designs for the site, look and appearances are also included. This is because I can't see the colour, look and appearances do to the blindness.

Expand Down
2 changes: 1 addition & 1 deletion Source/community.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
layout: default.liquid
title: Community
title: Useful Community
permalink: /community
---

Expand Down
90 changes: 0 additions & 90 deletions Source/scripts/footer.js
Original file line number Diff line number Diff line change
@@ -1,96 +1,6 @@
//footer.
function addfooter()
{
var fdd = document.createElement("div");
fdd.className = "beforefooter";
fdd.id="footersection";
// "come to me" section
var ctmdiv=document.createElement("div");
ctmdiv.id="cometome";
var comeToMeHeading = document.createElement("h1");
comeToMeHeading.textContent = "Come to me";

var messageParagraph = document.createElement("p");
messageParagraph.textContent = "If you want to send a message and get in touch with me, check out below.";

var messageLinksList = document.createElement("ul");
var facebookLinkItem = createLinkListItem("https://www.facebook.com/profile.php?id=61555081142615", "Add friend / follow on Facebook");
var telegramLinkItem = createLinkListItem("https://t.me/harrymkt", "Message on Telegram");
messageLinksList.appendChild(facebookLinkItem);
messageLinksList.appendChild(telegramLinkItem);
ctmdiv.appendChild(comeToMeHeading);
ctmdiv.appendChild(messageParagraph);
ctmdiv.appendChild(messageLinksList);
fdd.appendChild(ctmdiv);
// "keep in touch with Me" section
var keepInTouchHeading = document.createElement("h1");
keepInTouchHeading.textContent = "Keep in touch with me";

var dontMissParagraph = document.createElement("p");
dontMissParagraph.textContent = "Don't let miss anything from me!";

var keepInTouchLinksList = document.createElement("ul");
var githubLinkItem = createLinkListItem("https://github.com/harrymkt", "My GitHub");
var youtubeLinkItem = createLinkListItem("https://youtube.com/@harry_mk", "Subscribe to my YouTube Channel");
var telegramChannelLinkItem = createLinkListItem("https://t.me/harrymktg", "My Telegram Channel");
keepInTouchLinksList.appendChild(githubLinkItem);
keepInTouchLinksList.appendChild(youtubeLinkItem);
keepInTouchLinksList.appendChild(telegramChannelLinkItem);

// "useful links" section
var usefulLinksHeading = document.createElement("h1");
usefulLinksHeading.textContent = "Useful links";

// Appending all elements to "fdd"
fdd.appendChild(keepInTouchHeading);
fdd.appendChild(dontMissParagraph);
fdd.appendChild(keepInTouchLinksList);
fdd.appendChild(usefulLinksHeading);

// Appending "fdd" to the body or any other target element
document.body.appendChild(fdd);

var fd=document.createElement("div");
// Create individual paragraphs with links
var aboutLink = document.createElement("p");
var contactLink = document.createElement("p");
var communityPolicyLink = document.createElement("p");
var privacyPolicyLink = document.createElement("p");

// Create anchor elements and set their attributes
var aboutAnchor = document.createElement("a");
aboutAnchor.href = "/about";
aboutAnchor.textContent = "About me";
aboutLink.appendChild(aboutAnchor);

var contactAnchor = document.createElement("a");
contactAnchor.href = "/contact";
contactAnchor.textContent = "Contact me";
contactLink.appendChild(contactAnchor);

var communityPolicyAnchor = document.createElement("a");
communityPolicyAnchor.href = "/community_policy";
communityPolicyAnchor.textContent = "Community Policy";
communityPolicyLink.appendChild(communityPolicyAnchor);

var privacyPolicyAnchor = document.createElement("a");
privacyPolicyAnchor.href = "/privacy";
privacyPolicyAnchor.textContent = "Privacy Policy";
privacyPolicyLink.appendChild(privacyPolicyAnchor);
var accpar=document.createElement("p");
var acclink=document.createElement("a");
acclink.href="/accessibility";
acclink.title="Learn more about the accessibility of the site!";
acclink.textContent="Accessibility";
accpar.appendChild(acclink);

// Append paragraphs to the existing "fd" container
fd.appendChild(aboutLink);
fd.appendChild(contactLink);
fd.appendChild(communityPolicyLink);
fd.appendChild(privacyPolicyLink);
fd.appendChild(accpar);
document.body.appendChild(fd);
// Create a footer element
var footerElement = document.createElement("footer");

Expand Down
100 changes: 0 additions & 100 deletions Source/scripts/nav.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,5 @@
function navstart()
{
var confg=document.createElement("a");
confg.href="/config";
confg.title="Configure the site as per your preferences!";
confg.textContent="Config site";
document.body.appendChild(confg);
// Create h1 element with id "accessibility"
var h1Element = document.createElement("h1");
h1Element.id = "accessibility";
h1Element.textContent = "Accessibility links";

// Create first anchor element
var skipToMainContentLink = document.createElement("a");
skipToMainContentLink.href = "#mainc";
skipToMainContentLink.className = "skip-link";
skipToMainContentLink.textContent = "Skip to main content";

// Create second anchor element
var skipToNavigationLink = document.createElement("a");
skipToNavigationLink.href = "#navigation";
skipToNavigationLink.className = "skip-link";
skipToNavigationLink.textContent = "Skip to navigation";
var skipfooterLink = document.createElement("a");
skipfooterLink.href = "#footersection";
skipfooterLink.className = "skip-link";
skipfooterLink.textContent = "Skip to footer";
// Append elements to the document body or any other target element
document.body.appendChild(h1Element);
document.body.appendChild(skipToMainContentLink);
document.body.appendChild(skipToNavigationLink);
document.body.appendChild(skipfooterLink);
// Create p element with id "fulldate"
var fulldateElement = document.createElement("p");
fulldateElement.id = "fulldate";
Expand All @@ -43,77 +13,7 @@ document.body.appendChild(fulldateElement);
document.body.appendChild(greetingsElement);
displaytime();
setInterval(displaytime, 1000);
// Create nav element with id "navigation" and ARIA attributes
var navigationElement = document.createElement("nav");
navigationElement.id = "navigation";
navigationElement.setAttribute("role", "navigation");
navigationElement.setAttribute("aria-label", "Main menu");

// Create h1 element inside the nav element
var h1Element = document.createElement("h1");
h1Element.textContent = "Main menu";

// Create dl element inside the nav element
var dlElement = document.createElement("dl");

// Append elements to the nav element
navigationElement.appendChild(h1Element);
navigationElement.appendChild(dlElement);

// Append nav element to the document body or any other target element
document.body.appendChild(navigationElement);

// Define pages array
var pages = [
{ name: "Home", url: "/", accesskey: "h" },
{ name: "Projects", url: "/projects/", accesskey: "p" },
{ name: "Useful communities", url: "/community", accesskey: "" },
{ name: "Personal blog", url: "/blog", accesskey: "b" }
];

// Get the current URL
var current_url = window.location.pathname;

// Loop through the pages array
for (var i = 0; i < pages.length; i++) {
var page = pages[i];
var class_name = "";
var link_text = page.name;
var onclick_attr = "";

// Normalize the URLs for comparison
//var currentUrlObj = new URL(current_url);
//var pageUrlObj = new URL(page.url);

// Normalize the paths for comparison (remove trailing slashes)
var currentPath = current_url.replace(/\/$/, "");
var pagePath = page.url.replace(/\/$/, "");

// Check if the hosts and normalized paths match
if (currentPath === pagePath)
{
class_name = "active";
link_text = page.name + " (current page)";
onclick_attr = "event.preventDefault();";
}

// Create a link element
var linkElement = document.createElement('a');
linkElement.href = page.url;
linkElement.className = class_name;
linkElement.onclick = function () { eval(onclick_attr); }; // Avoid using eval if possible
if (page.accesskey!==null && page.accesskey !== "" && page.accesskey !== "undefined") linkElement.accessKey = page.accesskey;
linkElement.textContent = link_text;

// Create a list item element (dt in this case)
var listItemElement = document.createElement('dt');
listItemElement.appendChild(linkElement);

// Append the list item to the dl element
dlElement.appendChild(listItemElement);
}
}//end

function displaytime()
{
//declare a date to display at the top.
Expand Down

0 comments on commit 9c922c5

Please sign in to comment.