3 /**************************************************************
\r
7 Authors : Steven Levithan
\r
8 Desc : Splits any well-formed URL
\r
10 **************************************************************/
\r
12 function parseUrl(sourceUrl){
\r
13 var urlPartNames = ["source","protocol","authority","domain","port","path","directoryPath","fileName","query","anchor"];
\r
14 var urlParts = new RegExp("^(?:([^:/?#.]+):)?(?://)?(([^:/?#]*)(?::(\\d*))?)?((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[\\?#]|$)))*/?)?([^?#/]*))?(?:\\?([^#]*))?(?:#(.*))?").exec(sourceUrl);
\r
17 for(var i = 0; i < 10; i++){
\r
18 url[urlPartNames[i]] = (urlParts[i] ? urlParts[i] : "");
\r
21 // Always end directoryPath with a trailing backslash if a path was present in the source URI
\r
22 // Note that a trailing backslash is NOT automatically inserted within or appended to the "path" key
\r
23 if(url.directoryPath.length > 0){
\r
24 url.directoryPath = url.directoryPath.replace(/\/?$/, "/");
\r
30 /*************************************************************/
\r