diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 4e7c3be..58455db 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -218,7 +218,7 @@ $.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', { w:27, h:27, id_match: false, - no_img: !svgedit.browser.isWebkit(), // Opera & Firefox 4 gives odd behavior w/images + no_img: true, // Opera & Firefox 4 gives odd behavior w/images fallback_path: curConfig.imgPath, fallback:{ 'logo':'logo.png', diff --git a/editor/svgedit.compiled.js b/editor/svgedit.compiled.js index 514ab00..84a2539 100644 --- a/editor/svgedit.compiled.js +++ b/editor/svgedit.compiled.js @@ -385,76 +385,76 @@ Ra[xa]=ab.getContext("2d")}ab[qa]=ga%3E4;ga=3E4}Ba[qa]=ga;qa=S*v;var Xa=50/qa;Ba xa/1E3+"K";if(Z){ua.fillText(xa,cb+2,8);ua.fillStyle="#777"}else{Ma=(xa+"").split("");for(xa=0;xaga){Ta++;ua.stroke();if(Ta>=Ra.length){xa=10;cb=ha;continue}ua=Ra[Ta];cb-=3E4;yb=Math.round(cb+Ma*xa)+0.5}var Gb=xa%2?12:10;if(Z){ua.moveTo(yb,15);ua.lineTo(yb,Gb)}else{ua.moveTo(15,yb);ua.lineTo(Gb,yb)}}}ua.strokeStyle="#666";ua.stroke()}}(function(){var k=window.opener; if(k)try{var v=k.document.createEvent("Event");v.initEvent("svgEditorReady",true,true);k.document.documentElement.dispatchEvent(v)}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 k=a.deparam.querystring(true);if(!a.isEmptyObject(k)){if(k.dimensions)k.dimensions=k.dimensions.split(",");if(k.extensions)k.extensions=k.extensions.split(",");if(k.bkgd_color)k.bkgd_color= "#"+k.bkgd_color;svgEditor.setConfig(k);var v=k.source,C=a.param.querystring();if(!v)if(C.indexOf("source=data:")>=0)v=C.match(/source=(data:[^&]*)/)[1];if(v)if(v.indexOf("data:")===0){v=v.replace(/ /g,"+");b.loadFromDataURI(v)}else b.loadFromString(v);else if(C.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(C.substr(9));else k.url&&svgEditor.loadFromURL(k.url)}})();var q=function(){a.each(curConfig.extensions,function(){var k=this;a.getScript(curConfig.extPath+k,function(v){if(!v){v=document.createElement("script"); -v.src=curConfig.extPath+k;document.querySelector("head").appendChild(v)}})})};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:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png", -spapelib:"shapelib.png",node_delete:"node_delete.png",align_left:"align-left.png",align_center:"align-center.png",align_right:"align-right.png",align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bottom.png",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_ellipse,#tools_ellipse_show":"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 k=a("#tools_left");if(k.length!=0){k.offset();k.outerHeight()}a(".tools_flyout").each(function(){var v=a("#"+this.id+"_show"),C=v.attr("data-curopt");if(!v.children("svg, img").length){C=a(C).children().clone();if(C.length){C[0].removeAttribute("style");v.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(k){a("#base_unit_container").css({top:k.pageY- -10,left:k.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()});b.canvas=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};q=navigator.platform.indexOf("Mac")>=0;var B=navigator.userAgent.indexOf("AppleWebKit")>= -0,o=q?"meta+":"ctrl+",K=g.pathActions,T=g.undoMgr,O=svgedit.utilities,J=curConfig.imgPath+"placeholder.svg",Q=a("#workarea"),V=a("#cmenu_canvas"),M=null,ia=1,oa="toolbars",fa="";q||a(".shortcut").each(function(){var k=a(this).text();a(this).text(k.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var k=a("#dialog_box"),v=a("#dialog_buttons"),C=function(F,P,U,S){a("#dialog_content").html("

"+P.replace(/\n/g, -"

")+"

").toggleClass("prompt",F=="prompt");v.empty();var Y=a('').appendTo(v);F!="alert"&&a('').appendTo(v).on("click, touchstart",function(){k.hide();U(false)});if(F=="prompt"){var Z=a('').prependTo(v);Z.val(S||"");Z.bind("keydown","return",function(){Y.trigger("click touchstart")})}F=="process"&&Y.hide();k.show();Y.on("click touchstart",function(){k.hide();var ga= -F=="prompt"?Z.val():true;U&&U(ga)}).focus();F=="prompt"&&Z.focus()};a.alert=function(F,P){C("alert",F,P)};a.confirm=function(F,P){C("confirm",F,P)};a.process_cancel=function(F,P){C("process",F,P)};a.prompt=function(F,P,U){C("prompt",F,U,P)}})();var ba=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},X=null,sa= -false,ka=false,da="",W=function(k,v){var C=g.getResolution();a("#svgcanvas").position();var F=g.setBBoxZoom(v,Q.width()-15,Q.height()-15);if(F){var P=F.zoom;F=F.bbox;if(P<0.0010)wa({value:0.1});else{var U=Date.now(),S=P-C.zoom;a("#zoom");var Y=C.zoom,Z=function(ga){ga=(ga-U)/500;ga=Math.pow(ga-1,3)+1;g.setZoom(Y+S*ga);E();if(ga<1)requestAnimationFrame(Z);else{a("#zoom").val(P*100);a("option","#zoom_select").removeAttr("selected");a("option[value="+P*100+"]","#zoom_select").attr("selected","selected")}}; -Z(Date.now());g.getMode()=="zoom"&&F.width&&ba();lb()}}};a("#cur_context_panel").delegate("a","click",function(){var k=a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var aa=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},pa={},ra=function(k){a.each(k,function(v,C){var F=a(v).children(),P=v+"_show",U=a(P),S=false;F.addClass("tool_button").unbind("click mousedown mouseup").each(function(ga){var qa=C[ga];pa[qa.sel]=qa.fn;if(qa.isDefault)S=ga;ga=function(Oa){var Ba= -qa;if(Oa.type==="keydown"){var ha=a(Ba.parent+"_show").hasClass("tool_button_current"),Ta=a(Ba.parent+"_show").attr("data-curopt");a.each(k[qa.parent],function(ua,Ma){if(Ma.sel==Ta)Ba=!Oa.shiftKey||!ha?Ma:k[qa.parent][ua+1]||k[qa.parent][0]})}if(a(this).hasClass("disabled"))return false;$a(P)&&Ba.fn();var Ra=Ba.icon?a.getSvgIcon(Ba.icon,true):a(Ba.sel).children().eq(0).clone();Ra[0].setAttribute("width",U.width());Ra[0].setAttribute("height",U.height());U.children(":not(.flyout_arrow_horiz)").remove(); -U.append(Ra).attr("data-curopt",Ba.sel)};a(this).mouseup(ga);qa.key&&a(document).bind("keydown",qa.key[0]+" shift+"+qa.key[0],ga)});if(S)U.attr("data-curopt",C[S].sel);else U.attr("data-curopt")||U.attr("data-curopt",C[0].sel);var Y,Z=a(P).position();a(v).css({left:Z.left+34,top:Z.top+77});U.mousedown(function(ga){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&$a(P,false);if(U.hasClass("disabled"))return false;var qa=a(v),Oa=Z.left+34, -Ba=qa.width()*-1,ha=qa.data("shown_popop")?200:0;Y=setTimeout(function(){U.data("isLibrary")?qa.css("left",Oa).show():qa.css("left",Ba).show().animate({left:Oa},50);qa.data("shown_popop",true)},ha);ga.preventDefault()}).mouseup(function(){clearTimeout(Y);var ga=a(this).attr("data-curopt");if(U.data("isLibrary")&&a(P.replace("_show","")).is(":visible"))$a(P,true);else $a(P)&&ga in pa&&pa[ga]()})});Aa()},ma=function(k,v){return a("
",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(v)}, -na=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show"),v=k.offset();k=k.outerWidth();a(this).css({left:(v.left+k)*ia,top:v.top})})},Aa=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var v=[];a(this).children().each(function(){v.push(this.title)});k[0].title=v.join(" / ")}})},Fa,Ia=function(k,v,C){var F=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+C+"_color defs *")[0];F={alpha:v};F[k.tagName]= -k}else F=k.indexOf("#")===0?{alpha:v,solidColor:k.substr(1)}:{alpha:v,solidColor:"none"};return new a.jGraduate.Paint(F)},Ca=g.getResolution();if(curConfig.baseUnit!=="px"){Ca.w=svgedit.units.convertUnit(Ca.w)+curConfig.baseUnit;Ca.h=svgedit.units.convertUnit(Ca.h)+curConfig.baseUnit}var Ka=function(k){g.createLayer("background");cur_shape=g.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:Ca.w+2,height:Ca.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:k||"#fff",style:"pointer-events:none"}}); -g.setCurrentLayer("Layer 1");g.setCurrentLayerPosition("1")};document.getElementById("canvas_background")||Ka();document.getElementById("canvas_background").getAttribute("fill");var Na=b.setImageURL=function(k){k||(k=J);g.setImageURL(k);a("#image_url").val(k)},za=function(){var k=X;if(k!=null&&!k.parentNode)k=null;if(sa&&sa[0]!=null&&!sa[0].parentNode)sa=false;var v=g.getCurrentDrawing().getCurrentLayerName(),C=g.getMode(),F=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,P=C=="pathedit";if(P){a(".context_panel").hide(); -a("#path_node_panel").show();a("#stroke_panel").hide();v=K.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!K.canDeleteNodes);Cb("#tool_openclose_path",K.closed_subpath?"open_path":"close_path");if(v){P=a("#seg_type");if(F){v.x=svgedit.units.convertUnit(v.x);v.y=svgedit.units.convertUnit(v.y)}a("#path_node_x").val(Math.round(v.x));a("#path_node_y").val(Math.round(v.y));v.type?P.val(v.type).removeAttr("disabled"): -P.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var U=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(sa){sa=sa.filter(Boolean);(k=g.elementsAreSame(sa)?sa[0]:null)&&a("#tools_top").addClass("multiselected")}if(!k&&!sa){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(k!= -null){a("#stroke_panel").show();var S=k.nodeName,Y=g.getRotationAngle(k);a("#angle").val(Math.round(Y));Y=g.getBlur(k);a("#blur").val(Y);if(!P&&C!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var Z,ga;if(["g","polyline","path"].indexOf(S)>=0)if(C=g.getStrokedBBox([k])){Z=C.x;ga=C.y}if(F){Z=svgedit.units.convertUnit(Z);ga=svgedit.units.convertUnit(ga)}a("#"+S+"_x").val(Math.round(Z));a("#"+S+"_y").val(Math.round(ga));if(S==="polyline"){a("#path_x").val(Math.round(Z)); -a("#path_y").val(Math.round(ga))}["image","text","path","g","use"].indexOf(S)==-1&&a(".action_path_convert_selected").removeClass("disabled");S==="path"&&a(".action_path_selected").removeClass("disabled")}F=null;if(qa==="a"){F=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();F=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!F);F&&a("#link_url").val(F);F={g:[],a:[],rect:["rx","width","height","x","y"],image:["width", -"height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:["x","y"],use:[],path:[]};var qa=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();if(qa=="path"||qa=="polyline")a("#path_panel").show();if(F[qa]){F=F[qa];a("#"+qa+"_panel").show();qa=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(F,function(Oa,Ba){var ha=k.getAttribute(Ba);if(curConfig.baseUnit!=="px"&&k[Ba])ha=svgedit.units.convertUnit(k[Ba].baseVal.value);var Ta= -document.getElementById(qa+"_"+Ba);Ta.value=Math.round(ha)||0;Ta.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(Ta)});if(qa=="text"){F=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",g.getBold());a("#font_family").val(F);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(F.split(",")[0].replace(/'/g, -"")).css("font-family",F);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(qa=="image")Na(g.getHref(k));else if(qa==="g"||qa==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}U[(qa==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(qa==="g"||!sa?"dis":"en")+"ableContextMenuItems"]("#group")}if(sa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k|| -U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(v);V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus", -function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,v){var C=g.getMode();C==="select"&&ba();if(C==="pathedit")return za();X=v.length==1||v[1]==null?v[0]:null;v=v.filter(Boolean);sa=v.length>=2?v:false;if(g.elementsAreSame(sa))X=sa[0];if(X!=null){a("#multiselected_panel").hide();if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":C=null;for(var F=X.getElementsByTagName("*"),P=0,U=F.length;P=2&&v[1]!=null?v:null;if(!sa)switch(C){case "rotate":C=g.getRotationAngle(F);a("#angle").val(Math.round(C));rotateCursor(C);a("#tool_reorient").toggleClass("disabled",C==0)}g.runExtensions("elementTransition",{elems:v})}});g.bind("changed",function(k,v){var C=g.getMode();C==="select"&&ba();for(var F=0;F\n'+v;var C=navigator.userAgent;if(~C.indexOf("Chrome")&&a.browser.version>=533||~C.indexOf("MSIE"))Qb(0,true);else{var F=k.open("data:image/svg+xml;base64,"+O.encode64(v)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s", -"SVG");if(C.indexOf("Gecko/")!==-1)if(v.indexOf("",{id:"export_canvas"}).hide().appendTo("body");var F=a("#export_canvas")[0];F.width=g.contentW;F.height=g.contentH;canvg(F,v.svg,{renderCallback:function(){var P= -F.toDataURL("image/png");M.location.href=P;if(a.pref("export_notice_done")!=="all"){P=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(C.length)P+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+C.join("\n \u2022 ");a.pref("export_notice_done","all");M.alert(P)}}})});g.bind("zoomed",W);g.bind("contextset",function(k,v){var C="";if(v){var F="";C=''+g.getCurrentDrawing().getCurrentLayerName()+"";a(v).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){F+= -" > "+this.id;C+=this!==v?' > '+this.id+"":" > "+this.id}});da=F}else da=null;a("#cur_context_panel").toggle(!!v).html(C)});g.bind("extension_added",function(k,v){function C(){if(Fa){clearTimeout(Fa);Fa=null}P||(Fa=setTimeout(function(){P=true;e(s.iconsize)},50))}var F=false,P=false,U=true,S=function(){if(v.callback&&!F&&U){F=true;v.callback()}},Y=[];v.context_tools&&a.each(v.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length|| -(Ra=a("
",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ua='
'+ha.id+"
",Ma=a(ua).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ua="";var xa=a(ua).appendTo(Ra).find("select");a.each(ha.events,function(Xa, -cb){a(xa).bind(Xa,cb)});break;case "button-select":ua='';Ta=a('
    ').appendTo("#option_lists");ha.colnum&&Ta.addClass("optcols"+ha.colnum);a(ua).appendTo(Ra).children();Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ua="'+ -ha.label+':';var ab=a(ua).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,cb){ab.bind(Xa,cb)})}});if(v.buttons){var Z={},ga={},qa=v.svgicons,Oa={};a.each(v.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ua=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ua;if(qa){Z[Ra]=ha.icon;ua=ha.svgicon?ha.svgicon:ha.id;if(ha.type=="app_menu")ga["#"+ -Ra+" > div"]=ua;else ga["#"+Ra]=ua}else Ta=ha.type=="menu"?"":a('');var Ma,xa;switch(ha.type){case "mode_flyout":case "mode":Ma="tool_button";if(ha.cls)Ma+=" "+ha.cls;xa="#tools_left";break;case "context":Ma="tool_button";xa="#"+ha.panel;a(xa).length||a("
    ",{id:ha.panel}).appendTo("#tools_top");break;case "menu":Ma="menu_item tool_button";xa="#"+(ha.after||ha.panel);break;case "app_menu":Ma="";xa=ha.parent||"#main_menu ul";a(xa).length||a("
    ",{id:ha.panel}).appendTo("#tools_top")}var ab= -a(ha.list||ha.type=="app_menu"?"
  • ":"
    ").attr("id",Ra).attr("title",ha.title).addClass(Ma);if(!ha.includeWith&&!ha.list){if("position"in ha)a(xa).children().eq(ha.position).before(ab);else ha.type!="menu"||!ha.after?ab.appendTo(xa):a(xa).after(ab);if(ha.type=="mode_flyout"){ua=a(ab);Ma=ua.parent();if(!ua.parent().hasClass("tools_flyout")){var Xa=ua[0].id.replace("tool_","tools_"),cb=ua.clone().attr("id",Xa+"_show").append(a("
    ",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua); -Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button");a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+ha.list).append(ab.children().clone());ua=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ua}}else if(ha.includeWith){xa=ha.includeWith;ua=a(xa.button);Ma=ua.parent();if(!ua.parent().hasClass("tools_flyout")){Xa= -ua[0].id.replace("tool_","tools_");cb=ua.clone().attr("id",Xa+"_show").append(a("
    ",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua)}var Hb=u.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key,isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa
    '});a("#palette").append(ya);var Ha=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k="rotate("+k+"deg)";Ha.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var v=k.value/100;if(v<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(Q[0].scrollLeft+Q.width()/2)/k,y:(Q[0].scrollTop+Q.height()/ -2)/k,zoom:v},true)}},qb=function(){window.opera&&a("

    ").hide().appendTo("body").remove()};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);qb()});a("#seg_type").change(function(){g.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)}); -changeAttribute=function(k){var v=k.getAttribute("data-attr"),C=k.getAttribute("data-multiplier")||1;C=parseFloat(C);C=k.value*C;if(!svgedit.units.isValidUnit(v,C,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(v);return false}g.changeSelectedAttributeNoUndo(v,C)};a("#palette").mouseover(function(){var k=a('');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"), -v=k?"stroke":"fill",C=a(this).attr("data-rgb"),F=null;if(C==="transparent"||C==="initial"||C==="#none"){C="none";F=new a.jGraduate.Paint}else F=new a.jGraduate.Paint({alpha:100,solidColor:C.substr(1)});b.paintBox[v].setPaint(F);if(k){g.setColor("stroke",C);C!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display", -"table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,v){if(a(k).hasClass("disabled"))return false;if(a(k).parent().hasClass("tools_flyout"))return true;var C=C||"normal";v||a(".tools_flyout").fadeOut(C);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k= -null,v=null,C=Q[0],F=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(F!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-v;k=U.clientX;v=U.clientY;if(U.type==="mouseup"||U.type==="touchend")F=false;return false}}).on("mousedown touchmove",function(U){if(U.button===1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){F=true;k=U.clientX;v=U.clientY;return false}});a(window).mouseup(function(){F=false;a("body").removeClass("dragging")});a(document).bind("keydown", -"space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()==="zoom"&&Q.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&Q.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background= -"#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")}); -var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(k,v,C,F){if(k.altKey){k.preventDefault();k=g.getZoom()*100;v=Sa.length;for(D=0;D0)zoom=Sa[D]<=k?Sa[C]:zoom;if(F<0)zoom=Sa[D]"+k+"

    "+k+"

    ")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},xb=function(){g.open()},Ib=function(){},pb=function(k){var v=k.prev();v.css("background","#09f");setTimeout(function(){v.css("background","")},200)},hb=function(){if(T.getUndoStackSize()> -0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"), -v=document.querySelector("#tool_fill rect"),C=v.getAttribute("fill"),F=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;v=parseFloat(v.getAttribute("fill-opacity"));if(isNaN(v))v=100;F=Ia(F,k,"stroke");C=Ia(C,v,"fill");b.paintBox.fill.setPaint(F,true);b.paintBox.stroke.setPaint(C,true)},Db=function(k){var v=g.getResolution();k=k?v.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();E(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"): -a("#tool_wireframe").removeClass("push_button_pressed");Q.toggleClass("wireframe");if(!H){var k=a("#wireframe_rules");k.length?k.empty():a('').appendTo("head");lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exit_fullscreen()},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed"); -a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(Q.hasClass("wireframe")?k:"")}},Qb=function(k,v){if(!ka){ka=true;a("#save_output_btns").toggle(!!v);a("#tool_source_back").toggle(!v);var C= -fa=g.getSvgString();a("#svg_source_textarea").val(C);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();aa()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();aa()});ba()}},Cb=b.setIcon=function(k,v){var C=typeof v==="string"?a.getSvgIcon(v,true):v.clone();C?a(k).find("img").replaceWith(C):console.log("NOTE: Icon image missing: "+ -v)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,v=document.getElementsByTagName("script")[0],C;for(C in v.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in v.style)return"Webkit";if("KhtmlOpacity"in v.style)return"Khtml";return""}();var Mb=function(k,v){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var F=a(this),P=F.outerWidth()*(v-1),U=F.outerHeight()*(v-1),S=0;S<4;S++){var Y=C[S],Z=F.data("orig_margin-"+Y);if(Z==null){Z=parseInt(F.css("margin-"+ -Y));F.data("orig_margin-"+Y,Z)}Z=Z*v;if(Y==="right")Z+=P;else if(Y==="bottom")Z+=U;F.css("margin-"+Y,Z)}})},e=b.setIconSize=function(k,v){if(!(k==s.size&&!v)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),F=1;F=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=ia=F;na();var P=C.parents(":hidden");P.css("visibility","hidden").show(); -Mb(C,F);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,Y){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(Y,function(Z,ga){if(typeof ga==="number")var qa=ga*F+"px";else if(ga[k]||ga.all)qa=ga[k]||ga.all;U+=Z+":"+qa+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+ +v.src=curConfig.extPath+k;document.querySelector("head").appendChild(v)}})})};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:true,fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",spapelib:"shapelib.png", +node_delete:"node_delete.png",align_left:"align-left.png",align_center:"align-center.png",align_right:"align-right.png",align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bottom.png",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_ellipse,#tools_ellipse_show":"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 k=a("#tools_left");if(k.length!=0){k.offset();k.outerHeight()}a(".tools_flyout").each(function(){var v= +a("#"+this.id+"_show"),C=v.attr("data-curopt");if(!v.children("svg, img").length){C=a(C).children().clone();if(C.length){C[0].removeAttribute("style");v.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(k){a("#base_unit_container").css({top:k.pageY-10,left:k.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()});b.canvas=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};q=navigator.platform.indexOf("Mac")>=0;var B=navigator.userAgent.indexOf("AppleWebKit")>=0,o=q?"meta+":"ctrl+",K=g.pathActions,T=g.undoMgr,O=svgedit.utilities,J=curConfig.imgPath+ +"placeholder.svg",Q=a("#workarea"),V=a("#cmenu_canvas"),M=null,ia=1,oa="toolbars",fa="";q||a(".shortcut").each(function(){var k=a(this).text();a(this).text(k.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var k=a("#dialog_box"),v=a("#dialog_buttons"),C=function(F,P,U,S){a("#dialog_content").html("

    "+P.replace(/\n/g,"

    ")+"

    ").toggleClass("prompt",F=="prompt");v.empty();var Y=a('').appendTo(v);F!="alert"&&a('').appendTo(v).on("click, touchstart",function(){k.hide();U(false)});if(F=="prompt"){var Z=a('').prependTo(v);Z.val(S||"");Z.bind("keydown","return",function(){Y.trigger("click touchstart")})}F=="process"&&Y.hide();k.show();Y.on("click touchstart",function(){k.hide();var ga=F=="prompt"?Z.val():true;U&&U(ga)}).focus();F=="prompt"&&Z.focus()};a.alert=function(F,P){C("alert", +F,P)};a.confirm=function(F,P){C("confirm",F,P)};a.process_cancel=function(F,P){C("process",F,P)};a.prompt=function(F,P,U){C("prompt",F,U,P)}})();var ba=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},X=null,sa=false,ka=false,da="",W=function(k,v){var C=g.getResolution();a("#svgcanvas").position();var F=g.setBBoxZoom(v, +Q.width()-15,Q.height()-15);if(F){var P=F.zoom;F=F.bbox;if(P<0.0010)wa({value:0.1});else{var U=Date.now(),S=P-C.zoom;a("#zoom");var Y=C.zoom,Z=function(ga){ga=(ga-U)/500;ga=Math.pow(ga-1,3)+1;g.setZoom(Y+S*ga);E();if(ga<1)requestAnimationFrame(Z);else{a("#zoom").val(P*100);a("option","#zoom_select").removeAttr("selected");a("option[value="+P*100+"]","#zoom_select").attr("selected","selected")}};Z(Date.now());g.getMode()=="zoom"&&F.width&&ba();lb()}}};a("#cur_context_panel").delegate("a","click",function(){var k= +a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var aa=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},pa={},ra=function(k){a.each(k,function(v,C){var F=a(v).children(),P=v+"_show",U=a(P),S=false;F.addClass("tool_button").unbind("click mousedown mouseup").each(function(ga){var qa=C[ga];pa[qa.sel]=qa.fn;if(qa.isDefault)S=ga;ga=function(Oa){var Ba=qa;if(Oa.type==="keydown"){var ha=a(Ba.parent+"_show").hasClass("tool_button_current"),Ta=a(Ba.parent+"_show").attr("data-curopt"); +a.each(k[qa.parent],function(ua,Ma){if(Ma.sel==Ta)Ba=!Oa.shiftKey||!ha?Ma:k[qa.parent][ua+1]||k[qa.parent][0]})}if(a(this).hasClass("disabled"))return false;$a(P)&&Ba.fn();var Ra=Ba.icon?a.getSvgIcon(Ba.icon,true):a(Ba.sel).children().eq(0).clone();Ra[0].setAttribute("width",U.width());Ra[0].setAttribute("height",U.height());U.children(":not(.flyout_arrow_horiz)").remove();U.append(Ra).attr("data-curopt",Ba.sel)};a(this).mouseup(ga);qa.key&&a(document).bind("keydown",qa.key[0]+" shift+"+qa.key[0], +ga)});if(S)U.attr("data-curopt",C[S].sel);else U.attr("data-curopt")||U.attr("data-curopt",C[0].sel);var Y,Z=a(P).position();a(v).css({left:Z.left+34,top:Z.top+77});U.mousedown(function(ga){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&$a(P,false);if(U.hasClass("disabled"))return false;var qa=a(v),Oa=Z.left+34,Ba=qa.width()*-1,ha=qa.data("shown_popop")?200:0;Y=setTimeout(function(){U.data("isLibrary")?qa.css("left",Oa).show():qa.css("left", +Ba).show().animate({left:Oa},50);qa.data("shown_popop",true)},ha);ga.preventDefault()}).mouseup(function(){clearTimeout(Y);var ga=a(this).attr("data-curopt");if(U.data("isLibrary")&&a(P.replace("_show","")).is(":visible"))$a(P,true);else $a(P)&&ga in pa&&pa[ga]()})});Aa()},ma=function(k,v){return a("
    ",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(v)},na=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show"),v=k.offset();k=k.outerWidth();a(this).css({left:(v.left+ +k)*ia,top:v.top})})},Aa=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var v=[];a(this).children().each(function(){v.push(this.title)});k[0].title=v.join(" / ")}})},Fa,Ia=function(k,v,C){var F=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+C+"_color defs *")[0];F={alpha:v};F[k.tagName]=k}else F=k.indexOf("#")===0?{alpha:v,solidColor:k.substr(1)}:{alpha:v,solidColor:"none"};return new a.jGraduate.Paint(F)},Ca=g.getResolution(); +if(curConfig.baseUnit!=="px"){Ca.w=svgedit.units.convertUnit(Ca.w)+curConfig.baseUnit;Ca.h=svgedit.units.convertUnit(Ca.h)+curConfig.baseUnit}var Ka=function(k){g.createLayer("background");cur_shape=g.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:Ca.w+2,height:Ca.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:k||"#fff",style:"pointer-events:none"}});g.setCurrentLayer("Layer 1");g.setCurrentLayerPosition("1")};document.getElementById("canvas_background")||Ka();document.getElementById("canvas_background").getAttribute("fill"); +var Na=b.setImageURL=function(k){k||(k=J);g.setImageURL(k);a("#image_url").val(k)},za=function(){var k=X;if(k!=null&&!k.parentNode)k=null;if(sa&&sa[0]!=null&&!sa[0].parentNode)sa=false;var v=g.getCurrentDrawing().getCurrentLayerName(),C=g.getMode(),F=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,P=C=="pathedit";if(P){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide();v=K.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button"); +a("#tool_node_delete").toggleClass("disabled",!K.canDeleteNodes);Cb("#tool_openclose_path",K.closed_subpath?"open_path":"close_path");if(v){P=a("#seg_type");if(F){v.x=svgedit.units.convertUnit(v.x);v.y=svgedit.units.convertUnit(v.y)}a("#path_node_x").val(Math.round(v.x));a("#path_node_y").val(Math.round(v.y));v.type?P.val(v.type).removeAttr("disabled"):P.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var U=a("#cmenu_canvas li"); +a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(sa){sa=sa.filter(Boolean);(k=g.elementsAreSame(sa)?sa[0]:null)&&a("#tools_top").addClass("multiselected")}if(!k&&!sa){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(k!=null){a("#stroke_panel").show();var S=k.nodeName,Y=g.getRotationAngle(k);a("#angle").val(Math.round(Y));Y=g.getBlur(k);a("#blur").val(Y);if(!P&&C!="pathedit"){a("#selected_panel").show(); +a(".action_selected").removeClass("disabled");var Z,ga;if(["g","polyline","path"].indexOf(S)>=0)if(C=g.getStrokedBBox([k])){Z=C.x;ga=C.y}if(F){Z=svgedit.units.convertUnit(Z);ga=svgedit.units.convertUnit(ga)}a("#"+S+"_x").val(Math.round(Z));a("#"+S+"_y").val(Math.round(ga));if(S==="polyline"){a("#path_x").val(Math.round(Z));a("#path_y").val(Math.round(ga))}["image","text","path","g","use"].indexOf(S)==-1&&a(".action_path_convert_selected").removeClass("disabled");S==="path"&&a(".action_path_selected").removeClass("disabled")}F= +null;if(qa==="a"){F=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();F=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!F);F&&a("#link_url").val(F);F={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:["x","y"],use:[],path:[]};var qa=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();if(qa=="path"||qa== +"polyline")a("#path_panel").show();if(F[qa]){F=F[qa];a("#"+qa+"_panel").show();qa=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(F,function(Oa,Ba){var ha=k.getAttribute(Ba);if(curConfig.baseUnit!=="px"&&k[Ba])ha=svgedit.units.convertUnit(k[Ba].baseVal.value);var Ta=document.getElementById(qa+"_"+Ba);Ta.value=Math.round(ha)||0;Ta.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(Ta)});if(qa=="text"){F=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex= +3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",g.getBold());a("#font_family").val(F);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(F.split(",")[0].replace(/'/g,"")).css("font-family",F);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(qa=="image")Na(g.getHref(k));else if(qa==="g"||qa==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled"); +g.getTitle()}}U[(qa==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(qa==="g"||!sa?"dis":"en")+"ableContextMenuItems"]("#group")}if(sa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k||U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled"); +T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(v);V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,v){var C=g.getMode();C==="select"&&ba();if(C==="pathedit")return za();X=v.length==1||v[1]==null?v[0]:null;v=v.filter(Boolean);sa= +v.length>=2?v:false;if(g.elementsAreSame(sa))X=sa[0];if(X!=null){a("#multiselected_panel").hide();if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":C=null;for(var F=X.getElementsByTagName("*"),P=0,U=F.length;P=2&&v[1]!=null?v:null;if(!sa)switch(C){case "rotate":C=g.getRotationAngle(F); +a("#angle").val(Math.round(C));rotateCursor(C);a("#tool_reorient").toggleClass("disabled",C==0)}g.runExtensions("elementTransition",{elems:v})}});g.bind("changed",function(k,v){var C=g.getMode();C==="select"&&ba();for(var F=0;F=533||~C.indexOf("MSIE"))Qb(0,true);else{var F=k.open("data:image/svg+xml;base64,"+O.encode64(v)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(C.indexOf("Gecko/")!==-1)if(v.indexOf("",{id:"export_canvas"}).hide().appendTo("body");var F=a("#export_canvas")[0];F.width=g.contentW;F.height=g.contentH;canvg(F,v.svg,{renderCallback:function(){var P=F.toDataURL("image/png");M.location.href=P;if(a.pref("export_notice_done")!=="all"){P=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(C.length)P+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+ +C.join("\n \u2022 ");a.pref("export_notice_done","all");M.alert(P)}}})});g.bind("zoomed",W);g.bind("contextset",function(k,v){var C="";if(v){var F="";C=''+g.getCurrentDrawing().getCurrentLayerName()+"";a(v).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){F+=" > "+this.id;C+=this!==v?' > '+this.id+"":" > "+this.id}});da=F}else da=null;a("#cur_context_panel").toggle(!!v).html(C)});g.bind("extension_added",function(k,v){function C(){if(Fa){clearTimeout(Fa); +Fa=null}P||(Fa=setTimeout(function(){P=true;e(s.iconsize)},50))}var F=false,P=false,U=true,S=function(){if(v.callback&&!F&&U){F=true;v.callback()}},Y=[];v.context_tools&&a.each(v.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("
    ",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ua='
    '+ha.id+"
    ",Ma=a(ua).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa, +cb)});break;case "select":ua="";var xa=a(ua).appendTo(Ra).find("select");a.each(ha.events,function(Xa,cb){a(xa).bind(Xa,cb)});break;case "button-select":ua='';Ta=a('
      ').appendTo("#option_lists"); +ha.colnum&&Ta.addClass("optcols"+ha.colnum);a(ua).appendTo(Ra).children();Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ua="'+ha.label+':';var ab=a(ua).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa, +cb){ab.bind(Xa,cb)})}});if(v.buttons){var Z={},ga={},qa=v.svgicons,Oa={};a.each(v.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ua=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ua;if(qa){Z[Ra]=ha.icon;ua=ha.svgicon?ha.svgicon:ha.id;if(ha.type=="app_menu")ga["#"+Ra+" > div"]=ua;else ga["#"+Ra]=ua}else Ta=ha.type=="menu"?"":a('');var Ma,xa;switch(ha.type){case "mode_flyout":case "mode":Ma="tool_button";if(ha.cls)Ma+=" "+ha.cls;xa="#tools_left";break;case "context":Ma="tool_button";xa="#"+ +ha.panel;a(xa).length||a("
      ",{id:ha.panel}).appendTo("#tools_top");break;case "menu":Ma="menu_item tool_button";xa="#"+(ha.after||ha.panel);break;case "app_menu":Ma="";xa=ha.parent||"#main_menu ul";a(xa).length||a("
      ",{id:ha.panel}).appendTo("#tools_top")}var ab=a(ha.list||ha.type=="app_menu"?"
    • ":"
      ").attr("id",Ra).attr("title",ha.title).addClass(Ma);if(!ha.includeWith&&!ha.list){if("position"in ha)a(xa).children().eq(ha.position).before(ab);else ha.type!="menu"||!ha.after?ab.appendTo(xa): +a(xa).after(ab);if(ha.type=="mode_flyout"){ua=a(ab);Ma=ua.parent();if(!ua.parent().hasClass("tools_flyout")){var Xa=ua[0].id.replace("tool_","tools_"),cb=ua.clone().attr("id",Xa+"_show").append(a("
      ",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua);Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button"); +a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+ha.list).append(ab.children().clone());ua=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ua}}else if(ha.includeWith){xa=ha.includeWith;ua=a(xa.button);Ma=ua.parent();if(!ua.parent().hasClass("tools_flyout")){Xa=ua[0].id.replace("tool_","tools_");cb=ua.clone().attr("id",Xa+"_show").append(a("
      ",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua)}var Hb=u.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+ +Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key,isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa
      '});a("#palette").append(ya);var Ha=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k= +"rotate("+k+"deg)";Ha.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var v=k.value/100;if(v<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(Q[0].scrollLeft+Q.width()/2)/k,y:(Q[0].scrollTop+Q.height()/2)/k,zoom:v},true)}},qb=function(){window.opera&&a("

      ").hide().appendTo("body").remove()};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text); +qb()});a("#seg_type").change(function(){g.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});changeAttribute=function(k){var v=k.getAttribute("data-attr"),C=k.getAttribute("data-multiplier")||1;C=parseFloat(C);C=k.value*C;if(!svgedit.units.isValidUnit(v,C,X)){a.alert(uiStrings.notification.invalidAttrValGiven); +k.value=X.getAttribute(v);return false}g.changeSelectedAttributeNoUndo(v,C)};a("#palette").mouseover(function(){var k=a('');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"),v=k?"stroke":"fill",C=a(this).attr("data-rgb"),F=null;if(C==="transparent"||C==="initial"||C==="#none"){C="none";F=new a.jGraduate.Paint}else F=new a.jGraduate.Paint({alpha:100,solidColor:C.substr(1)});b.paintBox[v].setPaint(F); +if(k){g.setColor("stroke",C);C!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,v){if(a(k).hasClass("disabled"))return false; +if(a(k).parent().hasClass("tools_flyout"))return true;var C=C||"normal";v||a(".tools_flyout").fadeOut(C);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=null,v=null,C=Q[0],F=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(F!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-v;k=U.clientX;v=U.clientY; +if(U.type==="mouseup"||U.type==="touchend")F=false;return false}}).on("mousedown touchmove",function(U){if(U.button===1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){F=true;k=U.clientX;v=U.clientY;return false}});a(window).mouseup(function(){F=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()=== +"zoom"&&Q.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&Q.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart", +function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(k,v,C,F){if(k.altKey){k.preventDefault();k=g.getZoom()*100;v=Sa.length;for(D=0;D0)zoom=Sa[D]<=k?Sa[C]:zoom;if(F<0)zoom=Sa[D]"+k+"

      "+k+"

      ")}window.canvg? +g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},xb=function(){g.open()},Ib=function(){},pb=function(k){var v=k.prev();v.css("background","#09f");setTimeout(function(){v.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.redo()}},Kb=function(){if(sa)g.groupSelectedElements(); +else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),v=document.querySelector("#tool_fill rect"),C=v.getAttribute("fill"),F=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;v=parseFloat(v.getAttribute("fill-opacity")); +if(isNaN(v))v=100;F=Ia(F,k,"stroke");C=Ia(C,v,"fill");b.paintBox.fill.setPaint(F,true);b.paintBox.stroke.setPaint(C,true)},Db=function(k){var v=g.getResolution();k=k?v.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();E(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");Q.toggleClass("wireframe");if(!H){var k=a("#wireframe_rules");k.length?k.empty():a('').appendTo("head"); +lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exit_fullscreen()},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed"); +a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(Q.hasClass("wireframe")?k:"")}},Qb=function(k,v){if(!ka){ka=true;a("#save_output_btns").toggle(!!v);a("#tool_source_back").toggle(!v);var C=fa=g.getSvgString();a("#svg_source_textarea").val(C);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}}, +Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();aa()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();aa()});ba()}},Cb=b.setIcon=function(k,v){var C=typeof v==="string"?a.getSvgIcon(v,true):v.clone();C?a(k).find("img").replaceWith(C):console.log("NOTE: Icon image missing: "+v)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,v=document.getElementsByTagName("script")[0], +C;for(C in v.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in v.style)return"Webkit";if("KhtmlOpacity"in v.style)return"Khtml";return""}();var Mb=function(k,v){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var F=a(this),P=F.outerWidth()*(v-1),U=F.outerHeight()*(v-1),S=0;S<4;S++){var Y=C[S],Z=F.data("orig_margin-"+Y);if(Z==null){Z=parseInt(F.css("margin-"+Y));F.data("orig_margin-"+Y,Z)}Z=Z*v;if(Y==="right")Z+=P;else if(Y==="bottom")Z+=U;F.css("margin-"+Y, +Z)}})},e=b.setIconSize=function(k,v){if(!(k==s.size&&!v)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),F=1;F=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=ia=F;na();var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,F);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty(); +else C=a('').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,Y){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(Y,function(Z,ga){if(typeof ga==="number")var qa=ga*F+"px";else if(ga[k]||ga.all)qa=ga[k]||ga.all;U+=Z+":"+qa+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+ P+"transform: scale("+F+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/F+");}";C.text(U)}na()}},h=function(){a("#dialog_box").hide();if(ka){if(ka)fa!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&m()}):m();z()}else da&&g.leaveContext()},m=function(){a("#svg_source_editor").hide();ka=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height(); var z=a.noop;a(window).resize(function(){E()});(function(){Q.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=Q[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=Q[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(v){v&&Na(v)})});var w=function(k){var v=k[0].id=="stroke_color"?"stroke": "fill",C=k[0].id=="canvas_color";if(C)v="canvas";var F=b.paintBox[v].paint;k=v=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).removeAttr("style").css(C).jGraduate({paint:F,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){F=new a.jGraduate.Paint(P);b.paintBox[v].setPaint(F); diff --git a/editor/svgicons/jquery.svgicons.js b/editor/svgicons/jquery.svgicons.js index 1f7ef67..18c647c 100644 --- a/editor/svgicons/jquery.svgicons.js +++ b/editor/svgicons/jquery.svgicons.js @@ -376,19 +376,6 @@ $(function() { var old_val = 'url(#' + id + ')'; var new_val = 'url(#' + new_id + ')'; - - // Selector method, possibly faster but fails in Opera / jQuery 1.4.3 -// svg_el.find('[fill="url(#' + id + ')"]').each(function() { -// this.setAttribute('fill', 'url(#' + new_id + ')'); -// }).end().find('[stroke="url(#' + id + ')"]').each(function() { -// this.setAttribute('stroke', 'url(#' + new_id + ')'); -// }).end().find('use').each(function() { -// if(this.getAttribute('xlink:href') == '#' + id) { -// this.setAttributeNS(xlinkns,'href','#' + new_id); -// } -// }).end().find('[filter="url(#' + id + ')"]').each(function() { -// this.setAttribute('filter', 'url(#' + new_id + ')'); -// }); for(var i = 0; i < len; i++) { var elem = all_elems[i]; diff --git a/method-draw/svg-editor.js b/method-draw/svg-editor.js index 4e7c3be..58455db 100644 --- a/method-draw/svg-editor.js +++ b/method-draw/svg-editor.js @@ -218,7 +218,7 @@ $.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', { w:27, h:27, id_match: false, - no_img: !svgedit.browser.isWebkit(), // Opera & Firefox 4 gives odd behavior w/images + no_img: true, // Opera & Firefox 4 gives odd behavior w/images fallback_path: curConfig.imgPath, fallback:{ 'logo':'logo.png', diff --git a/method-draw/svgedit.compiled.js b/method-draw/svgedit.compiled.js index 514ab00..84a2539 100644 --- a/method-draw/svgedit.compiled.js +++ b/method-draw/svgedit.compiled.js @@ -385,76 +385,76 @@ Ra[xa]=ab.getContext("2d")}ab[qa]=ga%3E4;ga=3E4}Ba[qa]=ga;qa=S*v;var Xa=50/qa;Ba xa/1E3+"K";if(Z){ua.fillText(xa,cb+2,8);ua.fillStyle="#777"}else{Ma=(xa+"").split("");for(xa=0;xaga){Ta++;ua.stroke();if(Ta>=Ra.length){xa=10;cb=ha;continue}ua=Ra[Ta];cb-=3E4;yb=Math.round(cb+Ma*xa)+0.5}var Gb=xa%2?12:10;if(Z){ua.moveTo(yb,15);ua.lineTo(yb,Gb)}else{ua.moveTo(15,yb);ua.lineTo(Gb,yb)}}}ua.strokeStyle="#666";ua.stroke()}}(function(){var k=window.opener; if(k)try{var v=k.document.createEvent("Event");v.initEvent("svgEditorReady",true,true);k.document.documentElement.dispatchEvent(v)}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 k=a.deparam.querystring(true);if(!a.isEmptyObject(k)){if(k.dimensions)k.dimensions=k.dimensions.split(",");if(k.extensions)k.extensions=k.extensions.split(",");if(k.bkgd_color)k.bkgd_color= "#"+k.bkgd_color;svgEditor.setConfig(k);var v=k.source,C=a.param.querystring();if(!v)if(C.indexOf("source=data:")>=0)v=C.match(/source=(data:[^&]*)/)[1];if(v)if(v.indexOf("data:")===0){v=v.replace(/ /g,"+");b.loadFromDataURI(v)}else b.loadFromString(v);else if(C.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(C.substr(9));else k.url&&svgEditor.loadFromURL(k.url)}})();var q=function(){a.each(curConfig.extensions,function(){var k=this;a.getScript(curConfig.extPath+k,function(v){if(!v){v=document.createElement("script"); -v.src=curConfig.extPath+k;document.querySelector("head").appendChild(v)}})})};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:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png", -spapelib:"shapelib.png",node_delete:"node_delete.png",align_left:"align-left.png",align_center:"align-center.png",align_right:"align-right.png",align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bottom.png",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_ellipse,#tools_ellipse_show":"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 k=a("#tools_left");if(k.length!=0){k.offset();k.outerHeight()}a(".tools_flyout").each(function(){var v=a("#"+this.id+"_show"),C=v.attr("data-curopt");if(!v.children("svg, img").length){C=a(C).children().clone();if(C.length){C[0].removeAttribute("style");v.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(k){a("#base_unit_container").css({top:k.pageY- -10,left:k.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()});b.canvas=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};q=navigator.platform.indexOf("Mac")>=0;var B=navigator.userAgent.indexOf("AppleWebKit")>= -0,o=q?"meta+":"ctrl+",K=g.pathActions,T=g.undoMgr,O=svgedit.utilities,J=curConfig.imgPath+"placeholder.svg",Q=a("#workarea"),V=a("#cmenu_canvas"),M=null,ia=1,oa="toolbars",fa="";q||a(".shortcut").each(function(){var k=a(this).text();a(this).text(k.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var k=a("#dialog_box"),v=a("#dialog_buttons"),C=function(F,P,U,S){a("#dialog_content").html("

      "+P.replace(/\n/g, -"

      ")+"

      ").toggleClass("prompt",F=="prompt");v.empty();var Y=a('').appendTo(v);F!="alert"&&a('').appendTo(v).on("click, touchstart",function(){k.hide();U(false)});if(F=="prompt"){var Z=a('').prependTo(v);Z.val(S||"");Z.bind("keydown","return",function(){Y.trigger("click touchstart")})}F=="process"&&Y.hide();k.show();Y.on("click touchstart",function(){k.hide();var ga= -F=="prompt"?Z.val():true;U&&U(ga)}).focus();F=="prompt"&&Z.focus()};a.alert=function(F,P){C("alert",F,P)};a.confirm=function(F,P){C("confirm",F,P)};a.process_cancel=function(F,P){C("process",F,P)};a.prompt=function(F,P,U){C("prompt",F,U,P)}})();var ba=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},X=null,sa= -false,ka=false,da="",W=function(k,v){var C=g.getResolution();a("#svgcanvas").position();var F=g.setBBoxZoom(v,Q.width()-15,Q.height()-15);if(F){var P=F.zoom;F=F.bbox;if(P<0.0010)wa({value:0.1});else{var U=Date.now(),S=P-C.zoom;a("#zoom");var Y=C.zoom,Z=function(ga){ga=(ga-U)/500;ga=Math.pow(ga-1,3)+1;g.setZoom(Y+S*ga);E();if(ga<1)requestAnimationFrame(Z);else{a("#zoom").val(P*100);a("option","#zoom_select").removeAttr("selected");a("option[value="+P*100+"]","#zoom_select").attr("selected","selected")}}; -Z(Date.now());g.getMode()=="zoom"&&F.width&&ba();lb()}}};a("#cur_context_panel").delegate("a","click",function(){var k=a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var aa=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},pa={},ra=function(k){a.each(k,function(v,C){var F=a(v).children(),P=v+"_show",U=a(P),S=false;F.addClass("tool_button").unbind("click mousedown mouseup").each(function(ga){var qa=C[ga];pa[qa.sel]=qa.fn;if(qa.isDefault)S=ga;ga=function(Oa){var Ba= -qa;if(Oa.type==="keydown"){var ha=a(Ba.parent+"_show").hasClass("tool_button_current"),Ta=a(Ba.parent+"_show").attr("data-curopt");a.each(k[qa.parent],function(ua,Ma){if(Ma.sel==Ta)Ba=!Oa.shiftKey||!ha?Ma:k[qa.parent][ua+1]||k[qa.parent][0]})}if(a(this).hasClass("disabled"))return false;$a(P)&&Ba.fn();var Ra=Ba.icon?a.getSvgIcon(Ba.icon,true):a(Ba.sel).children().eq(0).clone();Ra[0].setAttribute("width",U.width());Ra[0].setAttribute("height",U.height());U.children(":not(.flyout_arrow_horiz)").remove(); -U.append(Ra).attr("data-curopt",Ba.sel)};a(this).mouseup(ga);qa.key&&a(document).bind("keydown",qa.key[0]+" shift+"+qa.key[0],ga)});if(S)U.attr("data-curopt",C[S].sel);else U.attr("data-curopt")||U.attr("data-curopt",C[0].sel);var Y,Z=a(P).position();a(v).css({left:Z.left+34,top:Z.top+77});U.mousedown(function(ga){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&$a(P,false);if(U.hasClass("disabled"))return false;var qa=a(v),Oa=Z.left+34, -Ba=qa.width()*-1,ha=qa.data("shown_popop")?200:0;Y=setTimeout(function(){U.data("isLibrary")?qa.css("left",Oa).show():qa.css("left",Ba).show().animate({left:Oa},50);qa.data("shown_popop",true)},ha);ga.preventDefault()}).mouseup(function(){clearTimeout(Y);var ga=a(this).attr("data-curopt");if(U.data("isLibrary")&&a(P.replace("_show","")).is(":visible"))$a(P,true);else $a(P)&&ga in pa&&pa[ga]()})});Aa()},ma=function(k,v){return a("
      ",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(v)}, -na=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show"),v=k.offset();k=k.outerWidth();a(this).css({left:(v.left+k)*ia,top:v.top})})},Aa=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var v=[];a(this).children().each(function(){v.push(this.title)});k[0].title=v.join(" / ")}})},Fa,Ia=function(k,v,C){var F=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+C+"_color defs *")[0];F={alpha:v};F[k.tagName]= -k}else F=k.indexOf("#")===0?{alpha:v,solidColor:k.substr(1)}:{alpha:v,solidColor:"none"};return new a.jGraduate.Paint(F)},Ca=g.getResolution();if(curConfig.baseUnit!=="px"){Ca.w=svgedit.units.convertUnit(Ca.w)+curConfig.baseUnit;Ca.h=svgedit.units.convertUnit(Ca.h)+curConfig.baseUnit}var Ka=function(k){g.createLayer("background");cur_shape=g.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:Ca.w+2,height:Ca.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:k||"#fff",style:"pointer-events:none"}}); -g.setCurrentLayer("Layer 1");g.setCurrentLayerPosition("1")};document.getElementById("canvas_background")||Ka();document.getElementById("canvas_background").getAttribute("fill");var Na=b.setImageURL=function(k){k||(k=J);g.setImageURL(k);a("#image_url").val(k)},za=function(){var k=X;if(k!=null&&!k.parentNode)k=null;if(sa&&sa[0]!=null&&!sa[0].parentNode)sa=false;var v=g.getCurrentDrawing().getCurrentLayerName(),C=g.getMode(),F=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,P=C=="pathedit";if(P){a(".context_panel").hide(); -a("#path_node_panel").show();a("#stroke_panel").hide();v=K.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!K.canDeleteNodes);Cb("#tool_openclose_path",K.closed_subpath?"open_path":"close_path");if(v){P=a("#seg_type");if(F){v.x=svgedit.units.convertUnit(v.x);v.y=svgedit.units.convertUnit(v.y)}a("#path_node_x").val(Math.round(v.x));a("#path_node_y").val(Math.round(v.y));v.type?P.val(v.type).removeAttr("disabled"): -P.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var U=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(sa){sa=sa.filter(Boolean);(k=g.elementsAreSame(sa)?sa[0]:null)&&a("#tools_top").addClass("multiselected")}if(!k&&!sa){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(k!= -null){a("#stroke_panel").show();var S=k.nodeName,Y=g.getRotationAngle(k);a("#angle").val(Math.round(Y));Y=g.getBlur(k);a("#blur").val(Y);if(!P&&C!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var Z,ga;if(["g","polyline","path"].indexOf(S)>=0)if(C=g.getStrokedBBox([k])){Z=C.x;ga=C.y}if(F){Z=svgedit.units.convertUnit(Z);ga=svgedit.units.convertUnit(ga)}a("#"+S+"_x").val(Math.round(Z));a("#"+S+"_y").val(Math.round(ga));if(S==="polyline"){a("#path_x").val(Math.round(Z)); -a("#path_y").val(Math.round(ga))}["image","text","path","g","use"].indexOf(S)==-1&&a(".action_path_convert_selected").removeClass("disabled");S==="path"&&a(".action_path_selected").removeClass("disabled")}F=null;if(qa==="a"){F=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();F=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!F);F&&a("#link_url").val(F);F={g:[],a:[],rect:["rx","width","height","x","y"],image:["width", -"height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:["x","y"],use:[],path:[]};var qa=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();if(qa=="path"||qa=="polyline")a("#path_panel").show();if(F[qa]){F=F[qa];a("#"+qa+"_panel").show();qa=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(F,function(Oa,Ba){var ha=k.getAttribute(Ba);if(curConfig.baseUnit!=="px"&&k[Ba])ha=svgedit.units.convertUnit(k[Ba].baseVal.value);var Ta= -document.getElementById(qa+"_"+Ba);Ta.value=Math.round(ha)||0;Ta.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(Ta)});if(qa=="text"){F=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",g.getBold());a("#font_family").val(F);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(F.split(",")[0].replace(/'/g, -"")).css("font-family",F);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(qa=="image")Na(g.getHref(k));else if(qa==="g"||qa==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}U[(qa==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(qa==="g"||!sa?"dis":"en")+"ableContextMenuItems"]("#group")}if(sa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k|| -U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(v);V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus", -function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,v){var C=g.getMode();C==="select"&&ba();if(C==="pathedit")return za();X=v.length==1||v[1]==null?v[0]:null;v=v.filter(Boolean);sa=v.length>=2?v:false;if(g.elementsAreSame(sa))X=sa[0];if(X!=null){a("#multiselected_panel").hide();if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":C=null;for(var F=X.getElementsByTagName("*"),P=0,U=F.length;P=2&&v[1]!=null?v:null;if(!sa)switch(C){case "rotate":C=g.getRotationAngle(F);a("#angle").val(Math.round(C));rotateCursor(C);a("#tool_reorient").toggleClass("disabled",C==0)}g.runExtensions("elementTransition",{elems:v})}});g.bind("changed",function(k,v){var C=g.getMode();C==="select"&&ba();for(var F=0;F\n'+v;var C=navigator.userAgent;if(~C.indexOf("Chrome")&&a.browser.version>=533||~C.indexOf("MSIE"))Qb(0,true);else{var F=k.open("data:image/svg+xml;base64,"+O.encode64(v)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s", -"SVG");if(C.indexOf("Gecko/")!==-1)if(v.indexOf("",{id:"export_canvas"}).hide().appendTo("body");var F=a("#export_canvas")[0];F.width=g.contentW;F.height=g.contentH;canvg(F,v.svg,{renderCallback:function(){var P= -F.toDataURL("image/png");M.location.href=P;if(a.pref("export_notice_done")!=="all"){P=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(C.length)P+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+C.join("\n \u2022 ");a.pref("export_notice_done","all");M.alert(P)}}})});g.bind("zoomed",W);g.bind("contextset",function(k,v){var C="";if(v){var F="";C=''+g.getCurrentDrawing().getCurrentLayerName()+"";a(v).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){F+= -" > "+this.id;C+=this!==v?' > '+this.id+"":" > "+this.id}});da=F}else da=null;a("#cur_context_panel").toggle(!!v).html(C)});g.bind("extension_added",function(k,v){function C(){if(Fa){clearTimeout(Fa);Fa=null}P||(Fa=setTimeout(function(){P=true;e(s.iconsize)},50))}var F=false,P=false,U=true,S=function(){if(v.callback&&!F&&U){F=true;v.callback()}},Y=[];v.context_tools&&a.each(v.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length|| -(Ra=a("
      ",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ua='
      '+ha.id+"
      ",Ma=a(ua).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ua="";var xa=a(ua).appendTo(Ra).find("select");a.each(ha.events,function(Xa, -cb){a(xa).bind(Xa,cb)});break;case "button-select":ua='';Ta=a('
        ').appendTo("#option_lists");ha.colnum&&Ta.addClass("optcols"+ha.colnum);a(ua).appendTo(Ra).children();Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ua="'+ -ha.label+':';var ab=a(ua).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,cb){ab.bind(Xa,cb)})}});if(v.buttons){var Z={},ga={},qa=v.svgicons,Oa={};a.each(v.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ua=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ua;if(qa){Z[Ra]=ha.icon;ua=ha.svgicon?ha.svgicon:ha.id;if(ha.type=="app_menu")ga["#"+ -Ra+" > div"]=ua;else ga["#"+Ra]=ua}else Ta=ha.type=="menu"?"":a('');var Ma,xa;switch(ha.type){case "mode_flyout":case "mode":Ma="tool_button";if(ha.cls)Ma+=" "+ha.cls;xa="#tools_left";break;case "context":Ma="tool_button";xa="#"+ha.panel;a(xa).length||a("
        ",{id:ha.panel}).appendTo("#tools_top");break;case "menu":Ma="menu_item tool_button";xa="#"+(ha.after||ha.panel);break;case "app_menu":Ma="";xa=ha.parent||"#main_menu ul";a(xa).length||a("
        ",{id:ha.panel}).appendTo("#tools_top")}var ab= -a(ha.list||ha.type=="app_menu"?"
      • ":"
        ").attr("id",Ra).attr("title",ha.title).addClass(Ma);if(!ha.includeWith&&!ha.list){if("position"in ha)a(xa).children().eq(ha.position).before(ab);else ha.type!="menu"||!ha.after?ab.appendTo(xa):a(xa).after(ab);if(ha.type=="mode_flyout"){ua=a(ab);Ma=ua.parent();if(!ua.parent().hasClass("tools_flyout")){var Xa=ua[0].id.replace("tool_","tools_"),cb=ua.clone().attr("id",Xa+"_show").append(a("
        ",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua); -Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button");a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+ha.list).append(ab.children().clone());ua=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ua}}else if(ha.includeWith){xa=ha.includeWith;ua=a(xa.button);Ma=ua.parent();if(!ua.parent().hasClass("tools_flyout")){Xa= -ua[0].id.replace("tool_","tools_");cb=ua.clone().attr("id",Xa+"_show").append(a("
        ",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua)}var Hb=u.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key,isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa
        '});a("#palette").append(ya);var Ha=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k="rotate("+k+"deg)";Ha.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var v=k.value/100;if(v<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(Q[0].scrollLeft+Q.width()/2)/k,y:(Q[0].scrollTop+Q.height()/ -2)/k,zoom:v},true)}},qb=function(){window.opera&&a("

        ").hide().appendTo("body").remove()};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);qb()});a("#seg_type").change(function(){g.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)}); -changeAttribute=function(k){var v=k.getAttribute("data-attr"),C=k.getAttribute("data-multiplier")||1;C=parseFloat(C);C=k.value*C;if(!svgedit.units.isValidUnit(v,C,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(v);return false}g.changeSelectedAttributeNoUndo(v,C)};a("#palette").mouseover(function(){var k=a('');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"), -v=k?"stroke":"fill",C=a(this).attr("data-rgb"),F=null;if(C==="transparent"||C==="initial"||C==="#none"){C="none";F=new a.jGraduate.Paint}else F=new a.jGraduate.Paint({alpha:100,solidColor:C.substr(1)});b.paintBox[v].setPaint(F);if(k){g.setColor("stroke",C);C!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display", -"table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,v){if(a(k).hasClass("disabled"))return false;if(a(k).parent().hasClass("tools_flyout"))return true;var C=C||"normal";v||a(".tools_flyout").fadeOut(C);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k= -null,v=null,C=Q[0],F=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(F!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-v;k=U.clientX;v=U.clientY;if(U.type==="mouseup"||U.type==="touchend")F=false;return false}}).on("mousedown touchmove",function(U){if(U.button===1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){F=true;k=U.clientX;v=U.clientY;return false}});a(window).mouseup(function(){F=false;a("body").removeClass("dragging")});a(document).bind("keydown", -"space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()==="zoom"&&Q.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&Q.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background= -"#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")}); -var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(k,v,C,F){if(k.altKey){k.preventDefault();k=g.getZoom()*100;v=Sa.length;for(D=0;D0)zoom=Sa[D]<=k?Sa[C]:zoom;if(F<0)zoom=Sa[D]"+k+"

        "+k+"

        ")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},xb=function(){g.open()},Ib=function(){},pb=function(k){var v=k.prev();v.css("background","#09f");setTimeout(function(){v.css("background","")},200)},hb=function(){if(T.getUndoStackSize()> -0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"), -v=document.querySelector("#tool_fill rect"),C=v.getAttribute("fill"),F=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;v=parseFloat(v.getAttribute("fill-opacity"));if(isNaN(v))v=100;F=Ia(F,k,"stroke");C=Ia(C,v,"fill");b.paintBox.fill.setPaint(F,true);b.paintBox.stroke.setPaint(C,true)},Db=function(k){var v=g.getResolution();k=k?v.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();E(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"): -a("#tool_wireframe").removeClass("push_button_pressed");Q.toggleClass("wireframe");if(!H){var k=a("#wireframe_rules");k.length?k.empty():a('').appendTo("head");lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exit_fullscreen()},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed"); -a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(Q.hasClass("wireframe")?k:"")}},Qb=function(k,v){if(!ka){ka=true;a("#save_output_btns").toggle(!!v);a("#tool_source_back").toggle(!v);var C= -fa=g.getSvgString();a("#svg_source_textarea").val(C);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();aa()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();aa()});ba()}},Cb=b.setIcon=function(k,v){var C=typeof v==="string"?a.getSvgIcon(v,true):v.clone();C?a(k).find("img").replaceWith(C):console.log("NOTE: Icon image missing: "+ -v)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,v=document.getElementsByTagName("script")[0],C;for(C in v.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in v.style)return"Webkit";if("KhtmlOpacity"in v.style)return"Khtml";return""}();var Mb=function(k,v){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var F=a(this),P=F.outerWidth()*(v-1),U=F.outerHeight()*(v-1),S=0;S<4;S++){var Y=C[S],Z=F.data("orig_margin-"+Y);if(Z==null){Z=parseInt(F.css("margin-"+ -Y));F.data("orig_margin-"+Y,Z)}Z=Z*v;if(Y==="right")Z+=P;else if(Y==="bottom")Z+=U;F.css("margin-"+Y,Z)}})},e=b.setIconSize=function(k,v){if(!(k==s.size&&!v)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),F=1;F=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=ia=F;na();var P=C.parents(":hidden");P.css("visibility","hidden").show(); -Mb(C,F);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,Y){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(Y,function(Z,ga){if(typeof ga==="number")var qa=ga*F+"px";else if(ga[k]||ga.all)qa=ga[k]||ga.all;U+=Z+":"+qa+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+ +v.src=curConfig.extPath+k;document.querySelector("head").appendChild(v)}})})};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:true,fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",spapelib:"shapelib.png", +node_delete:"node_delete.png",align_left:"align-left.png",align_center:"align-center.png",align_right:"align-right.png",align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bottom.png",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_ellipse,#tools_ellipse_show":"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 k=a("#tools_left");if(k.length!=0){k.offset();k.outerHeight()}a(".tools_flyout").each(function(){var v= +a("#"+this.id+"_show"),C=v.attr("data-curopt");if(!v.children("svg, img").length){C=a(C).children().clone();if(C.length){C[0].removeAttribute("style");v.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(k){a("#base_unit_container").css({top:k.pageY-10,left:k.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()});b.canvas=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};q=navigator.platform.indexOf("Mac")>=0;var B=navigator.userAgent.indexOf("AppleWebKit")>=0,o=q?"meta+":"ctrl+",K=g.pathActions,T=g.undoMgr,O=svgedit.utilities,J=curConfig.imgPath+ +"placeholder.svg",Q=a("#workarea"),V=a("#cmenu_canvas"),M=null,ia=1,oa="toolbars",fa="";q||a(".shortcut").each(function(){var k=a(this).text();a(this).text(k.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var k=a("#dialog_box"),v=a("#dialog_buttons"),C=function(F,P,U,S){a("#dialog_content").html("

        "+P.replace(/\n/g,"

        ")+"

        ").toggleClass("prompt",F=="prompt");v.empty();var Y=a('').appendTo(v);F!="alert"&&a('').appendTo(v).on("click, touchstart",function(){k.hide();U(false)});if(F=="prompt"){var Z=a('').prependTo(v);Z.val(S||"");Z.bind("keydown","return",function(){Y.trigger("click touchstart")})}F=="process"&&Y.hide();k.show();Y.on("click touchstart",function(){k.hide();var ga=F=="prompt"?Z.val():true;U&&U(ga)}).focus();F=="prompt"&&Z.focus()};a.alert=function(F,P){C("alert", +F,P)};a.confirm=function(F,P){C("confirm",F,P)};a.process_cancel=function(F,P){C("process",F,P)};a.prompt=function(F,P,U){C("prompt",F,U,P)}})();var ba=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},X=null,sa=false,ka=false,da="",W=function(k,v){var C=g.getResolution();a("#svgcanvas").position();var F=g.setBBoxZoom(v, +Q.width()-15,Q.height()-15);if(F){var P=F.zoom;F=F.bbox;if(P<0.0010)wa({value:0.1});else{var U=Date.now(),S=P-C.zoom;a("#zoom");var Y=C.zoom,Z=function(ga){ga=(ga-U)/500;ga=Math.pow(ga-1,3)+1;g.setZoom(Y+S*ga);E();if(ga<1)requestAnimationFrame(Z);else{a("#zoom").val(P*100);a("option","#zoom_select").removeAttr("selected");a("option[value="+P*100+"]","#zoom_select").attr("selected","selected")}};Z(Date.now());g.getMode()=="zoom"&&F.width&&ba();lb()}}};a("#cur_context_panel").delegate("a","click",function(){var k= +a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var aa=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},pa={},ra=function(k){a.each(k,function(v,C){var F=a(v).children(),P=v+"_show",U=a(P),S=false;F.addClass("tool_button").unbind("click mousedown mouseup").each(function(ga){var qa=C[ga];pa[qa.sel]=qa.fn;if(qa.isDefault)S=ga;ga=function(Oa){var Ba=qa;if(Oa.type==="keydown"){var ha=a(Ba.parent+"_show").hasClass("tool_button_current"),Ta=a(Ba.parent+"_show").attr("data-curopt"); +a.each(k[qa.parent],function(ua,Ma){if(Ma.sel==Ta)Ba=!Oa.shiftKey||!ha?Ma:k[qa.parent][ua+1]||k[qa.parent][0]})}if(a(this).hasClass("disabled"))return false;$a(P)&&Ba.fn();var Ra=Ba.icon?a.getSvgIcon(Ba.icon,true):a(Ba.sel).children().eq(0).clone();Ra[0].setAttribute("width",U.width());Ra[0].setAttribute("height",U.height());U.children(":not(.flyout_arrow_horiz)").remove();U.append(Ra).attr("data-curopt",Ba.sel)};a(this).mouseup(ga);qa.key&&a(document).bind("keydown",qa.key[0]+" shift+"+qa.key[0], +ga)});if(S)U.attr("data-curopt",C[S].sel);else U.attr("data-curopt")||U.attr("data-curopt",C[0].sel);var Y,Z=a(P).position();a(v).css({left:Z.left+34,top:Z.top+77});U.mousedown(function(ga){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&$a(P,false);if(U.hasClass("disabled"))return false;var qa=a(v),Oa=Z.left+34,Ba=qa.width()*-1,ha=qa.data("shown_popop")?200:0;Y=setTimeout(function(){U.data("isLibrary")?qa.css("left",Oa).show():qa.css("left", +Ba).show().animate({left:Oa},50);qa.data("shown_popop",true)},ha);ga.preventDefault()}).mouseup(function(){clearTimeout(Y);var ga=a(this).attr("data-curopt");if(U.data("isLibrary")&&a(P.replace("_show","")).is(":visible"))$a(P,true);else $a(P)&&ga in pa&&pa[ga]()})});Aa()},ma=function(k,v){return a("
        ",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(v)},na=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show"),v=k.offset();k=k.outerWidth();a(this).css({left:(v.left+ +k)*ia,top:v.top})})},Aa=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var v=[];a(this).children().each(function(){v.push(this.title)});k[0].title=v.join(" / ")}})},Fa,Ia=function(k,v,C){var F=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+C+"_color defs *")[0];F={alpha:v};F[k.tagName]=k}else F=k.indexOf("#")===0?{alpha:v,solidColor:k.substr(1)}:{alpha:v,solidColor:"none"};return new a.jGraduate.Paint(F)},Ca=g.getResolution(); +if(curConfig.baseUnit!=="px"){Ca.w=svgedit.units.convertUnit(Ca.w)+curConfig.baseUnit;Ca.h=svgedit.units.convertUnit(Ca.h)+curConfig.baseUnit}var Ka=function(k){g.createLayer("background");cur_shape=g.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:Ca.w+2,height:Ca.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:k||"#fff",style:"pointer-events:none"}});g.setCurrentLayer("Layer 1");g.setCurrentLayerPosition("1")};document.getElementById("canvas_background")||Ka();document.getElementById("canvas_background").getAttribute("fill"); +var Na=b.setImageURL=function(k){k||(k=J);g.setImageURL(k);a("#image_url").val(k)},za=function(){var k=X;if(k!=null&&!k.parentNode)k=null;if(sa&&sa[0]!=null&&!sa[0].parentNode)sa=false;var v=g.getCurrentDrawing().getCurrentLayerName(),C=g.getMode(),F=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,P=C=="pathedit";if(P){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide();v=K.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button"); +a("#tool_node_delete").toggleClass("disabled",!K.canDeleteNodes);Cb("#tool_openclose_path",K.closed_subpath?"open_path":"close_path");if(v){P=a("#seg_type");if(F){v.x=svgedit.units.convertUnit(v.x);v.y=svgedit.units.convertUnit(v.y)}a("#path_node_x").val(Math.round(v.x));a("#path_node_y").val(Math.round(v.y));v.type?P.val(v.type).removeAttr("disabled"):P.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var U=a("#cmenu_canvas li"); +a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(sa){sa=sa.filter(Boolean);(k=g.elementsAreSame(sa)?sa[0]:null)&&a("#tools_top").addClass("multiselected")}if(!k&&!sa){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(k!=null){a("#stroke_panel").show();var S=k.nodeName,Y=g.getRotationAngle(k);a("#angle").val(Math.round(Y));Y=g.getBlur(k);a("#blur").val(Y);if(!P&&C!="pathedit"){a("#selected_panel").show(); +a(".action_selected").removeClass("disabled");var Z,ga;if(["g","polyline","path"].indexOf(S)>=0)if(C=g.getStrokedBBox([k])){Z=C.x;ga=C.y}if(F){Z=svgedit.units.convertUnit(Z);ga=svgedit.units.convertUnit(ga)}a("#"+S+"_x").val(Math.round(Z));a("#"+S+"_y").val(Math.round(ga));if(S==="polyline"){a("#path_x").val(Math.round(Z));a("#path_y").val(Math.round(ga))}["image","text","path","g","use"].indexOf(S)==-1&&a(".action_path_convert_selected").removeClass("disabled");S==="path"&&a(".action_path_selected").removeClass("disabled")}F= +null;if(qa==="a"){F=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();F=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!F);F&&a("#link_url").val(F);F={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:["x","y"],use:[],path:[]};var qa=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();if(qa=="path"||qa== +"polyline")a("#path_panel").show();if(F[qa]){F=F[qa];a("#"+qa+"_panel").show();qa=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(F,function(Oa,Ba){var ha=k.getAttribute(Ba);if(curConfig.baseUnit!=="px"&&k[Ba])ha=svgedit.units.convertUnit(k[Ba].baseVal.value);var Ta=document.getElementById(qa+"_"+Ba);Ta.value=Math.round(ha)||0;Ta.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(Ta)});if(qa=="text"){F=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex= +3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",g.getBold());a("#font_family").val(F);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(F.split(",")[0].replace(/'/g,"")).css("font-family",F);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(qa=="image")Na(g.getHref(k));else if(qa==="g"||qa==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled"); +g.getTitle()}}U[(qa==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(qa==="g"||!sa?"dis":"en")+"ableContextMenuItems"]("#group")}if(sa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k||U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled"); +T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(v);V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,v){var C=g.getMode();C==="select"&&ba();if(C==="pathedit")return za();X=v.length==1||v[1]==null?v[0]:null;v=v.filter(Boolean);sa= +v.length>=2?v:false;if(g.elementsAreSame(sa))X=sa[0];if(X!=null){a("#multiselected_panel").hide();if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":C=null;for(var F=X.getElementsByTagName("*"),P=0,U=F.length;P=2&&v[1]!=null?v:null;if(!sa)switch(C){case "rotate":C=g.getRotationAngle(F); +a("#angle").val(Math.round(C));rotateCursor(C);a("#tool_reorient").toggleClass("disabled",C==0)}g.runExtensions("elementTransition",{elems:v})}});g.bind("changed",function(k,v){var C=g.getMode();C==="select"&&ba();for(var F=0;F=533||~C.indexOf("MSIE"))Qb(0,true);else{var F=k.open("data:image/svg+xml;base64,"+O.encode64(v)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(C.indexOf("Gecko/")!==-1)if(v.indexOf("",{id:"export_canvas"}).hide().appendTo("body");var F=a("#export_canvas")[0];F.width=g.contentW;F.height=g.contentH;canvg(F,v.svg,{renderCallback:function(){var P=F.toDataURL("image/png");M.location.href=P;if(a.pref("export_notice_done")!=="all"){P=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(C.length)P+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+ +C.join("\n \u2022 ");a.pref("export_notice_done","all");M.alert(P)}}})});g.bind("zoomed",W);g.bind("contextset",function(k,v){var C="";if(v){var F="";C=''+g.getCurrentDrawing().getCurrentLayerName()+"";a(v).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){F+=" > "+this.id;C+=this!==v?' > '+this.id+"":" > "+this.id}});da=F}else da=null;a("#cur_context_panel").toggle(!!v).html(C)});g.bind("extension_added",function(k,v){function C(){if(Fa){clearTimeout(Fa); +Fa=null}P||(Fa=setTimeout(function(){P=true;e(s.iconsize)},50))}var F=false,P=false,U=true,S=function(){if(v.callback&&!F&&U){F=true;v.callback()}},Y=[];v.context_tools&&a.each(v.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("
        ",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ua='
        '+ha.id+"
        ",Ma=a(ua).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa, +cb)});break;case "select":ua="";var xa=a(ua).appendTo(Ra).find("select");a.each(ha.events,function(Xa,cb){a(xa).bind(Xa,cb)});break;case "button-select":ua='';Ta=a('
          ').appendTo("#option_lists"); +ha.colnum&&Ta.addClass("optcols"+ha.colnum);a(ua).appendTo(Ra).children();Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ua="'+ha.label+':';var ab=a(ua).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa, +cb){ab.bind(Xa,cb)})}});if(v.buttons){var Z={},ga={},qa=v.svgicons,Oa={};a.each(v.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ua=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ua;if(qa){Z[Ra]=ha.icon;ua=ha.svgicon?ha.svgicon:ha.id;if(ha.type=="app_menu")ga["#"+Ra+" > div"]=ua;else ga["#"+Ra]=ua}else Ta=ha.type=="menu"?"":a('');var Ma,xa;switch(ha.type){case "mode_flyout":case "mode":Ma="tool_button";if(ha.cls)Ma+=" "+ha.cls;xa="#tools_left";break;case "context":Ma="tool_button";xa="#"+ +ha.panel;a(xa).length||a("
          ",{id:ha.panel}).appendTo("#tools_top");break;case "menu":Ma="menu_item tool_button";xa="#"+(ha.after||ha.panel);break;case "app_menu":Ma="";xa=ha.parent||"#main_menu ul";a(xa).length||a("
          ",{id:ha.panel}).appendTo("#tools_top")}var ab=a(ha.list||ha.type=="app_menu"?"
        • ":"
          ").attr("id",Ra).attr("title",ha.title).addClass(Ma);if(!ha.includeWith&&!ha.list){if("position"in ha)a(xa).children().eq(ha.position).before(ab);else ha.type!="menu"||!ha.after?ab.appendTo(xa): +a(xa).after(ab);if(ha.type=="mode_flyout"){ua=a(ab);Ma=ua.parent();if(!ua.parent().hasClass("tools_flyout")){var Xa=ua[0].id.replace("tool_","tools_"),cb=ua.clone().attr("id",Xa+"_show").append(a("
          ",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua);Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button"); +a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+ha.list).append(ab.children().clone());ua=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ua}}else if(ha.includeWith){xa=ha.includeWith;ua=a(xa.button);Ma=ua.parent();if(!ua.parent().hasClass("tools_flyout")){Xa=ua[0].id.replace("tool_","tools_");cb=ua.clone().attr("id",Xa+"_show").append(a("
          ",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua)}var Hb=u.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+ +Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key,isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa
          '});a("#palette").append(ya);var Ha=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k= +"rotate("+k+"deg)";Ha.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var v=k.value/100;if(v<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(Q[0].scrollLeft+Q.width()/2)/k,y:(Q[0].scrollTop+Q.height()/2)/k,zoom:v},true)}},qb=function(){window.opera&&a("

          ").hide().appendTo("body").remove()};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text); +qb()});a("#seg_type").change(function(){g.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});changeAttribute=function(k){var v=k.getAttribute("data-attr"),C=k.getAttribute("data-multiplier")||1;C=parseFloat(C);C=k.value*C;if(!svgedit.units.isValidUnit(v,C,X)){a.alert(uiStrings.notification.invalidAttrValGiven); +k.value=X.getAttribute(v);return false}g.changeSelectedAttributeNoUndo(v,C)};a("#palette").mouseover(function(){var k=a('');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"),v=k?"stroke":"fill",C=a(this).attr("data-rgb"),F=null;if(C==="transparent"||C==="initial"||C==="#none"){C="none";F=new a.jGraduate.Paint}else F=new a.jGraduate.Paint({alpha:100,solidColor:C.substr(1)});b.paintBox[v].setPaint(F); +if(k){g.setColor("stroke",C);C!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,v){if(a(k).hasClass("disabled"))return false; +if(a(k).parent().hasClass("tools_flyout"))return true;var C=C||"normal";v||a(".tools_flyout").fadeOut(C);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=null,v=null,C=Q[0],F=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(F!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-v;k=U.clientX;v=U.clientY; +if(U.type==="mouseup"||U.type==="touchend")F=false;return false}}).on("mousedown touchmove",function(U){if(U.button===1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){F=true;k=U.clientX;v=U.clientY;return false}});a(window).mouseup(function(){F=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()=== +"zoom"&&Q.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&Q.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart", +function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(k,v,C,F){if(k.altKey){k.preventDefault();k=g.getZoom()*100;v=Sa.length;for(D=0;D0)zoom=Sa[D]<=k?Sa[C]:zoom;if(F<0)zoom=Sa[D]"+k+"

          "+k+"

          ")}window.canvg? +g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},xb=function(){g.open()},Ib=function(){},pb=function(k){var v=k.prev();v.css("background","#09f");setTimeout(function(){v.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.redo()}},Kb=function(){if(sa)g.groupSelectedElements(); +else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),v=document.querySelector("#tool_fill rect"),C=v.getAttribute("fill"),F=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;v=parseFloat(v.getAttribute("fill-opacity")); +if(isNaN(v))v=100;F=Ia(F,k,"stroke");C=Ia(C,v,"fill");b.paintBox.fill.setPaint(F,true);b.paintBox.stroke.setPaint(C,true)},Db=function(k){var v=g.getResolution();k=k?v.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();E(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");Q.toggleClass("wireframe");if(!H){var k=a("#wireframe_rules");k.length?k.empty():a('').appendTo("head"); +lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exit_fullscreen()},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed"); +a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(Q.hasClass("wireframe")?k:"")}},Qb=function(k,v){if(!ka){ka=true;a("#save_output_btns").toggle(!!v);a("#tool_source_back").toggle(!v);var C=fa=g.getSvgString();a("#svg_source_textarea").val(C);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}}, +Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();aa()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();aa()});ba()}},Cb=b.setIcon=function(k,v){var C=typeof v==="string"?a.getSvgIcon(v,true):v.clone();C?a(k).find("img").replaceWith(C):console.log("NOTE: Icon image missing: "+v)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,v=document.getElementsByTagName("script")[0], +C;for(C in v.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in v.style)return"Webkit";if("KhtmlOpacity"in v.style)return"Khtml";return""}();var Mb=function(k,v){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var F=a(this),P=F.outerWidth()*(v-1),U=F.outerHeight()*(v-1),S=0;S<4;S++){var Y=C[S],Z=F.data("orig_margin-"+Y);if(Z==null){Z=parseInt(F.css("margin-"+Y));F.data("orig_margin-"+Y,Z)}Z=Z*v;if(Y==="right")Z+=P;else if(Y==="bottom")Z+=U;F.css("margin-"+Y, +Z)}})},e=b.setIconSize=function(k,v){if(!(k==s.size&&!v)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),F=1;F=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=ia=F;na();var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,F);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty(); +else C=a('').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,Y){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(Y,function(Z,ga){if(typeof ga==="number")var qa=ga*F+"px";else if(ga[k]||ga.all)qa=ga[k]||ga.all;U+=Z+":"+qa+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+ P+"transform: scale("+F+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/F+");}";C.text(U)}na()}},h=function(){a("#dialog_box").hide();if(ka){if(ka)fa!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&m()}):m();z()}else da&&g.leaveContext()},m=function(){a("#svg_source_editor").hide();ka=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height(); var z=a.noop;a(window).resize(function(){E()});(function(){Q.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=Q[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=Q[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(v){v&&Na(v)})});var w=function(k){var v=k[0].id=="stroke_color"?"stroke": "fill",C=k[0].id=="canvas_color";if(C)v="canvas";var F=b.paintBox[v].paint;k=v=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).removeAttr("style").css(C).jGraduate({paint:F,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){F=new a.jGraduate.Paint(P);b.paintBox[v].setPaint(F); diff --git a/method-draw/svgicons/jquery.svgicons.js b/method-draw/svgicons/jquery.svgicons.js index 1f7ef67..18c647c 100644 --- a/method-draw/svgicons/jquery.svgicons.js +++ b/method-draw/svgicons/jquery.svgicons.js @@ -376,19 +376,6 @@ $(function() { var old_val = 'url(#' + id + ')'; var new_val = 'url(#' + new_id + ')'; - - // Selector method, possibly faster but fails in Opera / jQuery 1.4.3 -// svg_el.find('[fill="url(#' + id + ')"]').each(function() { -// this.setAttribute('fill', 'url(#' + new_id + ')'); -// }).end().find('[stroke="url(#' + id + ')"]').each(function() { -// this.setAttribute('stroke', 'url(#' + new_id + ')'); -// }).end().find('use').each(function() { -// if(this.getAttribute('xlink:href') == '#' + id) { -// this.setAttributeNS(xlinkns,'href','#' + new_id); -// } -// }).end().find('[filter="url(#' + id + ')"]').each(function() { -// this.setAttribute('filter', 'url(#' + new_id + ')'); -// }); for(var i = 0; i < len; i++) { var elem = all_elems[i];