Changeset 734
- Timestamp:
- 02/13/07 16:43:06 (6 years ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
XinhaCore.js (modified) (1 diff)
-
modules/InsertImage/insert_image.html (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/XinhaCore.js
r732 r734 42 42 }; 43 43 44 Xinha._resolveRelativeUrl = function(base, url){ 45 if(url.match(/^([^:]+\:)?\//)){ 46 return url; 47 } 48 else{ 49 var b = base.split("/"); 50 if(b[b.length - 1] == ""){ 51 b.pop(); 52 } 53 var p = url.split("/"); 54 if(p[0] == "."){ 55 p.shift(); 56 } 57 while(p[0] == ".."){ 58 b.pop(); 59 p.shift(); 60 } 61 return b.join("/") + "/" + p.join("/"); 62 } 63 } 64 44 65 if ( typeof _editor_url == "string" ) 45 66 { 46 67 // Leave exactly one backslash at the end of _editor_url 47 68 _editor_url = _editor_url.replace(/\x2f*$/, '/'); 69 70 // convert _editor_url to absolute 71 if(!_editor_url.match(/^([^:]+\:)?\//)){ 72 var path = window.location.toString().split("/"); 73 path.pop(); 74 _editor_url = Xinha._resolveRelativeUrl(path.join("/"), _editor_url); 75 } 48 76 } 49 77 else -
trunk/modules/InsertImage/insert_image.html
r733 r734 14 14 function i18n(str) { 15 15 return (Xinha._lc(str, 'Xinha')); 16 }17 18 function resolveRelativeUrl(base, url){19 if(url.match(/^([^:]+\:)?\//)){20 return url;21 }22 else{23 var b = base.split("/");24 if(b[b.length - 1] == ""){25 b.pop();26 }27 var p = url.split("/");28 if(p[0] == "."){29 p.shift();30 }31 while(p[0] == ".."){32 b.pop();33 p.shift();34 }35 return b.join("/") + "/" + p.join("/");36 }37 16 } 38 17 … … 54 33 document.getElementById("f_horiz").value = (typeof param["f_horiz"]!="undefined") ? param["f_horiz"] : ""; 55 34 if (param["f_url"]) { 56 window.ipreview.location.replace( resolveRelativeUrl(param.f_base, param.f_url));35 window.ipreview.location.replace(Xinha._resolveRelativeUrl(param.f_base, param.f_url)); 57 36 } 58 37 document.getElementById("f_url").focus(); … … 98 77 return false; 99 78 } 100 window.ipreview.location.replace( resolveRelativeUrl(base, url));79 window.ipreview.location.replace(Xinha._resolveRelativeUrl(base, url)); 101 80 return false; 102 81 }
