Rework style paradigm

This commit is contained in:
Florian Mounier
2015-10-08 11:37:48 +02:00
parent c937a8753d
commit 38a4c4083d
17 changed files with 458 additions and 635 deletions

View File

@@ -20,8 +20,7 @@ document.addEventListener 'keydown', (e) ->
if e.shiftKey
style = document.getElementById('style').getAttribute('href')
style = style.split('?')[0]
document.getElementById('style').setAttribute(
'href', style + '?' + (new Date().getTime()))
_set_theme_href style + '?' + (new Date().getTime())
return cancel(e)

View File

@@ -49,6 +49,7 @@ class Terminal
constructor: (@parent, @out, @ctl=->) ->
# Global elements
@document = @parent.ownerDocument
@html = @document.getElementsByTagName('html')[0]
@body = @document.getElementsByTagName('body')[0]
@forceWidth = @body.getAttribute(
'data-force-unicode-width') is 'yes'
@@ -1538,11 +1539,14 @@ class Terminal
oldCols = @cols
oldRows = @rows
@computeCharSize()
@cols = x or Math.floor(@body.clientWidth / @charSize.width)
@rows = y or Math.floor(window.innerHeight / @charSize.height)
px = window.innerHeight % @charSize.height
w = @body.clientWidth
h = @html.clientHeight - (@html.offsetHeight - @html.scrollHeight)
@cols = x or Math.floor(w / @charSize.width)
@rows = y or Math.floor(h / @charSize.height)
px = h % @charSize.height
@body.style['padding-bottom'] = "#{px}px"
@nativeScrollTo()
if (not x and not y) and oldCols == @cols and oldRows == @rows
return