This commit is contained in:
@@ -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 = 'G2510S1T30') {
|
||||
function SenaSDK(gid) {
|
||||
// Initialize data
|
||||
this.data = null;
|
||||
this.correctAnswer = null;
|
||||
this.gameCode = gid;
|
||||
this.gameCode = gid || window.SENA_GAME_CODE || 'G2510S1T30';
|
||||
// Initialize properties
|
||||
this.timeLimit = 0;
|
||||
this.shuffle = true;
|
||||
@@ -35,14 +35,10 @@ SenaSDK.prototype.shuffleArray = function(array) {
|
||||
[array[i], array[j]] = [array[j], array[i]];
|
||||
}
|
||||
};
|
||||
SenaSDK.prototype.load = function(callback,template = 'G2510S1T30') {
|
||||
SenaSDK.prototype.load = function(callback,template) {
|
||||
let self = this;
|
||||
// get parameter LID from URL
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const LID = urlParams.get('LID');
|
||||
if (LID) {
|
||||
self.gameCode = LID;
|
||||
};
|
||||
|
||||
self.gameCode = self.gameCode || window.SENA_GAME_CODE || template;
|
||||
fetch(`https://senaai.tech/sample/${self.gameCode}.json`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
|
||||
Reference in New Issue
Block a user