|
1 |
| -//test for github traffic github api |
2 |
| -const repoName = 'AIProf'; // repository name |
3 |
| -//env variable for github access token |
4 |
| - //const accessToken = GH_ACCESS_TOKEN; GitHub access token |
5 |
| -const apiUrl = `https://api.github.com/repos/MeetYourAI/${repoName}/traffic/views`; |
| 1 | +// //test for github traffic github api |
| 2 | +// const repoName = 'AIProf'; // repository name |
| 3 | +// //env variable for github access token |
| 4 | +// //const accessToken = GH_ACCESS_TOKEN; GitHub access token |
| 5 | +// const apiUrl = `https://api.github.com/repos/MeetYourAI/${repoName}/traffic/views`; |
6 | 6 |
|
7 |
| -// GitHub API headers with your access token |
8 |
| -const headers = { |
9 |
| - Accept: 'application/vnd.github.v3+json', |
10 |
| - Authorization:'Basic ' + btoa('MeetYourAI' + ':' + accessToken), |
11 |
| -}; |
| 7 | +// // GitHub API headers with your access token |
| 8 | +// const headers = { |
| 9 | +// Accept: 'application/vnd.github.v3+json', |
| 10 | +// Authorization:'Basic ' + btoa('MeetYourAI' + ':' + accessToken), |
| 11 | +// }; |
12 | 12 |
|
13 |
| -// Fetch traffic data from GitHub API |
14 |
| -fetch(apiUrl, { headers }) |
15 |
| -.then((response) => response.json()) |
16 |
| -.then((data) => { |
17 |
| -const dates = data.views.map((entry) => new Date(entry.timestamp).getDate() + " / " + (new Date(entry.timestamp).getMonth() + 1) + " / " + new Date(entry.timestamp).getFullYear()); |
18 |
| -const counts = data.views.map((entry) => entry.count); |
| 13 | +// // Fetch traffic data from GitHub API |
| 14 | +// fetch(apiUrl, { headers }) |
| 15 | +// .then((response) => response.json()) |
| 16 | +// .then((data) => { |
| 17 | +// const dates = data.views.map((entry) => new Date(entry.timestamp).getDate() + " / " + (new Date(entry.timestamp).getMonth() + 1) + " / " + new Date(entry.timestamp).getFullYear()); |
| 18 | +// const counts = data.views.map((entry) => entry.count); |
19 | 19 |
|
20 |
| -// Create a chart |
21 |
| -const ctx = document.getElementById('trafficChart').getContext('2d'); |
22 |
| -new Chart(ctx, { |
23 |
| -type: 'line', |
24 |
| -data: { |
25 |
| -labels: dates, |
26 |
| -datasets: [ |
27 |
| - { |
28 |
| - label: 'Daily Visitors/Views', |
29 |
| - data: counts, |
30 |
| - fill: false, |
31 |
| - borderColor: 'rgba(75, 192, 192, 1)', |
32 |
| - borderWidth: 2, |
33 |
| - }, |
34 |
| -], |
35 |
| -}, |
36 |
| -options: { |
37 |
| - scales: { |
38 |
| - x: { |
39 |
| - title: { |
40 |
| - display: true, |
41 |
| - text: 'Dates' |
42 |
| - }, |
43 |
| - }, |
44 |
| - y: { |
45 |
| - title: { |
46 |
| - display: true, |
47 |
| - text: 'Counts' |
48 |
| - }, |
49 |
| - }, |
50 |
| - }, |
51 |
| -}, |
52 |
| -}); |
53 |
| -}) |
54 |
| -.catch((error) => { |
55 |
| -console.error('Failed to fetch data:', error); |
56 |
| -}); |
| 20 | +// // Create a chart |
| 21 | +// const ctx = document.getElementById('trafficChart').getContext('2d'); |
| 22 | +// new Chart(ctx, { |
| 23 | +// type: 'line', |
| 24 | +// data: { |
| 25 | +// labels: dates, |
| 26 | +// datasets: [ |
| 27 | +// { |
| 28 | +// label: 'Daily Visitors/Views', |
| 29 | +// data: counts, |
| 30 | +// fill: false, |
| 31 | +// borderColor: 'rgba(75, 192, 192, 1)', |
| 32 | +// borderWidth: 2, |
| 33 | +// }, |
| 34 | +// ], |
| 35 | +// }, |
| 36 | +// options: { |
| 37 | +// scales: { |
| 38 | +// x: { |
| 39 | +// title: { |
| 40 | +// display: true, |
| 41 | +// text: 'Dates' |
| 42 | +// }, |
| 43 | +// }, |
| 44 | +// y: { |
| 45 | +// title: { |
| 46 | +// display: true, |
| 47 | +// text: 'Counts' |
| 48 | +// }, |
| 49 | +// }, |
| 50 | +// }, |
| 51 | +// }, |
| 52 | +// }); |
| 53 | +// }) |
| 54 | +// .catch((error) => { |
| 55 | +// console.error('Failed to fetch data:', error); |
| 56 | +// }); |
57 | 57 |
|
58 | 58 |
|
59 | 59 | // for contact form post
|
@@ -94,3 +94,5 @@ if (response.ok) {
|
94 | 94 | }
|
95 | 95 |
|
96 | 96 | form.addEventListener(submitButton, handleSubmit);
|
| 97 | + |
| 98 | + |
0 commit comments