From 8c3075eabfa68c41b6cf13872b000c7c77330b92 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 28 Nov 2013 15:39:00 +0000 Subject: [PATCH] refactor(client) mv panel height to index --- html/index.html | 27 ++++++++++++++++++++++++++- lib/client.js | 21 --------------------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/html/index.html b/html/index.html index b0d112c4..06c7bad9 100644 --- a/html/index.html +++ b/html/index.html @@ -32,7 +32,7 @@ (function() { 'use strict'; - var script, + var script, Height, files = [ 'lib/client/listeners.js', 'lib/client.js', @@ -43,6 +43,7 @@ url = getCombineURL(files); window.addEventListener('load', createScript); + setPanelHeight(); function createScript() { script = document.createElement('script'); @@ -69,8 +70,32 @@ function scriptLoad() { CloudCmd.init(); + CloudCmd.HEIGHT = Height; script.removeEventListener('load', scriptLoad); } + + function setPanelHeight() { + var style; + /* устанавливаем размер высоты таблицы файлов + * исходя из размеров разрешения экрана + * + * формируем и округляем высоту экрана + * при разрешениии 1024x1280: + * 658 -> 700 + */ + + Height = window.screen.height; + Height -= (Height / 3).toFixed(); + Height = (Height / 100).toFixed() * 100; + + style = document.createElement('style'); + style.innerText = '.panel {' + + 'height:' + Height +'px;' + + '}'; + + document.head.appendChild(style); + } + })(); diff --git a/lib/client.js b/lib/client.js index ffa82cf8..cbba39ef 100644 --- a/lib/client.js +++ b/lib/client.js @@ -122,27 +122,6 @@ var Util, DOM, CloudFunc, CloudCmd; */ CloudCmd.init = function() { var lCallBack, lFunc, lHeight; - /* устанавливаем размер высоты таблицы файлов - * исходя из размеров разрешения экрана - * - * формируем и округляем высоту экрана - * при разрешениии 1024x1280: - * 658 -> 700 - */ - - lHeight = window.screen.height; - lHeight = lHeight - (lHeight/3).toFixed(); - lHeight = (lHeight / 100).toFixed() * 100; - - CloudCmd.HEIGHT = lHeight; - - DOM.cssSet({ - id:'cloudcmd', - inner: - '.panel{' + - 'height:' + lHeight +'px;' + - '}' - }); lCallBack = function() { Util.loadOnLoad([