Skip to content

Commit

Permalink
update, directory used instead of domain
Browse files Browse the repository at this point in the history
  • Loading branch information
harrymkt committed Mar 12, 2024
1 parent e25790f commit 8b5c025
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 23 deletions.
54 changes: 49 additions & 5 deletions config/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,72 @@
<body>
<script>navstart();</script>
<h1 id="mainc">site config</h1>

<form>
<fieldset>
<legend>time format</legend>
<h2>time format</h2>
<p id="timeformat"></p>
<form>
<label name="labeltf">choose time format</label>
<select name="labeltf" id="timeformatinp" placeholder="choose time format" label="choose time format" required value="choose">
<option checked="false" value="12">12 hour</option>
<option checked="false" value="24">24 hour</option>
<select name="labeltf" id="timeformatinp" placeholder="choose time format" label="choose time format" value="choose">
<option value="">select format</option>
<option select value="12">12 hour</option>
<option select value="24">24 hour</option>
</select>
</fieldset>
<fieldset>
<legend>visiter name for the site</legend>
<h2>visiter name</h2>
<p id="visitname"></p>
<input id="visitnameinp" type="text" placeholder="enter your name to use">
</fieldset>

<input type="submit" onclick="formsub();" placeholder="submit"></input>
<input type="submit" onclick="formsub();" placeholder="Save" value="Save"></input>
<fieldset>
<legend>reset config</legend>
<input type="button" onclick="removeallcf();" placeholder="remove all configs" value="remove all config"></input>
</fieldset>
</form>
<script>
function startform()
{
var tf=localStorage.getItem("timeformat");
if(tf!=="12") tf="24";
document.getElementById("timeformat").textContent="current time format, "+tf+" hour format";
var vu=localStorage.getItem("visitname");
if(vu==="" || vu===null) vu="visiter";
document.getElementById("visitname").textContent="current name, "+vu;
}
startform();
function formsub()
{
var tf=document.getElementById("timeformatinp").value;
if(tf!==null && tf!=="")
{
if(tf!=="12") tf="24";
localStorage.setItem("timeformat",tf);
document.getElementById("timeformat").textContent="current time format, "+tf+" hour format";
}
var vu=document.getElementById("visitnameinp").value;
if(vu!==null && vu!=="")
{
if(vu==="" || vu==null) vu="visiter";
localStorage.setItem("visitname",vu);
document.getElementById("visitname").textContent="current name, "+vu;
}
}//end.function
function removeallcf()
{
const o=[
"timeformat",
"visitname"
];
for(var i=0;i<o.length;i++)
{
localStorage.removeItem(o[i]);
}
startform();
}
addfooter();
</script>
</body>
Expand Down
10 changes: 5 additions & 5 deletions scripts/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,22 @@ var privacyPolicyLink = document.createElement("p");

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

var contactAnchor = document.createElement("a");
contactAnchor.href = ptype + "://" + domain + "/contact";
contactAnchor.href = "/contact";
contactAnchor.textContent = "contact";
contactLink.appendChild(contactAnchor);

var communityPolicyAnchor = document.createElement("a");
communityPolicyAnchor.href = ptype + "://" + domain + "/community_policy";
communityPolicyAnchor.href = "/community_policy";
communityPolicyAnchor.textContent = "community policy";
communityPolicyLink.appendChild(communityPolicyAnchor);

var privacyPolicyAnchor = document.createElement("a");
privacyPolicyAnchor.href = ptype + "://" + domain + "/privacy";
privacyPolicyAnchor.href = "/privacy";
privacyPolicyAnchor.textContent = "privacy policy";
privacyPolicyLink.appendChild(privacyPolicyAnchor);

Expand All @@ -94,7 +94,7 @@ var copyrightText = document.createTextNode("copyright \u00A9 " + birthyear + "-

// Create an anchor element
var anchorElement = document.createElement("a");
anchorElement.href = ptype + "://" + domain;
anchorElement.href = "/";
anchorElement.textContent = "harry min khant.";

// Append the copyright text and anchor element to the paragraph
Expand Down
6 changes: 6 additions & 0 deletions scripts/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,10 @@ return latestVersion;
} catch (error) {
return `Error fetching latest release: ${error}`;
}
}
function get_storage(value, otherwise="undefined")
{
var n=localStorage.getItem(value);
if(n==="" || n==="undefined" || n===null) n=otherwise;
return n;
}
26 changes: 13 additions & 13 deletions scripts/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ document.body.appendChild(navigationElement);

// Define pages array
var pages = [
{ name: "Home", url: "" + ptype + "://" + window.location.hostname + "/", accesskey: "h" },
{ name: "Projects", url: "" + ptype + "://" + window.location.hostname + "/projects/", accesskey: "p" },
{ name: "Useful communities", url: "" + ptype + "://" + window.location.hostname + "/community", accesskey: "" },
{ name: "Home", url: "/", accesskey: "h" },
{ name: "Projects", url: "/projects/", accesskey: "p" },
{ name: "Useful communities", url: "/community", accesskey: "" },
{ name: "blog", url: "https://hblog.rf.gd", accesskey: "b" }
];

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

// Loop through the pages array
for (var i = 0; i < pages.length; i++) {
Expand All @@ -77,15 +77,15 @@ 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);
//var currentUrlObj = new URL(current_url);
//var pageUrlObj = new URL(page.url);

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

// Check if the hosts and normalized paths match
if (currentUrlObj.host === pageUrlObj.host && currentPath === pagePath) {
if (currentPath === pagePath) {
class_name = "active";
link_text = page.name + " (current page)";
onclick_attr = "event.preventDefault();";
Expand Down Expand Up @@ -143,12 +143,12 @@ dt += "happy valentine's day! ";
else if(m == 3 && (dy >= 12 && dy <= 16))
dt += "happy thingyan to myanmar people!";
if(d >= 20 || (d >= 0 && d < 6))
dt += "wow, thanks for visiting over sleep time!";
dt += "wow, thank you "+get_storage("visitname","visiter")+" for visiting over sleep time!";
else if(d >= 6 && d < 11)
dt += "good morning visiter, thanks for visiting to my website!";
dt += "good morning "+get_storage("visitname","visiter")+", thanks for visiting to my website!";
else if(d >= 11 && d < 16)
dt += "good afternoon, thank you for visiting to my website!";
dt += "good afternoon "+get_storage("visitname","visiter")+", thank you for visiting to my website!";
else
dt += "good evening visiter, have a nice day!";
dt += "good evening "+get_storage("visitname","visiter")+", have a nice day!";
document.getElementById("greetings").textContent = dt;
}

0 comments on commit 8b5c025

Please sign in to comment.