up
All checks were successful
Deploy to Production / deploy (push) Successful in 8s

This commit is contained in:
lubukhu
2026-01-27 16:42:52 +07:00
parent 97b99c602a
commit d3e16001e3
2 changed files with 29 additions and 25 deletions

View File

@@ -3,11 +3,11 @@
* @param {Object} config - Configuration object for the SDK
* @param {Object} config.data - Quiz data containing question, options, and answer
*/
function SenaSDK(gid) {
function SenaSDK(gid = 'G2510S1T30') {
// Initialize data
this.data = null;
this.correctAnswer = null;
this.gameCode = gid || window.SENA_GAME_CODE || 'G2510S1T30';
this.gameCode = gid;
// Initialize properties
this.timeLimit = 0;
this.shuffle = true;
@@ -35,10 +35,14 @@ SenaSDK.prototype.shuffleArray = function(array) {
[array[i], array[j]] = [array[j], array[i]];
}
};
SenaSDK.prototype.load = function(callback,template) {
SenaSDK.prototype.load = function(callback,template = 'G2510S1T30') {
let self = this;
self.gameCode = self.gameCode || window.SENA_GAME_CODE || template;
// get parameter LID from URL
const urlParams = new URLSearchParams(window.location.search);
const LID = urlParams.get('LID');
if (LID) {
self.gameCode = LID;
};
fetch(`https://senaai.tech/sample/${self.gameCode}.json`)
.then(response => response.json())
.then(data => {