changeset 835:84db2932ef02

Bug #1445: Should be fixed, entire popup is now dynamically scaled as needed.
author Nicholas Jillings <nicholas.jillings@eecs.qmul.ac.uk>
date Fri, 27 Nov 2015 15:35:18 +0000
parents 2647dd909229
children 1640c08ae2e8
files core.js
diffstat 1 files changed, 17 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/core.js	Fri Nov 27 12:21:24 2015 +0000
+++ b/core.js	Fri Nov 27 15:35:18 2015 +0000
@@ -73,13 +73,16 @@
 		this.popupContent = document.createElement('div');
 		this.popupContent.id = 'popupContent';
 		this.popupContent.style.marginTop = '20px';
-		this.popupContent.align = 'center';
+		this.popupContent.style.marginBottom = '5px';
 		this.popup.appendChild(this.popupContent);
 		
 		var titleHolder = document.createElement('div');
 		titleHolder.id = 'popupTitleHolder';
+		titleHolder.align = 'center';
 		titleHolder.style.width = 'inherit';
-		titleHolder.style.height = '25px';
+		titleHolder.style.minHeight = '25px';
+		titleHolder.style.maxHeight = '250px';
+		titleHolder.style.overflow = 'auto';
 		titleHolder.style.marginBottom = '5px';
 		
 		this.popupTitle = document.createElement('span');
@@ -89,35 +92,29 @@
 		
 		this.popupResponse = document.createElement('div');
 		this.popupResponse.id = 'popupResponse';
+		this.popupResponse.align = 'center';
 		this.popupResponse.style.width = 'inherit';
-		this.popupResponse.style.minHeight = '170px';
+		this.popupResponse.style.minHeight = '50px';
 		this.popupResponse.style.maxHeight = '320px';
 		this.popupResponse.style.overflow = 'auto';
 		this.popupContent.appendChild(this.popupResponse);
 		
-		var buttonHolder = document.createElement('div');
-		buttonHolder.id='buttonHolder';
-		buttonHolder.width = 'inherit';
-		buttonHolder.style.height= '30px';
-		buttonHolder.align = 'left';
-		this.popupContent.appendChild(buttonHolder);
-		
 		this.buttonProceed = document.createElement('button');
 		this.buttonProceed.className = 'popupButton';
+		this.buttonProceed.position = 'relative';
 		this.buttonProceed.style.left = '390px';
-		this.buttonProceed.style.top = '2px';
 		this.buttonProceed.innerHTML = 'Next';
 		this.buttonProceed.onclick = function(){popup.proceedClicked();};
 		
 		this.buttonPrevious = document.createElement('button');
 		this.buttonPrevious.className = 'popupButton';
+		this.buttonPrevious.position = 'relative';
 		this.buttonPrevious.style.left = '10px';
-		this.buttonPrevious.style.top = '2px';
 		this.buttonPrevious.innerHTML = 'Back';
 		this.buttonPrevious.onclick = function(){popup.previousClick();};
 		
-		buttonHolder.appendChild(this.buttonPrevious);
-		buttonHolder.appendChild(this.buttonProceed);
+		this.popupContent.appendChild(this.buttonPrevious);
+		this.popupContent.appendChild(this.buttonProceed);
 		
 		this.popup.style.zIndex = -1;
 		this.popup.style.visibility = 'hidden';
@@ -230,6 +227,12 @@
 			if (node.step != null) {input.step = node.step;}
 			this.popupResponse.appendChild(input);
 		}
+		var content_height = Number(this.popup.offsetHeight.toFixed());
+		content_height -= Number(this.popupContent.offsetHeight.toFixed());
+		content_height -=Number(this.buttonProceed.offsetHeight.toFixed());
+		content_height = content_height + "px";
+		this.buttonProceed.style.top = content_height;
+		this.buttonPrevious.style.top = content_height;
 		if(this.currentIndex+1 == this.popupOptions.length) {
 			if (this.responses.nodeName == "PRETEST") {
 				this.buttonProceed.textContent = 'Start';