HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="https://ap-statics.s3.ap-south-1.amazonaws.com/autoproctor.2.7.6.min.css" />
</head>
<body>
<div id="ap-section">
<button id="testStart">Start Proctoring</button>
<button id="testEnd" disabled>End Proctoring</button>
<button id="testReload">Reload</button>
<div id="ap-test-report"></div>
<div id="proctor-feedback"></div>
<div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" ></script>
<script src="https://ap-statics.s3.ap-south-1.amazonaws.com/autoproctor.2.7.6.min.js?v=5"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
</body>
#ap-section button {
background: lightgrey !important ;
padding: 5px;
border-radius: 7px;
}
#ap-section {
background: white;
height: 100vh;
}
window.addEventListener("load", function () {
/*
* You will get clientId & clientSecret Once you get registered here
* https://www.autoproctor.co/developers/register/
*/
const clientID = "8b88Yarr";
const clientSecret = "4vaNDdgPy3JTHkh";
/*
* testAttemptId identifies each test attempt. This is a unique ID that your own platform generates
*/
const testAttemptId = CryptoJS.lib.WordArray.random(5).toString();
/*
* The SHA-256 HMAC of the testAttemptId with your SECRET_KEY
* For more info: https://www.autoproctor.co/developers/docs#authentication
*/
const hashedTestAttemptId = CryptoJS.SHA256(testAttemptId + clientSecret).toString();
//Configurations which you have to pass in SDK
const apSettings = {
clientId: clientID,
testAttemptId: testAttemptId,
hashedTestAttemptId: hashedTestAttemptId,
trackingOptions: {
audio: true,
numHumans: true,
tabSwitch: true,
photosAtRandom: true,
numPhotosAtRandom: 5,
captureSwitchedTab: true,
preventMultipleScreens: true,
testTakerPhoto: true,
forceFullScreen: false,
forceCaptureSwitchedTab: false,
forcePreventMultipleScreens: false,
},
testContainerId: "ap-section",
restrictConsole: false,
evidencePushInterval: 5,
showHowToVideo: false
}
async function init() {
try {
autoProctorTest = await initAutoProctor(apSettings); //initiating the instance
document.getElementById("testStart").addEventListener("click", () => {
autoProctorTest.start(); //Start Monitoring
});
//"apStartTest" event tells you whether test has been started or not
window.addEventListener("apStartTest", () => {
$("#testEnd").prop("disabled", false);
$("#testStart").prop("disabled", true);
$("#ap-test-report").html("Proctoring...");
});
document.getElementById("testEnd").addEventListener("click", () => {
autoProctorTest.stop(); //Stop Monitoring
});
//"apStopMonitoring" event tells you whether test has been ended or not
window.addEventListener("apStopMonitoring", async () => {
//Call this function to get the reports of each test attempt, You can change UI accordingly
const response = await autoProctorTest.getEvidenceReport(
apSettings.clientId,
apSettings.testAttemptId,
apSettings.hashedTestAttemptId
);
let html = `<section class="py-20">
<div class="container mx-auto px-4">
<div class="flex flex-wrap text-center">
<div class="mb-8 w-full md:w-1/2 lg:w-1/4">
<h4 class="mb-2 text-gray-500">Device</h4>
<span class="text-3xl lg:text-2xl font-bold">${
response.attemptDetails.device
}</span>
</div>
<div class="mb-8 w-full md:w-1/2 lg:w-1/4">
<h4 class="mb-2 text-gray-500">Started</h4>
<span class="text-3xl lg:text-2xl font-bold">${
response.attemptDetails.startedAt
}</span>
</div>
<div class="mb-8 w-full md:w-1/2 lg:w-1/4">
<h4 class="mb-2 text-gray-500">Finished</h4>
<span class="text-3xl lg:text-2xl font-bold">${
response.attemptDetails.finishedAt
}</span>
</div>
<div class="mb-8 w-full md:w-1/2 lg:w-1/4">
<h4 class="mb-2 text-gray-500">Trust Score</h4>
<span class="text-3xl lg:text-2xl font-bold">${
response.attemptDetails.trustScore * 100
} %</span>
</div>
</div>
</div>
</section><div
class="
md:ml-auto
border-t border-gray-200
inset-x-0
transform
rh-assg-result-candidate__scores
"
>
<div class="flex flex-col">
<div class="-my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
<div class="py-2 align-middle inline-block min-w-full sm:px-6 lg:px-8">
<div class="shadow overflow-hidden border-b border-gray-200 sm:rounded-lg">
<table class="min-w-full divide-y divide-gray-200" id="rh-ap-section-table">
<thead class="bg-gray-50">
<tr>
<th
scope="col"
class="
px-6
py-3
text-left text-xs
font-medium
text-gray-500
uppercase
"
>
Number
</th>
<th
scope="col"
class="
px-6
py-3
text-left text-xs
font-medium
text-gray-500
uppercase
"
>
Type
</th>
<th
scope="col"
class="
px-6
py-3
text-left text-xs
font-medium
text-gray-500
uppercase
"
>
Time
</th>
<th
scope="col"
class="
px-6
py-3
text-left text-xs
font-medium
text-gray-500
uppercase
"
>
Capture
</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">`;
response.reportData.forEach((report, index) => {
html += `<tr>
<td
class="
px-6
py-4
whitespace-nowrap
text-sm
font-medium
text-gray-900
"
>
${index + 1}
</td>
<td
class="
px-6
py-4
whitespace-nowrap
text-sm
font-medium
text-gray-900
"
>
${report.message}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
${report.occurredAt}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
${
report?.evidenceUrl
? report?.miscData
? report?.miscData?.dataType === "audio"
? `<a href="${report.evidenceUrl}"><audio controls class="media-audio">
<source src="${report.evidenceUrl}">
</audio></a>`
: `<a href="${report.evidenceUrl}"><img class="media-image" src="${report.evidenceUrl}" /></a>`
: `-`
: `-`
}
</td>
</tr>`;
});
html += `</tbody>
</table>
</div>
</div>
</div>
</div>
</div>`;
document.getElementById("ap-test-report").innerHTML = html;
});
document.getElementById("testReload").addEventListener("click", () => {
window.location.reload();
});
} catch (err) {
}
}
init();
})
Also see: Tab Triggers