refactor(rest) read: rm query

This commit is contained in:
coderaiser 2014-03-13 06:50:39 -04:00
parent c27f30f84b
commit 4e1fea08e5
2 changed files with 26 additions and 35 deletions

View file

@ -773,19 +773,16 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
* @currentFile
*/
this.loadCurrentSize = function(callback, currentFile) {
var lRet,
RESTful = DOM.RESTful,
lCurrent = currentFile || this.getCurrentFile(),
lLink = this.getCurrentPath(lCurrent),
lName = this.getCurrentName(lCurrent);
var RESTful = DOM.RESTful,
current = currentFile || this.getCurrentFile(),
query = '?size',
link = this.getCurrentPath(current);
if (lName !== '..')
RESTful.read(lLink, function(pSize) {
DOM.setCurrentSize(pSize, lCurrent);
Util.exec(callback, lCurrent);
}, '?size');
return lRet;
if (name !== '..')
RESTful.read(link + query, function(size) {
DOM.setCurrentSize(size, current);
Util.exec(callback, current);
});
};
/**
@ -794,15 +791,12 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
* @currentFile
*/
this.loadCurrentHash = function(callback, currentFile) {
var lRet,
RESTful = DOM.RESTful,
lCurrent = currentFile || this.getCurrentFile(),
lLink = this.getCurrentPath(lCurrent),
lName = this.getCurrentName(lCurrent);
var RESTful = DOM.RESTful,
current = currentFile || this.getCurrentFile(),
query = '?hash',
link = this.getCurrentPath(current);
RESTful.read(lLink, callback, '?hash');
return lRet;
RESTful.read(link + query, callback);
};
/**
@ -811,27 +805,24 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
* @currentFile
*/
this.loadCurrentTime = function(callback, currentFile) {
var lRet,
RESTful = DOM.RESTful,
lCurrent = currentFile || this.getCurrentFile(),
lLink = this.getCurrentPath(lCurrent),
lName = this.getCurrentName(lCurrent);
var RESTful = DOM.RESTful,
current = currentFile || this.getCurrentFile(),
query = '?time',
link = this.getCurrentPath(lCurrent);
RESTful.read(lLink, callback, '?time');
return lRet;
RESTful.read(link + query, callback);
};
/**
* set size
* @currentFile
*/
this.setCurrentSize = function(pSize, currentFile) {
var lCurrent = currentFile || this.getCurrentFile(),
lSizeElement = this.getByClass('size', lCurrent),
lSize = CloudFunc.getShortSize(pSize);
this.setCurrentSize = function(size, currentFile) {
var current = currentFile || this.getCurrentFile(),
sizeElement = this.getByClass('size', current),
sizeShort = CloudFunc.getShortSize(size);
lSizeElement.textContent = lSize;
sizeElement.textContent = sizeShort;
};

View file

@ -33,10 +33,10 @@ var Util, DOM, CloudCmd;
});
};
this.read = function(url, callback, query) {
this.read = function(url, callback) {
sendRequest({
method : 'GET',
url : CloudFunc.FS + url + (query || ''),
url : CloudFunc.FS + url,
callback : callback
});
};