aboutsummaryrefslogtreecommitdiff
path: root/js/lib/NJUtils.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/NJUtils.js')
-rwxr-xr-x[-rw-r--r--]js/lib/NJUtils.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js
index d6548871..74039e64 100644..100755
--- a/js/lib/NJUtils.js
+++ b/js/lib/NJUtils.js
@@ -206,8 +206,26 @@ exports.NJUtils = Object.create(Object.prototype, {
206 ///// Return the last part of a path (e.g. filename) 206 ///// Return the last part of a path (e.g. filename)
207 getFileNameFromPath : { 207 getFileNameFromPath : {
208 value: function(path) { 208 value: function(path) {
209 path = path.replace(/[/\\]$/g,"");
210 path = path.replace(/\\/g,"/");
209 return path.substr(path.lastIndexOf('/') + 1); 211 return path.substr(path.lastIndexOf('/') + 1);
210 } 212 }
213 },
214 /***
215 * file name validation
216 */
217 isValidFileName:{
218 value: function(fileName){
219 var status = false;
220 if(fileName !== ""){
221 fileName = fileName.replace(/^\s+|\s+$/g,"");
222 status = !(/[/\\]/g.test(fileName));
223 if(status && navigator.userAgent.indexOf("Macintosh") != -1){//for Mac files beginning with . are hidden
224 status = !(/^\./g.test(fileName));
225 }
226 }
227 return status;
228 }
211 } 229 }
212 230
213}); 231});