This repository has been archived by the owner on Feb 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5d6dcf
commit 49f33c7
Showing
1 changed file
with
47 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,47 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block title %}Page des Étudiants{% endblock %} | ||
|
||
{% block content %} | ||
|
||
<!-- Add HTML elements for the VNC viewer here --> | ||
<div id="vncViewerContainer"></div> | ||
|
||
<script> | ||
document.addEventListener("DOMContentLoaded", function () { | ||
// Function to get the value of a URL parameter by name | ||
function getParameterByName(name, url) { | ||
if (!url) url = window.location.href; | ||
name = name.replace(/[\[\]]/g, "\\$&"); | ||
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), | ||
results = regex.exec(url); | ||
if (!results) return null; | ||
if (!results[2]) return ''; | ||
return decodeURIComponent(results[2].replace(/\+/g, " ")); | ||
} | ||
|
||
// Get the VNC URL parameter from the URL | ||
var vncUrl = getParameterByName("vncUrl"); | ||
|
||
// Check if a VNC URL is present | ||
if (vncUrl) { | ||
// Display the VNC viewer using the provided URL | ||
displayVNCViewer(vncUrl); | ||
} else { | ||
// Handle the case where the VNC URL parameter is missing | ||
console.error("VNC URL parameter is missing."); | ||
} | ||
}); | ||
|
||
// Function to display the VNC viewer with the provided URL | ||
function displayVNCViewer(vncUrl) { | ||
// Initialize the VNC viewer using noVNC | ||
var vncViewer = new RFB(document.getElementById('vncViewerContainer'), vncUrl, {}); | ||
vncViewer.connect(); | ||
} | ||
</script> | ||
|
||
{% endblock %} | ||
{% extends 'base.html' %} | ||
|
||
{% block title %}Page des Étudiants{% endblock %} | ||
|
||
{% block content %} | ||
|
||
<!-- Add HTML elements for the VNC viewer here --> | ||
<div id="vncViewerContainer"></div> | ||
|
||
<script> | ||
document.addEventListener("DOMContentLoaded", function () { | ||
// Function to get the value of a URL parameter by name | ||
function getParameterByName(name, url) { | ||
if (!url) url = window.location.href; | ||
name = name.replace(/[\[\]]/g, "\\$&"); | ||
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), | ||
results = regex.exec(url); | ||
if (!results) return null; | ||
if (!results[2]) return ''; | ||
return decodeURIComponent(results[2].replace(/\+/g, " ")); | ||
} | ||
|
||
// Get the VNC URL parameter from the URL | ||
var vncUrl = getParameterByName("vncUrl"); | ||
|
||
// Check if a VNC URL is present | ||
if (vncUrl) { | ||
// Display the VNC viewer using the provided URL | ||
displayVNCViewer(vncUrl); | ||
} else { | ||
// Handle the case where the VNC URL parameter is missing | ||
console.error("VNC URL parameter is missing."); | ||
} | ||
}); | ||
|
||
// Function to display the VNC viewer with the provided URL | ||
function displayVNCViewer(vncUrl) { | ||
var iframe = document.createElement('iframe'); | ||
iframe.src = vncUrl; | ||
iframe.width = "100%"; | ||
iframe.height = "100%"; | ||
iframe.style.border = "none"; | ||
document.getElementById('vncViewerContainer').appendChild(iframe); | ||
} | ||
</script> | ||
|
||
{% endblock %} |