-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproject.html
189 lines (139 loc) · 6.68 KB
/
project.html
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AM</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="Sequel sans/style.css">
<script src="./projects.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.7.570/pdf.min.js"></script>
<link rel="icon" type="image/x-icon" href="./favicon.ico">
</head>
<script>
async function displayPdfAsImages(pdfUrl) {
const loadingTask = pdfjsLib.getDocument(pdfUrl);
const pdf = await loadingTask.promise;
const container = document.getElementById('img-div');
for (let pageNumber = 1; pageNumber <= pdf.numPages; pageNumber++) {
const page = await pdf.getPage(pageNumber);
const canvas = document.createElement('canvas');
const viewport = page.getViewport({ scale: 1 });
canvas.height = viewport.height;
canvas.width = viewport.width;
const renderContext = {
canvasContext: canvas.getContext('2d'),
viewport: viewport
};
await page.render(renderContext).promise;
const img = document.createElement('img');
img.src = canvas.toDataURL();
container.appendChild(img);
}
}
document.addEventListener('DOMContentLoaded', function () {
document.body.style.opacity = '0%';
document.body.style.opacity = '100%';
// Function to get query parameter
function getQueryParam(param) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(param);
}
// Get the project ID from the query parameter
const projectId = getQueryParam('p');
// Find the project data based on the ID
const project = projects.find(p => p.number == projectId);
// Display the project content
if (project) {
console.log(project.name);
document.getElementById('span-number').innerHTML = project.number;
document.getElementById('span-date').innerHTML = project.date;
document.getElementById('span-name').innerHTML = project.name;
document.getElementById('span-desc').innerHTML = project.description;
document.getElementById('span-tools').innerHTML = project.tools;
document.getElementById('span-type').innerHTML = project.ptype;
setTimeout(function () {
document.body.style.background = project.bgcolor;
}, 600); // Match the transition duration
var imageContainer = document.getElementById('img-div');
if (!project.video) {
console.log("no video, removing div");
document.getElementById('video-div').style.display = 'none';
}
document.getElementById('video-player').src = project.video
project.images.forEach((imageUrl) => {
const img = document.createElement('img');
img.src = imageUrl;
imageContainer.appendChild(img);
});
displayPdfAsImages(project.pdf);
} else {
document.getElementById('project-content').innerHTML = '<p>Project not found.</p>';
}
});
</script>
<script src="./transition.js"></script>
<body>
<div class="main-page">
<div class="main-page-info">
<nav style="line-height: 0.5rem;">
<h1>
<span>
<a href="./index.html">INDEX</a>
<span style="margin-left: 5px; margin-right: 5px; font-size: 14px;">></span>
<a href="./works.html">SELECTED WORKS</a>
<span style="margin-left: 5px; margin-right: 5px; font-size: 14px;">></span>
<span id="span-number">PHNUMBER</span>
</span>
<svg class="main-page-info-star" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
<path fill="#fff" stroke="#000" stroke-width=".3"
d="m9.145 7.98 3.069 4.394-2.019 1.415-3.07-4.638-.124-.188-.126.188-3.07 4.589-2.02-1.415 3.021-4.346.116-.167-.193-.061-4.54-1.444.745-2.341L5.57 5.602l.2.071V.15H8.18v5.522l.2-.07 4.685-1.636.745 2.34-4.588 1.445-.195.06.117.168Z">
</path>
</svg>
</h1>
<div class="project-main">
<div id="project-info">
<btitle id="span-name"></btitle>
</div>
<div id="project-info">
<div>
<h1 id="span-type" style="text-transform: uppercase;">PHNAME</h1>
<h1 id="span-date" style="text-transform: uppercase;">PHDATE</h1>
</div>
<div>
<h1>ABOUT</h1>
<p><span id="span-desc"></span></p>
</div>
<div>
<h1>TOOLS USED</h1>
<p><span id="span-tools"></span></p>
</div>
</div>
<div id="video-div">
<h1>VIDEO</h1>
<video controls>
<source src="" type="video/mp4" id="video-player">
</video>
</div>
<div id="image-gallery">
<h1><span style="display: flex; flex-direction: row;">ASSETS
<svg class="asset-arrow" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25">
<path style="fill:#fff" d="m17.5 5.999-.707.707 5.293 5.293H1v1h21.086l-5.294 5.295.707.707L24 12.499l-6.5-6.5z" data-name="Right" />
</svg>
</span>
</h1>
<div id="img-div"></div>
</div>
</div>
<h1>
<a href="./contact.html">CONTACT</a>
<a>//</a>
<a href="./about.html">INFO</a>
</h1>
<h1></h1>
<h1></h1>
</nav>
</div>
</div>
</body>