removing document domain, unnecesary

master
Mark MacKay 2012-07-25 13:14:04 -05:00
parent d09ac9fbed
commit 65badf348e
4 changed files with 24 additions and 26 deletions

View File

@ -133,7 +133,6 @@
}
Editor.init = function() {
document.domain = document.domain;
// For external openers
(function() {
// let the opener know SVG Edit is ready

View File

@ -382,18 +382,18 @@ c.setCustomHandlers=function(d){c.ready(function(){if(d.open){a('#tool_open > in
w){var C=document.getElementById("ruler_x_cursor"),K=document.getElementById("ruler_y_cursor"),R=document.getElementById("workarea");document.getElementById("title_show");svgedit.browser.isTouch()&&a("#workarea").unbind("mousemove.rulers").bind("mousemove.rulers",function(Tb){Tb.stopPropagation();C.style.left=Tb.pageX-66+R.scrollLeft+"px";K.style.top=Tb.pageY-48+R.scrollTop+"px"});w||(w=g.getZoom());n||(n=a("#svgcanvas"));for(var Q=g.getContentElem(),V=svgedit.units.getTypeMap()[curConfig.baseUnit],
aa=0;aa<2;aa++){var fa=aa===0,pa=fa?"x":"y",sa=fa?"width":"height",Za=Q.getAttribute(pa)-0;pa=a("#ruler_"+pa+" canvas:first");$hcanv=pa.clone();pa.replaceWith($hcanv);var Aa=$hcanv[0];var ha=pa=n[sa]()*2;Aa.parentNode.style[sa]=ha+"px";var eb=0,Ra,va=Aa.getContext("2d");va.fillStyle="rgb(200,0,0)";va.fillRect(0,0,Aa.width,Aa.height);$hcanv.siblings().remove();if(pa>=3E4){var Na=parseInt(pa/3E4)+1;Ra=Array(Na);Ra[0]=va;for(var ya=1;ya<Na;ya++){Aa[sa]=3E4;var ab=Aa.cloneNode(true);Aa.parentNode.appendChild(ab);
Ra[ya]=ab.getContext("2d")}ab[sa]=pa%3E4;pa=3E4}Aa[sa]=pa;sa=V*w;var Va=50/sa;Aa=1;for(ya=0;ya<D.length;ya++){Aa=Na=D[ya];if(Va<=Na)break}Va=Aa*sa;va.font="normal 9px 'Lucida Grande', sans-serif";va.fillStyle="#777";for(var cb=Za/sa%Aa*sa,Jb=cb-Va;cb<ha;cb+=Va){Jb+=Va;ya=Math.round(cb)+0.5;if(fa){va.moveTo(ya,15);va.lineTo(ya,0)}else{va.moveTo(15,ya);va.lineTo(0,ya)}Na=(Jb-Za)/sa;if(Aa>=1)ya=Math.round(Na);else{ya=(Aa+"").split(".")[1].length;ya=Na.toFixed(ya)-0}if(ya!==0&&ya!==1E3&&ya%1E3===0)ya=
ya/1E3+"K";if(fa){va.fillText(ya,cb+2,8);va.fillStyle="#777"}else{Na=(ya+"").split("");for(ya=0;ya<Na.length;ya++){va.fillText(Na[ya],1,cb+9+ya*9);va.fillStyle="#777"}}Na=Va/10;for(ya=1;ya<10;ya++){var yb=Math.round(cb+Na*ya)+0.5;if(Ra&&yb>pa){eb++;va.stroke();if(eb>=Ra.length){ya=10;cb=ha;continue}va=Ra[eb];cb-=3E4;yb=Math.round(cb+Na*ya)+0.5}var Hb=ya%2?12:10;if(fa){va.moveTo(yb,15);va.lineTo(yb,Hb)}else{va.moveTo(15,yb);va.lineTo(Hb,yb)}}}va.strokeStyle="#666";va.stroke()}}document.domain=document.domain;
(function(){var n=window.opener;if(n)try{var w=n.document.createEvent("Event");w.initEvent("svgEditorReady",true,true);n.document.documentElement.dispatchEvent(w)}catch(C){}})();(function(){a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);a("body").toggleClass("touch",svgedit.browser.isTouch());var n=a.deparam.querystring(true);if(!a.isEmptyObject(n)){if(n.dimensions)n.dimensions=n.dimensions.split(",");if(n.extensions)n.extensions=n.extensions.split(",");
if(n.bkgd_color)n.bkgd_color="#"+n.bkgd_color;svgEditor.setConfig(n);var w=n.source,C=a.param.querystring();if(!w)if(C.indexOf("source=data:")>=0)w=C.match(/source=(data:[^&]*)/)[1];if(w)if(w.indexOf("data:")===0){w=w.replace(/ /g,"+");c.loadFromDataURI(w)}else c.loadFromString(w);else if(C.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(C.substr(9));else n.url&&svgEditor.loadFromURL(n.url)}})();var q=function(){a.each(curConfig.extensions,function(){var n=this;a.getScript(curConfig.extPath+n,function(w){if(!w){w=
document.createElement("script");w.src=curConfig.extPath+n;document.querySelector("head").appendChild(w)}})})};document.location.protocol==="file:"?setTimeout(q,100):q();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:!svgedit.browser.isWebkit(),fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"fhpath.png",pen:"line.png",square:"square.png",rect:"rect.png",fh_rect:"freehand-square.png",circle:"circle.png",
ellipse:"ellipse.png",fh_ellipse:"freehand-circle.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",node_delete:"node_delete.png",align_left:"align-left.png",align_center:"align-center",align_right:"align-right",align_top:"align-top",align_middle:"align-middle",align_bottom:"align-bottom",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},placement:{"#logo":"logo","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect",
"#tool_square":"square","#tool_fhrect":"fh_rect","#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_circle":"circle","#tool_fhellipse":"fh_ellipse","#tool_path":"path","#tool_text,#layer_rename":"text","#tool_image":"image","#tool_zoom":"zoom","#tool_node_clone":"node_clone","#tool_node_delete":"node_delete","#tool_add_subpath":"add_subpath","#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right",
"#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#zoomLabel":"zoom","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},
callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");var n=a("#tools_left");if(n.length!=0){n.offset();n.outerHeight()}a(".tools_flyout").each(function(){var w=a("#"+this.id+"_show"),C=w.attr("data-curopt");if(!w.children("svg, img").length){C=a(C).children().clone();if(C.length){C[0].removeAttribute("style");w.append(C)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},
1)}});a("#rulers").on("dblclick",function(n){a("#base_unit_container").css({top:n.pageY-10,left:n.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});c.canvas=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);c.show_save_warning=false;c.paintBox={fill:null,stroke:null,canvas:null};
q=navigator.platform.indexOf("Mac")>=0;var B=navigator.userAgent.indexOf("AppleWebKit")>=0,o=q?"meta+":"ctrl+",J=g.pathActions,U=g.undoMgr,M=svgedit.utilities,I=curConfig.imgPath+"placeholder.svg",S=a("#workarea"),Y=a("#cmenu_canvas"),P=null,ia=1,qa="toolbars",ga="";q||a(".shortcut").each(function(){var n=a(this).text();a(this).text(n.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var n=a("#dialog_box"),
w=a("#dialog_buttons"),C=function(K,R,Q,V){a("#dialog_content").html("<p>"+R.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",K=="prompt");w.empty();var aa=a('<input type="button" value="'+uiStrings.common.ok+'">').appendTo(w);K!="alert"&&a('<input type="button" value="'+uiStrings.common.cancel+'">').appendTo(w).on("click, touchstart",function(){n.hide();Q(false)});if(K=="prompt"){var fa=a('<input type="text">').prependTo(w);fa.val(V||"");fa.bind("keydown","return",function(){aa.trigger("click touchstart")})}K==
"process"&&aa.hide();n.show();aa.on("click touchstart",function(){n.hide();var pa=K=="prompt"?fa.val():true;Q&&Q(pa)}).focus();K=="prompt"&&fa.focus()};a.alert=function(K,R){C("alert",K,R)};a.confirm=function(K,R){C("confirm",K,R)};a.process_cancel=function(K,R){C("process",K,R)};a.prompt=function(K,R,Q){C("prompt",K,Q,R)}})();var ba=function(){var n=a(".tool_button_current");if(n.length&&n[0].id!=="tool_select"){n.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},
ya/1E3+"K";if(fa){va.fillText(ya,cb+2,8);va.fillStyle="#777"}else{Na=(ya+"").split("");for(ya=0;ya<Na.length;ya++){va.fillText(Na[ya],1,cb+9+ya*9);va.fillStyle="#777"}}Na=Va/10;for(ya=1;ya<10;ya++){var yb=Math.round(cb+Na*ya)+0.5;if(Ra&&yb>pa){eb++;va.stroke();if(eb>=Ra.length){ya=10;cb=ha;continue}va=Ra[eb];cb-=3E4;yb=Math.round(cb+Na*ya)+0.5}var Hb=ya%2?12:10;if(fa){va.moveTo(yb,15);va.lineTo(yb,Hb)}else{va.moveTo(15,yb);va.lineTo(Hb,yb)}}}va.strokeStyle="#666";va.stroke()}}(function(){var n=window.opener;
if(n)try{var w=n.document.createEvent("Event");w.initEvent("svgEditorReady",true,true);n.document.documentElement.dispatchEvent(w)}catch(C){}})();(function(){a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);a("body").toggleClass("touch",svgedit.browser.isTouch());var n=a.deparam.querystring(true);if(!a.isEmptyObject(n)){if(n.dimensions)n.dimensions=n.dimensions.split(",");if(n.extensions)n.extensions=n.extensions.split(",");if(n.bkgd_color)n.bkgd_color=
"#"+n.bkgd_color;svgEditor.setConfig(n);var w=n.source,C=a.param.querystring();if(!w)if(C.indexOf("source=data:")>=0)w=C.match(/source=(data:[^&]*)/)[1];if(w)if(w.indexOf("data:")===0){w=w.replace(/ /g,"+");c.loadFromDataURI(w)}else c.loadFromString(w);else if(C.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(C.substr(9));else n.url&&svgEditor.loadFromURL(n.url)}})();var q=function(){a.each(curConfig.extensions,function(){var n=this;a.getScript(curConfig.extPath+n,function(w){if(!w){w=document.createElement("script");
w.src=curConfig.extPath+n;document.querySelector("head").appendChild(w)}})})};document.location.protocol==="file:"?setTimeout(q,100):q();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:!svgedit.browser.isWebkit(),fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"fhpath.png",pen:"line.png",square:"square.png",rect:"rect.png",fh_rect:"freehand-square.png",circle:"circle.png",ellipse:"ellipse.png",fh_ellipse:"freehand-circle.png",
path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",node_delete:"node_delete.png",align_left:"align-left.png",align_center:"align-center",align_right:"align-right",align_top:"align-top",align_middle:"align-middle",align_bottom:"align-bottom",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},placement:{"#logo":"logo","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect","#tool_square":"square","#tool_fhrect":"fh_rect",
"#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_circle":"circle","#tool_fhellipse":"fh_ellipse","#tool_path":"path","#tool_text,#layer_rename":"text","#tool_image":"image","#tool_zoom":"zoom","#tool_node_clone":"node_clone","#tool_node_delete":"node_delete","#tool_add_subpath":"add_subpath","#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top",
"#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#zoomLabel":"zoom","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});
a(".tool_button, .tool_button_current").addClass("loaded");var n=a("#tools_left");if(n.length!=0){n.offset();n.outerHeight()}a(".tools_flyout").each(function(){var w=a("#"+this.id+"_show"),C=w.attr("data-curopt");if(!w.children("svg, img").length){C=a(C).children().clone();if(C.length){C[0].removeAttribute("style");w.append(C)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",
function(n){a("#base_unit_container").css({top:n.pageY-10,left:n.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});c.canvas=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);c.show_save_warning=false;c.paintBox={fill:null,stroke:null,canvas:null};q=navigator.platform.indexOf("Mac")>=
0;var B=navigator.userAgent.indexOf("AppleWebKit")>=0,o=q?"meta+":"ctrl+",J=g.pathActions,U=g.undoMgr,M=svgedit.utilities,I=curConfig.imgPath+"placeholder.svg",S=a("#workarea"),Y=a("#cmenu_canvas"),P=null,ia=1,qa="toolbars",ga="";q||a(".shortcut").each(function(){var n=a(this).text();a(this).text(n.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var n=a("#dialog_box"),w=a("#dialog_buttons"),C=function(K,
R,Q,V){a("#dialog_content").html("<p>"+R.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",K=="prompt");w.empty();var aa=a('<input type="button" value="'+uiStrings.common.ok+'">').appendTo(w);K!="alert"&&a('<input type="button" value="'+uiStrings.common.cancel+'">').appendTo(w).on("click, touchstart",function(){n.hide();Q(false)});if(K=="prompt"){var fa=a('<input type="text">').prependTo(w);fa.val(V||"");fa.bind("keydown","return",function(){aa.trigger("click touchstart")})}K=="process"&&aa.hide();
n.show();aa.on("click touchstart",function(){n.hide();var pa=K=="prompt"?fa.val():true;Q&&Q(pa)}).focus();K=="prompt"&&fa.focus()};a.alert=function(K,R){C("alert",K,R)};a.confirm=function(K,R){C("confirm",K,R)};a.process_cancel=function(K,R){C("process",K,R)};a.prompt=function(K,R,Q){C("prompt",K,Q,R)}})();var ba=function(){var n=a(".tool_button_current");if(n.length&&n[0].id!=="tool_select"){n.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},
X=null,ta=false,ka=false,da="",W=function(n,w){var C=g.getResolution();a("#svgcanvas").position();var K=g.setBBoxZoom(w,S.width()-15,S.height()-15);if(K){var R=K.zoom;K=K.bbox;if(R<0.0010)xa({value:0.1});else{var Q=Date.now(),V=R-C.zoom;a("#zoom");var aa=C.zoom,fa=function(pa){pa=(pa-Q)/500;pa=Math.pow(pa-1,3)+1;g.setZoom(aa+V*pa);H();pa<1?requestAnimationFrame(fa):a("#zoom").val(R*100)};fa(Date.now());g.getMode()=="zoom"&&K.width&&ba();mb()}}};a("#cur_context_panel").delegate("a","click",function(){var n=
a(this);n.attr("data-root")?g.leaveContext():g.setContext(n.text());return false});var Z=function(){c.paintBox.fill.prep();c.paintBox.stroke.prep()},oa={},ra=function(n){a.each(n,function(w,C){var K=a(w).children(),R=w+"_show",Q=a(R),V=false;K.addClass("tool_button").unbind("click mousedown mouseup").each(function(pa){var sa=C[pa];oa[sa.sel]=sa.fn;if(sa.isDefault)V=pa;pa=function(Za){var Aa=sa;if(Za.type==="keydown"){var ha=a(Aa.parent+"_show").hasClass("tool_button_current"),eb=a(Aa.parent+"_show").attr("data-curopt");
a.each(n[sa.parent],function(va,Na){if(Na.sel==eb)Aa=!Za.shiftKey||!ha?Na:n[sa.parent][va+1]||n[sa.parent][0]})}if(a(this).hasClass("disabled"))return false;$a(R)&&Aa.fn();var Ra=Aa.icon?a.getSvgIcon(Aa.icon,true):a(Aa.sel).children().eq(0).clone();Ra[0].setAttribute("width",Q.width());Ra[0].setAttribute("height",Q.height());Q.children(":not(.flyout_arrow_horiz)").remove();Q.append(Ra).attr("data-curopt",Aa.sel)};a(this).mouseup(pa);sa.key&&a(document).bind("keydown",sa.key[0]+" shift+"+sa.key[0],

View File

@ -133,7 +133,6 @@
}
Editor.init = function() {
document.domain = document.domain;
// For external openers
(function() {
// let the opener know SVG Edit is ready

View File

@ -382,18 +382,18 @@ c.setCustomHandlers=function(d){c.ready(function(){if(d.open){a('#tool_open > in
w){var C=document.getElementById("ruler_x_cursor"),K=document.getElementById("ruler_y_cursor"),R=document.getElementById("workarea");document.getElementById("title_show");svgedit.browser.isTouch()&&a("#workarea").unbind("mousemove.rulers").bind("mousemove.rulers",function(Tb){Tb.stopPropagation();C.style.left=Tb.pageX-66+R.scrollLeft+"px";K.style.top=Tb.pageY-48+R.scrollTop+"px"});w||(w=g.getZoom());n||(n=a("#svgcanvas"));for(var Q=g.getContentElem(),V=svgedit.units.getTypeMap()[curConfig.baseUnit],
aa=0;aa<2;aa++){var fa=aa===0,pa=fa?"x":"y",sa=fa?"width":"height",Za=Q.getAttribute(pa)-0;pa=a("#ruler_"+pa+" canvas:first");$hcanv=pa.clone();pa.replaceWith($hcanv);var Aa=$hcanv[0];var ha=pa=n[sa]()*2;Aa.parentNode.style[sa]=ha+"px";var eb=0,Ra,va=Aa.getContext("2d");va.fillStyle="rgb(200,0,0)";va.fillRect(0,0,Aa.width,Aa.height);$hcanv.siblings().remove();if(pa>=3E4){var Na=parseInt(pa/3E4)+1;Ra=Array(Na);Ra[0]=va;for(var ya=1;ya<Na;ya++){Aa[sa]=3E4;var ab=Aa.cloneNode(true);Aa.parentNode.appendChild(ab);
Ra[ya]=ab.getContext("2d")}ab[sa]=pa%3E4;pa=3E4}Aa[sa]=pa;sa=V*w;var Va=50/sa;Aa=1;for(ya=0;ya<D.length;ya++){Aa=Na=D[ya];if(Va<=Na)break}Va=Aa*sa;va.font="normal 9px 'Lucida Grande', sans-serif";va.fillStyle="#777";for(var cb=Za/sa%Aa*sa,Jb=cb-Va;cb<ha;cb+=Va){Jb+=Va;ya=Math.round(cb)+0.5;if(fa){va.moveTo(ya,15);va.lineTo(ya,0)}else{va.moveTo(15,ya);va.lineTo(0,ya)}Na=(Jb-Za)/sa;if(Aa>=1)ya=Math.round(Na);else{ya=(Aa+"").split(".")[1].length;ya=Na.toFixed(ya)-0}if(ya!==0&&ya!==1E3&&ya%1E3===0)ya=
ya/1E3+"K";if(fa){va.fillText(ya,cb+2,8);va.fillStyle="#777"}else{Na=(ya+"").split("");for(ya=0;ya<Na.length;ya++){va.fillText(Na[ya],1,cb+9+ya*9);va.fillStyle="#777"}}Na=Va/10;for(ya=1;ya<10;ya++){var yb=Math.round(cb+Na*ya)+0.5;if(Ra&&yb>pa){eb++;va.stroke();if(eb>=Ra.length){ya=10;cb=ha;continue}va=Ra[eb];cb-=3E4;yb=Math.round(cb+Na*ya)+0.5}var Hb=ya%2?12:10;if(fa){va.moveTo(yb,15);va.lineTo(yb,Hb)}else{va.moveTo(15,yb);va.lineTo(Hb,yb)}}}va.strokeStyle="#666";va.stroke()}}document.domain=document.domain;
(function(){var n=window.opener;if(n)try{var w=n.document.createEvent("Event");w.initEvent("svgEditorReady",true,true);n.document.documentElement.dispatchEvent(w)}catch(C){}})();(function(){a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);a("body").toggleClass("touch",svgedit.browser.isTouch());var n=a.deparam.querystring(true);if(!a.isEmptyObject(n)){if(n.dimensions)n.dimensions=n.dimensions.split(",");if(n.extensions)n.extensions=n.extensions.split(",");
if(n.bkgd_color)n.bkgd_color="#"+n.bkgd_color;svgEditor.setConfig(n);var w=n.source,C=a.param.querystring();if(!w)if(C.indexOf("source=data:")>=0)w=C.match(/source=(data:[^&]*)/)[1];if(w)if(w.indexOf("data:")===0){w=w.replace(/ /g,"+");c.loadFromDataURI(w)}else c.loadFromString(w);else if(C.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(C.substr(9));else n.url&&svgEditor.loadFromURL(n.url)}})();var q=function(){a.each(curConfig.extensions,function(){var n=this;a.getScript(curConfig.extPath+n,function(w){if(!w){w=
document.createElement("script");w.src=curConfig.extPath+n;document.querySelector("head").appendChild(w)}})})};document.location.protocol==="file:"?setTimeout(q,100):q();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:!svgedit.browser.isWebkit(),fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"fhpath.png",pen:"line.png",square:"square.png",rect:"rect.png",fh_rect:"freehand-square.png",circle:"circle.png",
ellipse:"ellipse.png",fh_ellipse:"freehand-circle.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",node_delete:"node_delete.png",align_left:"align-left.png",align_center:"align-center",align_right:"align-right",align_top:"align-top",align_middle:"align-middle",align_bottom:"align-bottom",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},placement:{"#logo":"logo","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect",
"#tool_square":"square","#tool_fhrect":"fh_rect","#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_circle":"circle","#tool_fhellipse":"fh_ellipse","#tool_path":"path","#tool_text,#layer_rename":"text","#tool_image":"image","#tool_zoom":"zoom","#tool_node_clone":"node_clone","#tool_node_delete":"node_delete","#tool_add_subpath":"add_subpath","#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right",
"#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#zoomLabel":"zoom","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},
callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");var n=a("#tools_left");if(n.length!=0){n.offset();n.outerHeight()}a(".tools_flyout").each(function(){var w=a("#"+this.id+"_show"),C=w.attr("data-curopt");if(!w.children("svg, img").length){C=a(C).children().clone();if(C.length){C[0].removeAttribute("style");w.append(C)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},
1)}});a("#rulers").on("dblclick",function(n){a("#base_unit_container").css({top:n.pageY-10,left:n.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});c.canvas=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);c.show_save_warning=false;c.paintBox={fill:null,stroke:null,canvas:null};
q=navigator.platform.indexOf("Mac")>=0;var B=navigator.userAgent.indexOf("AppleWebKit")>=0,o=q?"meta+":"ctrl+",J=g.pathActions,U=g.undoMgr,M=svgedit.utilities,I=curConfig.imgPath+"placeholder.svg",S=a("#workarea"),Y=a("#cmenu_canvas"),P=null,ia=1,qa="toolbars",ga="";q||a(".shortcut").each(function(){var n=a(this).text();a(this).text(n.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var n=a("#dialog_box"),
w=a("#dialog_buttons"),C=function(K,R,Q,V){a("#dialog_content").html("<p>"+R.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",K=="prompt");w.empty();var aa=a('<input type="button" value="'+uiStrings.common.ok+'">').appendTo(w);K!="alert"&&a('<input type="button" value="'+uiStrings.common.cancel+'">').appendTo(w).on("click, touchstart",function(){n.hide();Q(false)});if(K=="prompt"){var fa=a('<input type="text">').prependTo(w);fa.val(V||"");fa.bind("keydown","return",function(){aa.trigger("click touchstart")})}K==
"process"&&aa.hide();n.show();aa.on("click touchstart",function(){n.hide();var pa=K=="prompt"?fa.val():true;Q&&Q(pa)}).focus();K=="prompt"&&fa.focus()};a.alert=function(K,R){C("alert",K,R)};a.confirm=function(K,R){C("confirm",K,R)};a.process_cancel=function(K,R){C("process",K,R)};a.prompt=function(K,R,Q){C("prompt",K,Q,R)}})();var ba=function(){var n=a(".tool_button_current");if(n.length&&n[0].id!=="tool_select"){n.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},
ya/1E3+"K";if(fa){va.fillText(ya,cb+2,8);va.fillStyle="#777"}else{Na=(ya+"").split("");for(ya=0;ya<Na.length;ya++){va.fillText(Na[ya],1,cb+9+ya*9);va.fillStyle="#777"}}Na=Va/10;for(ya=1;ya<10;ya++){var yb=Math.round(cb+Na*ya)+0.5;if(Ra&&yb>pa){eb++;va.stroke();if(eb>=Ra.length){ya=10;cb=ha;continue}va=Ra[eb];cb-=3E4;yb=Math.round(cb+Na*ya)+0.5}var Hb=ya%2?12:10;if(fa){va.moveTo(yb,15);va.lineTo(yb,Hb)}else{va.moveTo(15,yb);va.lineTo(Hb,yb)}}}va.strokeStyle="#666";va.stroke()}}(function(){var n=window.opener;
if(n)try{var w=n.document.createEvent("Event");w.initEvent("svgEditorReady",true,true);n.document.documentElement.dispatchEvent(w)}catch(C){}})();(function(){a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);a("body").toggleClass("touch",svgedit.browser.isTouch());var n=a.deparam.querystring(true);if(!a.isEmptyObject(n)){if(n.dimensions)n.dimensions=n.dimensions.split(",");if(n.extensions)n.extensions=n.extensions.split(",");if(n.bkgd_color)n.bkgd_color=
"#"+n.bkgd_color;svgEditor.setConfig(n);var w=n.source,C=a.param.querystring();if(!w)if(C.indexOf("source=data:")>=0)w=C.match(/source=(data:[^&]*)/)[1];if(w)if(w.indexOf("data:")===0){w=w.replace(/ /g,"+");c.loadFromDataURI(w)}else c.loadFromString(w);else if(C.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(C.substr(9));else n.url&&svgEditor.loadFromURL(n.url)}})();var q=function(){a.each(curConfig.extensions,function(){var n=this;a.getScript(curConfig.extPath+n,function(w){if(!w){w=document.createElement("script");
w.src=curConfig.extPath+n;document.querySelector("head").appendChild(w)}})})};document.location.protocol==="file:"?setTimeout(q,100):q();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:!svgedit.browser.isWebkit(),fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"fhpath.png",pen:"line.png",square:"square.png",rect:"rect.png",fh_rect:"freehand-square.png",circle:"circle.png",ellipse:"ellipse.png",fh_ellipse:"freehand-circle.png",
path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",node_delete:"node_delete.png",align_left:"align-left.png",align_center:"align-center",align_right:"align-right",align_top:"align-top",align_middle:"align-middle",align_bottom:"align-bottom",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},placement:{"#logo":"logo","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect","#tool_square":"square","#tool_fhrect":"fh_rect",
"#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_circle":"circle","#tool_fhellipse":"fh_ellipse","#tool_path":"path","#tool_text,#layer_rename":"text","#tool_image":"image","#tool_zoom":"zoom","#tool_node_clone":"node_clone","#tool_node_delete":"node_delete","#tool_add_subpath":"add_subpath","#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top",
"#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#zoomLabel":"zoom","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});
a(".tool_button, .tool_button_current").addClass("loaded");var n=a("#tools_left");if(n.length!=0){n.offset();n.outerHeight()}a(".tools_flyout").each(function(){var w=a("#"+this.id+"_show"),C=w.attr("data-curopt");if(!w.children("svg, img").length){C=a(C).children().clone();if(C.length){C[0].removeAttribute("style");w.append(C)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",
function(n){a("#base_unit_container").css({top:n.pageY-10,left:n.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});c.canvas=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);c.show_save_warning=false;c.paintBox={fill:null,stroke:null,canvas:null};q=navigator.platform.indexOf("Mac")>=
0;var B=navigator.userAgent.indexOf("AppleWebKit")>=0,o=q?"meta+":"ctrl+",J=g.pathActions,U=g.undoMgr,M=svgedit.utilities,I=curConfig.imgPath+"placeholder.svg",S=a("#workarea"),Y=a("#cmenu_canvas"),P=null,ia=1,qa="toolbars",ga="";q||a(".shortcut").each(function(){var n=a(this).text();a(this).text(n.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var n=a("#dialog_box"),w=a("#dialog_buttons"),C=function(K,
R,Q,V){a("#dialog_content").html("<p>"+R.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",K=="prompt");w.empty();var aa=a('<input type="button" value="'+uiStrings.common.ok+'">').appendTo(w);K!="alert"&&a('<input type="button" value="'+uiStrings.common.cancel+'">').appendTo(w).on("click, touchstart",function(){n.hide();Q(false)});if(K=="prompt"){var fa=a('<input type="text">').prependTo(w);fa.val(V||"");fa.bind("keydown","return",function(){aa.trigger("click touchstart")})}K=="process"&&aa.hide();
n.show();aa.on("click touchstart",function(){n.hide();var pa=K=="prompt"?fa.val():true;Q&&Q(pa)}).focus();K=="prompt"&&fa.focus()};a.alert=function(K,R){C("alert",K,R)};a.confirm=function(K,R){C("confirm",K,R)};a.process_cancel=function(K,R){C("process",K,R)};a.prompt=function(K,R,Q){C("prompt",K,Q,R)}})();var ba=function(){var n=a(".tool_button_current");if(n.length&&n[0].id!=="tool_select"){n.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},
X=null,ta=false,ka=false,da="",W=function(n,w){var C=g.getResolution();a("#svgcanvas").position();var K=g.setBBoxZoom(w,S.width()-15,S.height()-15);if(K){var R=K.zoom;K=K.bbox;if(R<0.0010)xa({value:0.1});else{var Q=Date.now(),V=R-C.zoom;a("#zoom");var aa=C.zoom,fa=function(pa){pa=(pa-Q)/500;pa=Math.pow(pa-1,3)+1;g.setZoom(aa+V*pa);H();pa<1?requestAnimationFrame(fa):a("#zoom").val(R*100)};fa(Date.now());g.getMode()=="zoom"&&K.width&&ba();mb()}}};a("#cur_context_panel").delegate("a","click",function(){var n=
a(this);n.attr("data-root")?g.leaveContext():g.setContext(n.text());return false});var Z=function(){c.paintBox.fill.prep();c.paintBox.stroke.prep()},oa={},ra=function(n){a.each(n,function(w,C){var K=a(w).children(),R=w+"_show",Q=a(R),V=false;K.addClass("tool_button").unbind("click mousedown mouseup").each(function(pa){var sa=C[pa];oa[sa.sel]=sa.fn;if(sa.isDefault)V=pa;pa=function(Za){var Aa=sa;if(Za.type==="keydown"){var ha=a(Aa.parent+"_show").hasClass("tool_button_current"),eb=a(Aa.parent+"_show").attr("data-curopt");
a.each(n[sa.parent],function(va,Na){if(Na.sel==eb)Aa=!Za.shiftKey||!ha?Na:n[sa.parent][va+1]||n[sa.parent][0]})}if(a(this).hasClass("disabled"))return false;$a(R)&&Aa.fn();var Ra=Aa.icon?a.getSvgIcon(Aa.icon,true):a(Aa.sel).children().eq(0).clone();Ra[0].setAttribute("width",Q.width());Ra[0].setAttribute("height",Q.height());Q.children(":not(.flyout_arrow_horiz)").remove();Q.append(Ra).attr("data-curopt",Aa.sel)};a(this).mouseup(pa);sa.key&&a(document).bind("keydown",sa.key[0]+" shift+"+sa.key[0],