GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Blog-API/api_v2/JavaScript/FetchData/slimyvue.py at main · Crane04/Blog-API

Expand file tree

/

slimyvue.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
103 lines (90 loc) · 3.36 KB
/

slimyvue.py

Copy path

File metadata and controls

103 lines (90 loc) · 3.36 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
def slimy_vue(token):
slimy_vue_txt = """
fetch(`http://127.0.0.1:8000/v2/main?location=${current_url}&id=${post_id}`,
{
"headers": {
"""
slimy_vue_txt += f"""
"Authorization": "Token {token}"
"""
slimy_vue_txt+="""
}
}
)
.then((response) => {
if (response.status === 200) { // Replace with the expected status code
return response.json(); // If expecting JSON response
}
else if(response.status === 404){
return response.json()
}
else {
throw new Error(`Couldn't fetch your data: ${response.data}`);
}
})
.then((data) => {
bloggit_data = data
if(data["type"] === "all" && data["detail"] === "okay"){
data["posts"].forEach(function(parameter){
let title = parameter.title
let body = parameter.body
let image = parameter.image
let post_id = parameter.custom_id
let comments = parameter.comment_count
let post_container = document.createElement('section')
post_container.className = "post"
if(image){
post_container.innerHTML = `
<div class="post-image">
<img src="http://127.0.0.1:8000${image}" alt="${title}">
</div>
<div class="post-content">
<h2>${title}</h2>
<p>${strip_tags(body)}</p>
<date>${convert_datetime(parameter.time)}</date>
<span>${comments} Comments</span>
<div class="read-more">
<a href="${data["ind"]}?id=${post_id}">Read More</a>
</div>
</div>
`
bloggit.appendChild(post_container)
}else{
post_container.innerHTML = `
<div class="post-image">
</div>
<div class="post-content">
<h2>${title}</h2>
<p>${strip_tags(body)}</p>
<span>${comments} Comments</span>
<div class="read-more">
<a href="${data["ind"]}?id=${post_id}" >Read More</a>
</div>
</div>
`
bloggit.appendChild(post_container)
}
}
)}else if(data["type"] == "one"){
bloggit.className = "container mt-4"
post = data["post"]
bloggit.innerHTML+=`<h1> ${post.title}</h1>`
if(post.image){
bloggit.innerHTML += `<img src="http://127.0.0.1:8000${post.image }" class="img-fluid" alt="Image for the post">`
}
bloggit.innerHTML += `
<p>${convert_datetime(post.time)}</p>
<div class="mt-4">
${post.body}
</div>`
}
try{
bloggit_preloader.style.display = "none"
}catch(error){
}
})
.catch((error) =>{
console.log(error)
})
"""
return slimy_vue_txt
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.