From 9f58a680c30b93a1fc3647eff1031201a3c0c582 Mon Sep 17 00:00:00 2001 From: Bruno Heridet Date: Sat, 23 Feb 2013 17:37:05 +0000 Subject: [PATCH] removed unneeded json_encode / json_decode for 3 reasons: - it's available natively since IE8 and it's provided by Chrome Frame which is a requirement for old IE - it's only used for postMessage exchange which is a newer API than JSON - if ever we would need it, it should be added in an external lib, not inside the editor code itself git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2462 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/embedapi.js | 71 +++++++++++--------------------------------- editor/svg-editor.js | 30 +------------------ 2 files changed, 19 insertions(+), 82 deletions(-) diff --git a/editor/embedapi.js b/editor/embedapi.js index 33db70f1..f16e3dd0 100644 --- a/editor/embedapi.js +++ b/editor/embedapi.js @@ -3,9 +3,9 @@ function embedded_svg_edit(frame){ //initialize communication this.frame = frame; this.stack = []; //callback stack - + var editapi = this; - + window.addEventListener("message", function(e){ if(e.data.substr(0,5) == "ERROR"){ editapi.stack.splice(0,1)[0](e.data,"error") @@ -48,9 +48,9 @@ svgCanvas.setSvgString("string")(function(data, error){ } }) -Everything is done with the same API as the real svg-edit, +Everything is done with the same API as the real svg-edit, and all documentation is unchanged. The only difference is -when handling returns, the callback notation is used instead. +when handling returns, the callback notation is used instead. var blah = new embedded_svg_edit(window.frames['svgedit']); blah.clearSelection("woot","blah",1337,[1,2,3,4,5,"moo"],-42,{a: "tree",b:6, c: 9})(function(){console.log("GET DATA",arguments)}) @@ -61,16 +61,14 @@ function embedded_svg_edit(frame){ this.frame = frame; //this.stack = [] //callback stack this.callbacks = {}; //successor to stack - this.encode = embedded_svg_edit.encode; //List of functions extracted with this: //Run in firebug on http://svg-edit.googlecode.com/svn/trunk/docs/files/svgcanvas-js.html - + //for(var i=0,q=[],f = document.querySelectorAll("div.CFunction h3.CTitle a");i