From 102ec0731a9608cb5fe7d97673ae669b4d41df2b Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 31 Dec 2014 03:59:09 -0500 Subject: [PATCH] feature(link) add title --- html/fs/link.html | 2 +- lib/client/dom.js | 19 +++++++++---------- lib/cloudfunc.js | 5 +++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/html/fs/link.html b/html/fs/link.html index 5fad0093..99d4c563 100644 --- a/html/fs/link.html +++ b/html/fs/link.html @@ -1 +1 @@ -{{ name }} \ No newline at end of file +{{ name }} \ No newline at end of file diff --git a/lib/client/dom.js b/lib/client/dom.js index 3a317ffe..b3104dea 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -1208,14 +1208,12 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * @param currentFile */ this.getCurrentName = function(currentFile) { - var inner, - name = '', + var name = '', current = currentFile || this.getCurrentFile(), link = this.getCurrentLink(current); if (link) { - inner = link.innerHTML; - name = CloudFunc.Entity.decode(inner); + name = link.title; } return name; @@ -1258,13 +1256,14 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * @param current */ this.setCurrentName = function(name, current) { - var Info = CurrentInfo, - link = Info.link, - FS = CloudFunc.FS, - dir = FS + Info.dirPath; + var Info = CurrentInfo, + link = Info.link, + FS = CloudFunc.FS, + dir = FS + Info.dirPath; - link.title = link.textContent = name; - link.href = dir + name; + link.title = name; + link.innerHTML = CloudFunc.Entity.encode(name); + link.href = dir + name; current.setAttribute('data-name', 'js-file-' + name); diff --git a/lib/cloudfunc.js b/lib/cloudfunc.js index 68fdc79c..a03e78ca 100644 --- a/lib/cloudfunc.js +++ b/lib/cloudfunc.js @@ -40,8 +40,7 @@ var Util; var Entities = { ' ': ' ', '<' : '<', - '>' : '>', - '&' : '&' + '>' : '>' }; this.encode = function(str) { @@ -218,6 +217,7 @@ var Util; linkResult = render(template.link, { link : link, + title : '..', name : '..' }); @@ -256,6 +256,7 @@ var Util; linkResult = render(templateLink, { link : link, + title : file.name, name : Entity.encode(file.name), attribute : attribute });