mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 09:24:51 +00:00
refactor(dom) getIdBySrc
This commit is contained in:
parent
dbf379a175
commit
eaa8b5c184
1 changed files with 10 additions and 11 deletions
|
|
@ -19,22 +19,21 @@ var Util, DOM;
|
|||
*
|
||||
* Example: http://domain.com/1.js -> 1_js
|
||||
*/
|
||||
this.getIdBySrc = function(pSrc) {
|
||||
var lRet = Util.isString(pSrc);
|
||||
this.getIdBySrc = function(src) {
|
||||
var num, sub, id,
|
||||
isStr = Util.isString(src);
|
||||
|
||||
if (lRet) {
|
||||
var lNum = pSrc.lastIndexOf('/') + 1,
|
||||
lSub = pSrc.substr(pSrc, lNum),
|
||||
lID = Util.removeStrOneTime(pSrc, lSub );
|
||||
if (isStr) {
|
||||
num = src.lastIndexOf('/') + 1,
|
||||
sub = src.substr(src, num),
|
||||
id = Util.removeStrOneTime(src, sub);
|
||||
|
||||
/* убираем точки */
|
||||
while (lID.indexOf('.') > 0)
|
||||
lID = lID.replace('.', '_');
|
||||
|
||||
lRet = lID;
|
||||
while (id.indexOf('.') > 0)
|
||||
id = id.replace('.', '_');
|
||||
}
|
||||
|
||||
return lRet;
|
||||
return id;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue