-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
648c02f
commit d1461ea
Showing
6 changed files
with
148 additions
and
43 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"liveServer.settings.port": 5501 | ||
"liveServer.settings.port": 5502 | ||
} |
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,43 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Krimson Squad | Article</title> | ||
<link rel="shortcut icon" href="./favicon.ico"> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.0.2/tailwind.min.css"> | ||
</head> | ||
|
||
<body> | ||
<header class="text-gray-400 bg-gray-900 body-font"> | ||
<div class="container mx-auto flex flex-wrap p-5 flex-col md:flex-row items-center"> | ||
<a class="flex title-font font-medium items-center text-white mb-4 md:mb-0"> | ||
<img src="https://avatars.githubusercontent.com/u/134789824?s=48&v=4" style="border-radius: 50%;"> | ||
<span class="ml-3 text-xl">Krimson Squad</span> | ||
</a> | ||
<nav class="md:ml-auto flex flex-wrap items-center text-base justify-center"> | ||
<a class="mr-5 hover:text-white" href="https://github.com/Krimson-Squad" target="_blank">Github</a> | ||
<a class="mr-5 hover:text-white" href="https://github.com/devsdenepal" target="_blank">Author?</a> | ||
<!-- <a class="mr-5 hover:text-white">Third Link</a> | ||
<a class="mr-5 hover:text-white">Fourth Link</a> --> | ||
</nav> | ||
</div> | ||
</header> | ||
<!-- content --> | ||
<section class="text-gray-400 bg-gray-900 body-font"> | ||
<div class="container mx-auto flex px-5 py-24 items-center justify-center flex-col"> | ||
<img class="lg:w-2/6 md:w-3/6 w-5/6 mb-10 object-cover object-center rounded" alt="hero" id="img" src="https://dummyimage.com/720x600"> | ||
<div class="text-center lg:w-2/3 w-full"> | ||
<h1 class="title-font sm:text-4xl text-3xl mb-4 font-medium text-white" id="title">Loading...</h1> | ||
<p class="leading-relaxed mb-8" id="content">Loading...</p> | ||
<!-- <div class="flex justify-center"> | ||
<button class="inline-flex text-white bg-indigo-500 border-0 py-2 px-6 focus:outline-none hover:bg-indigo-600 rounded text-lg">Button</button> | ||
<button class="ml-4 inline-flex text-gray-400 bg-gray-800 border-0 py-2 px-6 focus:outline-none hover:bg-gray-700 hover:text-white rounded text-lg">Button</button> | ||
</div> --> | ||
</div> | ||
</div> | ||
</section> | ||
<script src="assets/js/article.js"></script> | ||
</body> | ||
</html> |
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,37 @@ | ||
const urlParams = new URLSearchParams(window.location.search); | ||
const sub_url = urlParams.get('view'); | ||
const final_url = '/article.html?view='+sub_url; | ||
function bring_post(post_url) { | ||
var xhr = new XMLHttpRequest(); | ||
var url = "./data/json/post.json"; // Replace with your API endpoint | ||
xhr.open("GET", url, true); | ||
xhr.responseType = "json"; | ||
xhr.onload = function () { | ||
if (xhr.status === 200) { | ||
var response = xhr.response; | ||
const result = response.result; | ||
var pages = result | ||
// Loop through the pages and display the information in the div | ||
pages.forEach(function (page) { | ||
if (page.url == post_url) { | ||
document.getElementById('title').innerText = page.title; | ||
if(page.image_url == "N/A"){ | ||
document.getElementById("img").src = "./favicon.ico" | ||
} | ||
if(page.content == "loading..."){ | ||
document.getElementById('content').innerText = page.description; | ||
} | ||
else{ | ||
document.getElementById('content').innerText = page.content; | ||
} | ||
console.table(page); | ||
} | ||
else{ | ||
console.log(sub_url,post_url) | ||
} | ||
}) | ||
} | ||
} | ||
xhr.send() | ||
} | ||
bring_post(final_url) |
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