From e341a3e97cc51eb59a0377b7582868d2d2ecda5a Mon Sep 17 00:00:00 2001 From: KLuka Date: Tue, 12 May 2015 16:40:55 +0200 Subject: [PATCH] User CSS context menu settings fix * Fixed initialization of user CSS settings from cookie. Now we the correct values are being read. This could be possible fix for issue #138. * Changed generation of CSS link elements to get rid of JS deprecated warnings. --- shellinabox/vt100.jspp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/shellinabox/vt100.jspp b/shellinabox/vt100.jspp index 2786424..0689f9f 100755 --- a/shellinabox/vt100.jspp +++ b/shellinabox/vt100.jspp @@ -329,7 +329,7 @@ VT100.prototype.getUserSettings = function() { this.disableAlt = settings.charAt(5) != '0'; if (typeof userCSSList != 'undefined') { for (var i = 0; i < userCSSList.length; ++i) { - userCSSList[i][2] = settings.charAt(i + 5) != '0'; + userCSSList[i][2] = settings.charAt(i + 6) != '0'; } } } @@ -370,18 +370,10 @@ VT100.prototype.initializeUserCSSStyles = function() { // Add user style sheet to document var style = document.createElement('link'); - var id = document.createAttribute('id'); - id.nodeValue = 'usercss-' + i; - style.setAttributeNode(id); - var rel = document.createAttribute('rel'); - rel.nodeValue = 'stylesheet'; - style.setAttributeNode(rel); - var href = document.createAttribute('href'); - href.nodeValue = 'usercss-' + i + '.css'; - style.setAttributeNode(href); - var type = document.createAttribute('type'); - type.nodeValue = 'text/css'; - style.setAttributeNode(type); + style.setAttribute('id', 'usercss-' + i); + style.setAttribute('href', 'usercss-' + i + '.css'); + style.setAttribute('rel', 'stylesheet'); + style.setAttribute('type', 'text/css'); document.getElementsByTagName('head')[0].appendChild(style); style.disabled = !enabled; }