diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js index 674328c5..db25bd7d 100644 --- a/chrome/content/vimperator/commands.js +++ b/chrome/content/vimperator/commands.js @@ -1258,30 +1258,6 @@ String.prototype.toURLArray = function() return urls; } -/* returns true if the currently loaded URI is - * a directory or false if it is a file - */ -function isDirectory(url) -{ - if (url.match(/^file:\/\//) || url.match(/^\//)) - { - var stripedFilename = url.replace(/^(file:\/\/)?(.*)/, "$2"); - var file = vimperator.fopen(stripedFilename, '<'); - if (!file) - return false; - - if (file.localFile.isDirectory()) - return true; - else - return false; - } - // for all other locations just check if the URL ends with / - if (url.match(/\/$/)) - return true; - else - return false; -} - /////////////////////////////////////////////////////////////////////}}} // misc helper functions /////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////{{{ diff --git a/chrome/content/vimperator/mappings.js b/chrome/content/vimperator/mappings.js index 069cfdcd..fcf8d287 100644 --- a/chrome/content/vimperator/mappings.js +++ b/chrome/content/vimperator/mappings.js @@ -759,6 +759,26 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); + function isDirectory(url) + { + if (url.match(/^file:\/\//) || url.match(/^\//)) + { + var stripedFilename = url.replace(/^(file:\/\/)?(.*)/, "$2"); + var file = vimperator.fopen(stripedFilename, '<'); + if (!file) + return false; + + if (file.localFile.isDirectory()) + return true; + else + return false; + } + // for all other locations just check if the URL ends with / + if (url.match(/\/$/)) + return true; + else + return false; + } addDefaultMap(new Map(vimperator.modes.NORMAL, ["gu", ""], function(count) {