Viewer: Remove inline events; set height on error

Move inline event handlers to viewer.js to comply with a
Content-Security-Policy where directive "unsafe-inline" is not set.

Change textarea.rows = <number of newlines> to
textarea.style.height = textarea.scrollHeight.
(The former is extremely unreliable; consider long lines...)
This commit is contained in:
Rob Wu 2013-07-18 00:40:15 +02:00
parent fde86cde54
commit d5e16ab85c
2 changed files with 9 additions and 5 deletions

View file

@ -1075,17 +1075,21 @@ var PDFView = {
errorMoreInfo.removeAttribute('hidden');
moreInfoButton.setAttribute('hidden', 'true');
lessInfoButton.removeAttribute('hidden');
errorMoreInfo.style.height = errorMoreInfo.scrollHeight + 'px';
};
lessInfoButton.onclick = function() {
errorMoreInfo.setAttribute('hidden', 'true');
moreInfoButton.removeAttribute('hidden');
lessInfoButton.setAttribute('hidden', 'true');
};
moreInfoButton.oncontextmenu =
lessInfoButton.oncontextmenu =
closeButton.oncontextmenu = function(e) {
e.preventDefault();
};
moreInfoButton.removeAttribute('hidden');
lessInfoButton.setAttribute('hidden', 'true');
errorMoreInfo.value = moreInfoText;
errorMoreInfo.rows = moreInfoText.split('\n').length - 1;
//#else
// console.error(message + '\n' + moreInfoText);
// this.fallback();