From f63772668e76adebf54e3199c07dd401a0e5f9d6 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 5 Dec 2016 16:41:56 +0200 Subject: [PATCH] refactor(dom) init: LoadingImage --- lib/client/dom.js | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/lib/client/dom.js b/lib/client/dom.js index 943ac7e8..6726e9be 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -16,34 +16,27 @@ var CloudCmd, Util, DOM, CloudFunc; HIDDEN = 'hidden', ERROR = 'error'; + function getLoadingType() { + return DOM.isSVG() ? '-svg' : '-gif'; + } + function init() { - var is; + if (LoadingImage) + return; - if (!LoadingImage) { - LoadingImage = LOADING; - is = DOM.isSVG(); - - if (is) - LoadingImage += '-svg'; - else - LoadingImage += '-gif'; - } + LoadingImage = LOADING + getLoadingType(); } function getElement() { - var element; - init(); - element = DOM.load({ + return DOM.load({ name : 'span', id : 'js-status-image', className : 'icon', attribute : 'data-progress', notAppend : true }); - - return element; } this.get = getElement;