changeset 516:2b7a77acc967

svg-edit: fix for loading from url added (id:523)
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 11 Apr 2010 14:01:35 +0200
parents 55ffbd41c42d
children aed9bccfe159
files htdocs/svg-edit/editor/svg-editor.js
diffstat 1 files changed, 15 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/htdocs/svg-edit/editor/svg-editor.js	Mon Apr 05 12:54:47 2010 +0200
+++ b/htdocs/svg-edit/editor/svg-editor.js	Sun Apr 11 14:01:35 2010 +0200
@@ -175,21 +175,23 @@
 					}
 
 					svgEditor.setConfig(urldata);
-					
-					var src = urldata.source;
-
-					if(src) {
-						if(src.indexOf("data:") === 0) {
-							// plusses get replaced by spaces, so re-insert
-							src = src.replace(/ /g, "+");
-							Editor.loadFromDataURI(src);
-						} else {
-							Editor.loadFromString(src);
-						}
-					} else if(urldata.url) {
-						svgEditor.loadFromURL(urldata.url);
+				}
+				var src = urldata.source;
+				var loc = document.location.href;
+				if(src) {
+					if(src.indexOf("data:") === 0) {
+						// plusses get replaced by spaces, so re-insert
+						src = src.replace(/ /g, "+");
+						Editor.loadFromDataURI(src);
+					} else {
+						Editor.loadFromString(src);
 					}
+				} else if(loc.indexOf('?url=') != -1) {
+					  var pre = '?url=';
+					  var url = loc.substring(loc.indexOf(pre) + pre.length);
+					  svgEditor.loadFromURL(url);
 				}
+				
 			})();
 			
 			var extFunc = function() {