This commit is contained in:
KANE LAZENI 2026-02-08 04:28:52 +00:00
parent e2a9b7f4bd
commit 245c1ae7ec

View File

@ -13,72 +13,8 @@
</div>
<?php endif; ?>
<div>
<h1>Welcome to NFC Tools KBC - Test Page</h1>
<p>Launch NFC Tools KBC, focus this web page then scan a tag. Current status:</p>
<p id="kbc-target">Waiting for a tag</p>
</div>
<script type="text/javascript">
/*
var NFCToolsKBC = (function () {
var instance = null; // Singleton instance
var callback = null; // Callback function
var isAlreadyRegister = false; // Is event already register ?
function create () {
function registerCallback(callback) {
// Check if callback param is a function
if (typeof callback == 'function') {
this.callback = callback; // Then, save the callback reference
// Register the event if is not already registered
if(this.callback != null && !isAlreadyRegister) {
document.addEventListener('paste', (event) => {
this.callback((event.clipboardData || window.clipboardData).getData('text')); // Call the callback function
event.preventDefault(); // To block the default event handling
});
isAlreadyRegister = true; // Event is now registered
}
} else {
// You must pass a function as a callback
console.log("Error: Unable to register callback");
}
}
return {
registerCallback: registerCallback
};
}
// Get instance
return {
getInstance: function() {
if(instance == null) {
instance = create();
}
return instance; // Return singleton
}
};
})();
// Wait for the HTML document has been completely loaded and parsed
document.addEventListener("DOMContentLoaded", function(event) {
// Here we register a callback function to get the NFC tag's content
alert("NFCToolsKBC");
NFCToolsKBC.getInstance().registerCallback(function(content){
// Do what you want here with the content
// For the demo, we show the content in a HTML element
var target = document.getElementById("kbc-target");
target.innerHTML = "Content detected: " + content;
});
});
*/
document.addEventListener('DOMContentLoaded', function () {
const input = document.getElementById('donneesCarte');
const form = document.getElementById('frmrechercheparcarte');