feature(refactor) .js-left -> [data=js-left]

This commit is contained in:
coderaiser 2014-02-20 04:54:42 -05:00
parent 8ba75b0ab6
commit 78037c944d
3 changed files with 22 additions and 9 deletions

View file

@ -1 +1 @@
<div class="js-path reduce-text" title="{{ fullPath }}"><span class="path-icon clear-storage" title="clear storage (Ctrl+D)"></span><span class="path-icon refresh-icon" title="refresh (Ctrl+R)"><a href="{{ link }}"></a></span><span class=links>{{ path }}</span></div>
<div data="js-path" class="reduce-text" title="{{ fullPath }}"><span class="path-icon clear-storage" title="clear storage (Ctrl+D)"></span><span class="path-icon refresh-icon" title="refresh (Ctrl+R)"><a href="{{ link }}"></a></span><span class=links>{{ path }}</span></div>

View file

@ -319,6 +319,18 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
return ret;
};
this.getByAttr = function(attribute, element) {
var ret,
selector = '[' + 'data="' + attribute + '"]';
if (!element)
element = document;
ret = element.querySelector(selector);
return ret;
};
/**
* Function search element by class name
* @param pClass - className
@ -768,15 +780,16 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
/**
* get current direcotory path
*/
this.getCurrentDirPath = function(pPanel) {
var lPanel = pPanel || this.getPanel(),
lPath = this.getByClass('js-path', lPanel),
lRet;
this.getCurrentDirPath = function(panel) {
var ret, path;
if (lPath)
lRet = lPath.textContent;
if (!panel)
panel = this.getPanel(),
return lRet;
path = this.getByAttr('js-path', panel);
ret = path && path.textContent;
return ret;
};
/**

View file

@ -34,7 +34,7 @@
Expect =
'<div id="js-path" class="reduce-text" title="/etc/X11/">' +
'<div data="js-path" class="reduce-text" title="/etc/X11/">' +
'<span class="path-icon clear-storage" ' +
'title="clear storage (Ctrl+D)">' +
'</span>' +