# HG changeset patch # User Nicholas Jillings # Date 1442244313 -3600 # Node ID 3d13f019c3e6f07b0068ae6e3ffc01fd507e2808 # Parent be9e15805532962e75d908517d73460d92ae3fab Bug #1300: Boxes are automatically scaled on load. Will add to 'resize' commands in the future. diff -r be9e15805532 -r 3d13f019c3e6 core.css --- a/core.css Mon Sep 14 11:22:38 2015 +0100 +++ b/core.css Mon Sep 14 16:25:13 2015 +0100 @@ -24,7 +24,8 @@ border:#444444; border-style:solid; border-width:1px; - width: 624px; + max-width: 624px; + min-width: 400px; float: left; margin: 5px; height: 90px; @@ -57,7 +58,8 @@ } textarea.trackComment { - width: 618px; + max-width: 618px; + min-width: 350px; margin-right:15px; } diff -r be9e15805532 -r 3d13f019c3e6 core.js --- a/core.js Mon Sep 14 11:22:38 2015 +0100 +++ b/core.js Mon Sep 14 16:25:13 2015 +0100 @@ -1754,6 +1754,16 @@ this.trackComment = document.createElement('div'); this.trackComment.className = 'comment-div'; this.trackComment.id = 'comment-div-'+audioObject.id; + var boxwidth = (window.innerWidth-100)/2; + if (boxwidth >= 624) + { + boxwidth = 624; + } + else if (boxwidth < 400) + { + boxwidth = 400; + } + this.trackComment.style.width = boxwidth+"px"; // Create a string next to each comment asking for a comment this.trackString = document.createElement('span'); this.trackString.innerHTML = audioHolderObject.commentBoxPrefix+' '+audioObject.id; @@ -1763,6 +1773,7 @@ this.trackCommentBox.cols = '100'; this.trackCommentBox.name = 'trackComment'+audioObject.id; this.trackCommentBox.className = 'trackComment'; + this.trackCommentBox.style.width = boxwidth-6+"px"; var br = document.createElement('br'); // Add to the holder. this.trackComment.appendChild(this.trackString); @@ -1791,6 +1802,16 @@ // Create document objects to hold the comment boxes this.holder = document.createElement('div'); this.holder.className = 'comment-div'; + var boxwidth = (window.innerWidth-100)/2; + if (boxwidth >= 624) + { + boxwidth = 624; + } + else if (boxwidth < 400) + { + boxwidth = 400; + } + this.holder.style.width = boxwidth+"px"; // Create a string next to each comment asking for a comment this.string = document.createElement('span'); this.string.innerHTML = commentQuestion.question; @@ -1799,6 +1820,7 @@ this.textArea.rows = '4'; this.textArea.cols = '100'; this.textArea.className = 'trackComment'; + this.textArea.style.width = boxwidth-6+"px"; var br = document.createElement('br'); // Add to the holder. this.holder.appendChild(this.string); @@ -1821,6 +1843,16 @@ // Create document objects to hold the comment boxes this.holder = document.createElement('div'); this.holder.className = 'comment-div'; + var boxwidth = (window.innerWidth-100)/2; + if (boxwidth >= 624) + { + boxwidth = 624; + } + else if (boxwidth < 400) + { + boxwidth = 400; + } + this.holder.style.width = boxwidth+"px"; // Create a string next to each comment asking for a comment this.string = document.createElement('span'); this.string.innerHTML = commentQuestion.statement; @@ -1838,12 +1870,11 @@ this.span.style.marginTop = '15px'; var optCount = commentQuestion.options.length; - var spanMargin = Math.floor(((600-(optCount*100))/(optCount))/2)+'px'; - console.log(spanMargin); + var spanMargin = Math.floor(((boxwidth-20-(optCount*80))/(optCount))/2)+'px'; for (var i=0; i= 624) + { + boxwidth = 624; + } + else if (boxwidth < 400) + { + boxwidth = 400; + } + this.holder.style.width = boxwidth+"px"; // Create a string next to each comment asking for a comment this.string = document.createElement('span'); this.string.innerHTML = commentQuestion.statement; @@ -1922,12 +1963,11 @@ this.span.style.marginTop = '15px'; var optCount = commentQuestion.options.length; - var spanMargin = Math.floor(((600-(optCount*100))/(optCount))/2)+'px'; - console.log(spanMargin); + var spanMargin = Math.floor(((boxwidth-20-(optCount*80))/(optCount))/2)+'px'; for (var i=0; i