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 — Added exaMPLE PAGES FOR DOGS · jaymicrocode/theCatAPI-website@794a4b6

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .DS_Store
  • public
    • cat-favicon.ico
    • example-pages
      • .DS_Store
      • dogs
        • basic-search.html
        • breed-selection.html
        • categories.html
        • favourites.html
        • filter-by-type.html
        • image-analysis.html
        • image-upload.html
        • pagination.html
        • voting.html
    • favicon.ico
    • l-favicon.ico
  • src/components/Sections
    • Breeds.vue
  • thecatapi.env
  • thedogapi.env
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.DS_Store‎

Copy file name to clipboard
0 Bytes
Binary file not shown.
Collapse file

‎public/cat-favicon.ico‎

Copy file name to clipboard
2.55 KB
Binary file not shown.
Collapse file

‎public/example-pages/.DS_Store‎

Copy file name to clipboard
6 KB
Binary file not shown.
Collapse file

‎public/example-pages/dogs/basic-search.html‎

Copy file name to clipboard
+68Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<link href='https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons' rel="stylesheet">
5+
<link href="https://cdn.jsdelivr.net/npm/vuetify/dist/vuetify.min.css" rel="stylesheet">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
7+
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
8+
<script src="https://cdn.jsdelivr.net/npm/vuetify/dist/vuetify.js"></script>
9+
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
10+
</head>
11+
<body>
12+
<div id="app">
13+
<v-app>
14+
<v-content>
15+
<v-container>
16+
17+
<v-layout align-center justify-center>
18+
<v-btn color="blue" dark large @click="loadNextImage" >
19+
Another &nbsp; <v-icon>refresh</v-icon>
20+
</v-btn>
21+
</v-layout>
22+
23+
<v-layout row wrap>
24+
<v-flex xs12 >
25+
<v-card flat tile class="d-flex">
26+
<v-img :src="image.url" contain>
27+
</v-img>
28+
</v-card>
29+
</v-flex>
30+
</v-layout>
31+
32+
</v-container>
33+
</v-content>
34+
</v-app>
35+
</div>
36+
37+
<script>
38+
new Vue({
39+
el: '#app',
40+
data: {
41+
image: { url: ""}
42+
},
43+
created(){
44+
this.loadNextImage();
45+
} ,
46+
methods:{
47+
async loadNextImage()
48+
{
49+
try{
50+
axios.defaults.headers.common['x-api-key'] = "DEMO-API-KEY" // Replace this with your API Key
51+
52+
let response = await axios.get('https://api.thedogapi.com/v1/images/search', { params: { limit:1, size:"full" } } ) // Ask for 1 Image, at full resolution
53+
54+
this.image = response.data[0] // the response is an Array, so just use the first item as the Image
55+
56+
console.log("-- Image from TheDogApi.com")
57+
console.log("id:", this.image.id)
58+
console.log("url:", this.image.url)
59+
60+
}catch(err){
61+
console.log(err)
62+
}
63+
}
64+
}
65+
})
66+
</script>
67+
</body>
68+
</html>
Collapse file

‎public/example-pages/dogs/breed-selection.html‎

Copy file name to clipboard
+140Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<link href='https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons' rel="stylesheet">
5+
<link href="https://cdn.jsdelivr.net/npm/vuetify/dist/vuetify.min.css" rel="stylesheet">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
7+
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
8+
<script src="https://cdn.jsdelivr.net/npm/vuetify/dist/vuetify.js"></script>
9+
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
10+
</head>
11+
<body>
12+
<div id="app">
13+
<v-app>
14+
<v-content>
15+
<v-container>
16+
17+
<v-layout align-center justify-center>
18+
19+
<v-flex xs6>
20+
<v-select :items="breeds"
21+
item-text="name"
22+
v-model="selected_breed"
23+
label="Breeds"
24+
return-object
25+
attach></v-select>
26+
</v-flex>
27+
28+
</v-layout>
29+
30+
31+
<v-layout>
32+
<v-flex xs12 sm8 offset-sm2>
33+
<v-card>
34+
35+
<v-carousel>
36+
<v-carousel-item
37+
v-for="(item,i) in images"
38+
:key="i"
39+
:src="item.url"
40+
></v-carousel-item>
41+
</v-carousel>
42+
43+
44+
<v-card-title primary-title>
45+
46+
<div class="text-xs-center">
47+
<v-chip>
48+
<v-avatar>
49+
<img :src="country_flag_url" :alt="selected_breed.country_code">
50+
</v-avatar>
51+
{{selected_breed.origin}}</v-chip>
52+
</div>
53+
<div>
54+
<h3 class="headline mb-0">{{selected_breed.name}}</h3>
55+
<div>{{selected_breed.description}}</div>
56+
<div>---</div>
57+
<div><i>{{selected_breed.temperament}}</i></div>
58+
</div>
59+
</v-card-title>
60+
61+
<v-card-actions>
62+
<v-btn v-if="selected_breed.wikipedia_url" :href="selected_breed.wikipedia_url" target="_blank" flat color="orange">Wikipedia</v-btn>
63+
</v-card-actions>
64+
</v-card>
65+
</v-flex>
66+
</v-layout>
67+
</v-container>
68+
</v-content>
69+
</v-app>
70+
</div>
71+
72+
73+
<script>
74+
new Vue({
75+
el: '#app',
76+
data: {
77+
country_flag_url:"",
78+
images: [],
79+
breeds:[],
80+
selected_breed: {},
81+
current_image: {}
82+
},
83+
created(){
84+
this.getBreeds();
85+
} ,
86+
watch: {
87+
88+
selected_breed: function()
89+
{
90+
console.log(this.selected_breed)
91+
this.getImages();
92+
}
93+
},
94+
methods:{
95+
96+
async getBreeds()
97+
{
98+
try{
99+
axios.defaults.headers.common['x-api-key'] = "DEMO-API-KEY" // Replace this with your API Key, as it's set to defaults it will be used from now onwards
100+
101+
let response = await axios.get('https://api.thedogapi.com/v1/breeds/' )
102+
this.breeds = response.data;
103+
console.log("-- ("+this.breeds.length +") Breeds from TheDogApi.com")
104+
105+
// pick one to display initially
106+
this.selected_breed = this.breeds[10]
107+
}catch(err){
108+
console.log(err)
109+
}
110+
},
111+
async getImages()
112+
{
113+
try{
114+
115+
let query_params = {
116+
breed_ids: this.selected_breed.id,
117+
limit:8
118+
}
119+
120+
let response = await axios.get('https://api.thedogapi.com/v1/images/search', { params: query_params} )
121+
122+
this.pagination_count = response.headers['pagination-count'];
123+
this.images = response.data
124+
this.current_image = this.images[0]
125+
126+
127+
128+
console.log("-- ("+this.images.length +") Images from TheDogApi.com")
129+
console.log( this.pagination_count ,'images available for this query.')
130+
131+
}catch(err){
132+
console.log(err)
133+
}
134+
}
135+
136+
}
137+
})
138+
</script>
139+
</body>
140+
</html>
Collapse file

‎public/example-pages/dogs/categories.html‎

Copy file name to clipboard
+178Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<link href='https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons' rel="stylesheet">
5+
<link href="https://cdn.jsdelivr.net/npm/vuetify/dist/vuetify.min.css" rel="stylesheet">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
7+
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
8+
<script src="https://cdn.jsdelivr.net/npm/vuetify/dist/vuetify.js"></script>
9+
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
10+
</head>
11+
<body>
12+
<div id="app">
13+
<v-app>
14+
<v-content>
15+
<v-card>
16+
<v-container grid-list-sm fluid>
17+
<v-layout row wrap align-center>
18+
<!-- Order selection - Randpm, Descending, or Ascending -->
19+
<v-flex xs6>
20+
<v-select :items="categories"
21+
item-text="name"
22+
v-model="selected_category"
23+
label="Categories"
24+
return-object
25+
attach></v-select>
26+
</v-select>
27+
</v-flex>
28+
</v-layout>
29+
<v-layout row wrap>
30+
<!-- for loop through the results from the API -->
31+
<v-flex
32+
v-for="n in images"
33+
:§="n.id"
34+
xs4
35+
d-flex>
36+
<v-card
37+
color="grey lighten-4"
38+
flat tile class="d-flex">
39+
<v-img
40+
:src="n.url"
41+
lazy-src="https://picsum.photos/10/6"
42+
class="grey lighten-2"
43+
aspect-ratio="1">
44+
</v-img>
45+
</v-card>
46+
</v-flex>
47+
</v-layout>
48+
<br>
49+
<!-- Pagination control -->
50+
<v-layout wrap align-center>
51+
<v-flex xs11>
52+
53+
<v-card-title primary-title>
54+
<div>Page</div>
55+
</v-card-title>
56+
<v-pagination xs9
57+
v-show="order!='Rand'"
58+
v-model="page"
59+
:length="getNumPages"
60+
></v-pagination>
61+
</v-flex>
62+
</v-layout>
63+
<v-layout wrap align-center>
64+
<v-flex xs4>
65+
<v-select :items="[3,6,9]"
66+
v-model="limit"
67+
label="Limit"
68+
attach></v-select>
69+
</v-flex>
70+
<!-- Next btn only shown when Rand is select as it can't be paginated -->
71+
<v-flex xs6>
72+
<v-btn color="blue" v-show="order=='Rand'" large @click="nextBtn">
73+
<v-icon>refresh</v-icon> &nbsp; More
74+
</v-btn>
75+
</v-flex>
76+
</v-layout>
77+
78+
</v-container>
79+
</v-card>
80+
</v-content>
81+
</v-app>
82+
</div>
83+
84+
<script>
85+
new Vue({
86+
el: '#app',
87+
data: {
88+
categories: [],
89+
selected_category:{},
90+
images: [],
91+
order:'Desc',
92+
page: 1,
93+
limit: 3,
94+
pagination_count: 0, //default until we get a result with the 'Pagination-Count' header in the response
95+
},
96+
created(){
97+
this.getCategories();
98+
//this.getImages();
99+
} ,
100+
watch: {
101+
// if the user changes any of these values, then make a new request to the API
102+
page: function()
103+
{
104+
this.getImages();
105+
},
106+
limit: function()
107+
{
108+
this.getImages();
109+
},
110+
order: function()
111+
{
112+
this.getImages();
113+
},
114+
selected_category: function()
115+
{
116+
console.log(this.selected_category)
117+
this.getImages();
118+
}
119+
},
120+
computed:{
121+
122+
getNumPages: function()
123+
{
124+
return Math.floor(this.pagination_count / this.limit) | 0;
125+
}
126+
},
127+
methods:{
128+
129+
async nextBtn()
130+
{
131+
this.page++;
132+
await this.getImages();
133+
},
134+
135+
async getCategories()
136+
{
137+
try{
138+
axios.defaults.headers.common['x-api-key'] = "DEMO-API-KEY" // Replace this with your API Key, as it's set to defaults it will be used from now onwards
139+
140+
let response = await axios.get('https://api.thedogapi.com/v1/categories/' )
141+
this.categories = response.data;
142+
console.log("-- ("+this.categories.length +") Categories from TheDogApi.com")
143+
144+
// pick one to display initially
145+
this.selected_category = this.categories[2]
146+
}catch(err){
147+
console.log(err)
148+
}
149+
},
150+
async getImages()
151+
{
152+
try{
153+
axios.defaults.headers.common['x-api-key'] = "DEMO-API-KEY" // Replace this with your API Key
154+
155+
let query_params = {
156+
limit: this.limit,
157+
order: this.order,
158+
page: this.page-1,
159+
category_ids: this.selected_category.id
160+
}
161+
162+
let response = await axios.get('https://api.thedogapi.com/v1/images/search', { params: query_params } )
163+
164+
this.pagination_count = response.headers['pagination-count'];
165+
this.images = response.data
166+
167+
console.log("-- ("+this.images.length +") Images from TheDogApi.com")
168+
console.log( this.pagination_count ,'images available for this query.')
169+
170+
}catch(err){
171+
console.log(err)
172+
}
173+
}
174+
}
175+
})
176+
</script>
177+
</body>
178+
</html>

0 commit comments

Comments
0 (0)
You are visitor 01402792 — 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.