This project is a web-based resource for studying Level 3 Robots. It allows users to search for and view various robot-related PDF documents. The site is built with HTML, CSS, Bootstrap, and jQuery.
- Search Functionality: Allows users to search for specific robots and filter the list accordingly.
- PDF Viewer: Displays PDF documents in a modal for quick viewing.
- Cross-Device Compatibility: Includes adjustments to ensure compatibility with devices like iPads.
- A web browser (Google Chrome, Mozilla Firefox, Safari, etc.)
- Internet connection to load external libraries
-
Clone the repository to your local machine:
git clone https://github.com/TAT2k30/BiSteamWeb.git
-
Navigate to the project directory:
cd BiSteam-study-source -
Open
index.htmlin your web browser.
- Use the search bar in the navigation to filter the list of available robot projects.
- Click on any of the robot items to view the corresponding PDF document.
- iPad Issue: There was a known issue with PDFs not displaying in the modal on iPads. This has been addressed by providing two solutions:
- Using PDF.js: Ensures better PDF rendering across devices.
- Open in New Tab: A simpler solution where PDFs open in a new browser tab.
- The main structure is in
index.html. - Includes Bootstrap for styling and jQuery for handling DOM manipulation and events.
- Custom styles are in
index.css.
- Uses jQuery for handling search functionality and PDF display.
- Optional integration with PDF.js for improved PDF rendering.
$(document).ready(function() {
$('#searchForm').submit(function(event) {
event.preventDefault();
const searchInput = $('#searchInput').val().toLowerCase();
$('.item').each(function() {
const itemName = $(this).data('name').toLowerCase();
if (itemName.includes(searchInput)) {
$(this).show();
} else {
$(this).hide();
}
});
});
// Function to display PDF using PDF.js
function displayPDF(url) {
const pdfViewer = $('#pdfViewer');
const loadingTask = pdfjsLib.getDocument(url);
loadingTask.promise.then(function(pdf) {
pdf.getPage(1).then(function(page) {
const scale = 1.5;
const viewport = page.getViewport({scale: scale});
const canvas = document.createElement('canvas');
const context = canvas.getContext('2d');
canvas.height = viewport.height;
canvas.width = viewport.width;
const renderContext = {
canvasContext: context,
viewport: viewport
};
page.render(renderContext).promise.then(function() {
pdfViewer.html(canvas);
});
});
});
}
$('.item').click(function() {
const pdfUrl = $(this).data('pdf');
if (pdfUrl) {
displayPDF(pdfUrl);
$('#pdfModal').modal('show');
}
});
});