mirror of
https://github.com/mehotkhan/BandersnatchInteractive.git
synced 2025-07-27 17:23:22 +00:00
commit
776035249e
1 changed files with 19 additions and 9 deletions
|
@ -174,13 +174,23 @@ function newList(id) {
|
|||
return ul;
|
||||
}
|
||||
|
||||
function addItem(ul, text, url) {
|
||||
function addItem(ul, text, url, TheChoice) {
|
||||
var li = document.createElement("li");
|
||||
var a = document.createElement("a");
|
||||
a.textContent = text;
|
||||
a.setAttribute('href', url);
|
||||
li.appendChild(a);
|
||||
ul.appendChild(li);
|
||||
|
||||
console.log("THE CHOICE", TheChoice, TheChoice.image)
|
||||
if (TheChoice && TheChoice.image){
|
||||
a.style.backgroundImage = TheChoice.image.styles.backgroundImage;
|
||||
a.style.backgroundPosition = "center center";
|
||||
a.style.backgroundSize = "10rem";
|
||||
a.style.backgroundRepeat = TheChoice.image.styles.backgroundRepeat;
|
||||
}else{
|
||||
a.textContent = text;
|
||||
}
|
||||
a.setAttribute('href', url);
|
||||
li.appendChild(a);
|
||||
ul.appendChild(li);
|
||||
|
||||
}
|
||||
|
||||
var nextChoice = -1;
|
||||
|
@ -189,7 +199,7 @@ var nextSegment = null;
|
|||
function addZones(segmentId) {
|
||||
var ul = newList("interactionZones");
|
||||
let caption = 'currentSegment(' + segmentId + ')';
|
||||
addItem(ul, caption, 'javascript:playSegment("' + segmentId + '")');
|
||||
addItem(ul, caption, 'javascript:playSegment("' + segmentId + '")', false);
|
||||
|
||||
var segment = segmentMap.segments[segmentId];
|
||||
if (segment && segment.ui && segment.ui.interactionZones) {
|
||||
|
@ -198,7 +208,7 @@ function addZones(segmentId) {
|
|||
var startMs = z[0];
|
||||
var stopMs = z[1];
|
||||
let caption = segmentId + ' interactionZone ' + index;
|
||||
addItem(ul, caption, 'javascript:seek(' + startMs + ')');
|
||||
addItem(ul, caption, 'javascript:seek(' + startMs + ')', false);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +219,7 @@ function addZones(segmentId) {
|
|||
let caption = k;
|
||||
if (segment.defaultNext == k)
|
||||
caption = '[' + caption + ']';
|
||||
addItem(ul, caption, 'javascript:playSegment("' + k + '")');
|
||||
addItem(ul, caption, 'javascript:playSegment("' + k + '")', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -228,7 +238,7 @@ function addChoices(r) {
|
|||
let index = 0;
|
||||
for (let x of r.choices) {
|
||||
var caption = r.defaultChoiceIndex == index ? '[' + x.text + ']' : x.text;
|
||||
addItem(ul, caption, 'javascript:choice(' + index + ')');
|
||||
addItem(ul, caption, 'javascript:choice(' + index + ')', x);
|
||||
index++;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue