Removed part of url thet says that js is disabled ("no-js")

This commit is contained in:
coderaiser 2013-02-19 05:33:19 -05:00
parent 5623baa4cf
commit dbf9c2da55
8 changed files with 42 additions and 59 deletions

View file

@ -141,6 +141,11 @@ directory.
* Fixed bug with setting current file
after refresh and refreshing dir content.
* Removed part of url thet says that js is disabled, from
now json data of file structure would be getted from
click event with ?json flag. "no-js" part of url
would not be supported anymore.
2012.12.12, Version 0.1.8

View file

@ -192,8 +192,8 @@
lRet = main.sendFile( pParams );
}
else if( Util.isContainStr(p.name, FS) || Util.strCmp( p.name, '/') ){
//if( !main.getQuery(p.request) )
//p.request.url += '?html';
if( !main.getQuery(p.request) )
p.request.url += '?html';
var lName = Minify.allowed.html ?
Minify.getName(INDEX) : INDEX;

View file

@ -85,6 +85,8 @@ CloudCmd._loadDir = function(pLink, pNeedRefresh){
lLink = pLink || Util.removeStr(lHref, CloudCmd.HOST),
lDir = DOM.getCurrentDir();
lLink += '?json';
if(lLink || lCurrentLink.target !== '_blank'){
DOM.Images.showLoad(pNeedRefresh ? {top:true} : null);
@ -410,11 +412,6 @@ CloudCmd._changeLinks = function(pPanelID){
/* номер ссылки иконки обновления страницы */
lREFRESHICON = 0,
/* путь в ссылке, который говорит
* что js отключен
*/
lNoJS_s = CloudFunc.NOJS,
/* right mouse click function varible */
lOnContextMenu_f = function(pEvent){
var lReturn_b = true;
@ -453,10 +450,8 @@ CloudCmd._changeLinks = function(pPanelID){
/* if it's directory - adding json extension */
lType = lElement.parentElement.nextSibling;
if(lType && lType.textContent === '<dir>'){
lLink = Util.removeStr(lLink, lNoJS_s);
if(lType && lType.textContent === '<dir>')
lName += '.json';
}
pEvent.dataTransfer.setData("DownloadURL",
'application/octet-stream' + ':' +
@ -536,7 +531,8 @@ CloudCmd._ajaxLoad = function(pPath, pOptions){
var lFSPath = decodeURI(pPath);
lFSPath = Util.removeStr( lFSPath, CloudFunc.NOJS );
var lCleanPath = Util.removeStr(lFSPath, CloudFunc.FS) || '/';
pPath = Util.removeStr( lFSPath, '?json' );
var lCleanPath = Util.removeStr( pPath, CloudFunc.FS ) || '/';
Util.log ('reading dir: "' + lCleanPath + '";');

View file

@ -1067,9 +1067,8 @@ var CloudCommander, Util,
lPath = DOM.getCurrentLink( lCurrent ).href;
/* убираем адрес хоста*/
lPath = Util.removeStr(lPath, CloudCommander.HOST);
lPath = Util.removeStr(lPath, CloudFunc.NOJS);
return lPath;
return lPath;
};
/**

View file

@ -107,17 +107,12 @@ var CloudCommander, CloudFunc, ace;
/* if directory - load json
* not html data
*/
if (lSize === '<dir>'){
if (lA.indexOf(CloudFunc.NOJS) ===
CloudFunc.FS.length) {
lA = lA.replace(CloudFunc.NOJS, '');
/* when folder view
* is no need to edit
* data
*/
ReadOnly = true;
}
}
if (lSize === '<dir>')
/* when folder view
* is no need to edit
* data
*/
ReadOnly = true;
}
this.loading = true;

View file

@ -19,7 +19,6 @@ var CloudFunc, exports;
CloudFunc.NAME = 'Cloud Commander';
/* если в ссылке будет эта строка - в браузере js отключен */
CloudFunc.NOJS = '/no-js';
CloudFunc.FS = '/fs';
/* название css-класа кнопки обновления файловой структуры*/
@ -238,16 +237,13 @@ var CloudFunc, exports;
lTitle = '" title="',
_l = '">',
lHrefEnd ='</a>',
lHtmlPath,
/* путь в ссылке, который говорит что js отключен */
lNoJS_s = CloudFunc.NOJS,
lFS_s = CloudFunc.FS;
/* корневой каталог */
lHtmlPath = lHref +
lFS_s +
lNoJS_s +
lTitle +
'/' +
_l +
@ -259,11 +255,9 @@ var CloudFunc, exports;
var lUrl=folders[i],
lShortName = lUrl.replace(lUrl.substr(lUrl,lUrl.lastIndexOf('/')+1),'');
if (i!==1)
lHtmlPath += lHref +
lFS_s + lNoJS_s + lUrl +
lTitle + lUrl + _l +
lShortName +
lHrefEnd + '/';
lHtmlPath += lHref + lFS_s + lUrl +
lTitle + lUrl + _l +
lShortName + lHrefEnd + '/';
else
lHtmlPath+=lShortName+'/';
}
@ -315,11 +309,6 @@ var CloudFunc, exports;
* если он есть
*/
lRefreshPath = CloudFunc.removeLastSlash(lPath),
/* путь в ссылке, который говорит
* что js отключен
*/
lNoJS_s = CloudFunc.NOJS,
lFS_s = CloudFunc.FS,
lFileTable =
@ -330,7 +319,7 @@ var CloudFunc, exports;
'</span>' +
'<span class="path-icon ' + CloudFunc.REFRESHICON + '"' +
' title="refresh (Ctrl+R)">' +
'<a href="' + lFS_s + lNoJS_s + lRefreshPath + '">' +
'<a href="' + lFS_s + lRefreshPath + '">' +
'</a>' +
'</span>' +
'<span>' + lHtmlPath + '</span>' +
@ -354,7 +343,7 @@ var CloudFunc, exports;
if(lDotDot === '')
lDotDot = '/';
lLink = lFS_s + lNoJS_s + lDotDot;
lLink = lFS_s + lDotDot;
/* Сохраняем путь к каталогу верхнего уровня*/
@ -380,8 +369,7 @@ var CloudFunc, exports;
'">';
lFileTable += '</span>';
lFileTable += '<span draggable class=name>' +
'<a href="' + lFS_s + lNoJS_s +
lPath+files[i].name +
'<a href="' + lFS_s + lPath + files[i].name +
'"' +
/* открываем файлы */
/*в новой вкладке */

View file

@ -23,9 +23,7 @@
FILE_NOT_FOUND = main.FILE_NOT_FOUND,
OK = main.OK,
FS = CloudFunc.FS,
NO_JS = CloudFunc.NOJS,
INDEX = null,
REQUEST = 'request',
@ -382,7 +380,7 @@
function getCleanPath(pReq){
var lPath = getPath(pReq),
lRet = Util.removeStr(lPath, [NO_JS, FS]) || main.SLASH;
lRet = Util.removeStr(lPath, FS) || main.SLASH;
return lRet;
}
@ -401,8 +399,7 @@
if(pReq){
lPath = getPath(pReq);
lNoJS = Util.isContainStr(lPath, NO_JS)
|| lPath === '/' || main.getQuery(pReq) === 'html';
lNoJS = lPath === '/' || main.getQuery(pReq) === 'html';
}
return lNoJS;

View file

@ -309,17 +309,20 @@ Util = exports || {};
* @param pSubStr
*/
Util.removeStr = function(pStr, pSubStr){
var lRet;
if( Util.isString(pStr) && pSubStr ){
var n = pSubStr.length;
if( Util.isArray(pSubStr) )
Util.fori(n, function(i){
lRet = pStr = pStr.replace(pSubStr[i], '');
});
else
lRet = pStr.replace(pSubStr, '');
}
var lRet = Util.isString(pStr) && pSubStr;
if( lRet ){
var n = pSubStr.length;
if( Util.isArray(pSubStr) )
Util.fori(n, function(i){
lRet = pStr = pStr.replace(pSubStr[i], '');
});
else
lRet = pStr.replace(pSubStr, '');
}
else
lRet = pStr;
return lRet;
};