sketchily 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -242,7 +242,7 @@ t;V+=t;u=P;t=W}Za([[T,V],[P,W]])}}return C}}}(),fc=this.removeUnusedDefElems=fun
242
242
  defelem_ids=[];for(h=b.length;h--;){m=b[h];i=m.id;if(c.indexOf(i)<0){Ub[i]=m;m.parentNode.removeChild(m);d++}}return d};this.svgCanvasToString=function(){for(;fc()>0;);qa.clear(true);$.each(n.childNodes,function(d,m){d&&m.nodeType===8&&m.data.indexOf("Created with")>=0&&n.insertBefore(m,n.firstChild)});if(O){Qb();Wa([O])}var b=[];$(n).find("g:data(gsvg)").each(function(){for(var d=this.attributes,m=d.length,i=0;i<m;i++)if(d[i].nodeName=="id"||d[i].nodeName=="style")m--;if(m<=0){d=this.firstChild;
243
243
  b.push(d);$(this).replaceWith(d)}});var c=this.svgToString(n,0);b.length&&$(b).each(function(){cc(this)});return c};this.svgToString=function(b,c){var d=[],m=svgedit.utilities.toXml,i=v.baseUnit,z=RegExp("^-?[\\d\\.]+"+i+"$");if(b){Oa(b);var o=b.attributes,h,q,w=b.childNodes;for(q=0;q<c;q++)d.push(" ");d.push("<");d.push(b.nodeName);if(b.id==="svgcontent"){q=xb();if(i!=="px"){q.w=svgedit.units.convertUnit(q.w,i)+i;q.h=svgedit.units.convertUnit(q.h,i)+i}d.push(' width="'+q.w+'" height="'+q.h+'" xmlns="'+
244
244
  s+'"');var u={};$(b).find("*").andSelf().each(function(){$.each(this.attributes,function(H,I){var P=I.namespaceURI;if(P&&!u[P]&&hb[P]!=="xmlns"&&hb[P]!=="xml"){u[P]=true;d.push(" xmlns:"+hb[P]+'="'+P+'"')}})});q=o.length;for(i=["width","height","xmlns","x","y","viewBox","id","overflow"];q--;){h=o.item(q);var t=m(h.nodeValue);if(h.nodeName.indexOf("xmlns:")!==0)if(t!=""&&i.indexOf(h.localName)==-1)if(!h.namespaceURI||hb[h.namespaceURI]){d.push(" ");d.push(h.nodeName);d.push('="');d.push(t);d.push('"')}}}else{if(b.nodeName===
245
- "defs"&&!b.firstChild)return;var C=["-moz-math-font-style","_moz-math-font-style"];for(q=o.length-1;q>=0;q--){h=o.item(q);t=m(h.nodeValue);if(!(C.indexOf(h.localName)>=0))if(t!="")if(t.indexOf("pointer-events")!==0)if(!(h.localName==="class"&&t.indexOf("se_")===0)){d.push(" ");if(h.localName==="d")t=qa.convertPath(b,true);if(isNaN(t)){if(z.test(t))t=svgedit.units.shortFloat(t)+i}else t=svgedit.units.shortFloat(t);if(Na.apply&&b.nodeName==="image"&&h.localName==="href"&&Na.images&&Na.images==="embed"){var E=
245
+ "defs"&&!b.firstChild)return;var C=["-moz-math-font-style","_moz-math-font-style"];for(q=o.length-1;q>=0;q--){h=o.item(q);t=m(h.nodeValue);if(!(C.indexOf(h.localName)>=0))if(t!="")if(t.indexOf("pointer-events")!==0)if(!(h.localName==="class"&&t.indexOf("se_")===0)){d.push(" ");if(h.localName==="d")t=qa.convertPath(b,true);if(isNaN(t)){if(z.test(t))t=svgedit.units.shortFloat(t)+i}else t=svgedit.units.shortFloat(t);if(/*Na.apply&&*/b.nodeName==="image"&&h.localName==="href"/*&&Na.images&&Na.images==="embed"*/){var E=
246
246
  Jb[t];if(E)t=E}if(!h.namespaceURI||h.namespaceURI==s||hb[h.namespaceURI]){d.push(h.nodeName);d.push('="');d.push(t);d.push('"')}}}}if(b.hasChildNodes()){d.push(">");c++;o=false;for(q=0;q<w.length;q++){i=w.item(q);switch(i.nodeType){case 1:d.push("\n");d.push(this.svgToString(w.item(q),c));break;case 3:i=i.nodeValue.replace(/^\s+|\s+$/g,"");if(i!=""){o=true;d.push(m(i)+"")}break;case 4:d.push("\n");d.push(Array(c+1).join(" "));d.push("<![CDATA[");d.push(i.nodeValue);d.push("]]\>");break;case 8:d.push("\n");
247
247
  d.push(Array(c+1).join(" "));d.push("<!--");d.push(i.data);d.push("--\>")}}c--;if(!o){d.push("\n");for(q=0;q<c;q++)d.push(" ")}d.push("</");d.push(b.nodeName);d.push(">")}else d.push("/>")}return d.join("")};this.embedImage=function(b,c){$(new Image).load(function(){var d=document.createElement("canvas");d.width=this.width;d.height=this.height;d.getContext("2d").drawImage(this,0,0);try{var m=";svgedit_url="+encodeURIComponent(b);m=d.toDataURL().replace(";base64",m+";base64");Jb[b]=m}catch(i){Jb[b]=
248
248
  false}Bb=b;c&&c(Jb[b])}).attr("src",b)};this.setGoodImage=function(b){Bb=b};this.open=function(){};this.save=function(b){za();b&&$.extend(Na,b);Na.apply=true;b=this.svgCanvasToString();ha("saved",b)};this.rasterExport=function(){za();var b=[],c={feGaussianBlur:ub.exportNoBlur,foreignObject:ub.exportNoforeignObject,"[stroke-dasharray]":ub.exportNoDashArray},d=$(n);if(!("font"in $("<canvas>")[0].getContext("2d")))c.text=ub.exportNoText;$.each(c,function(m,i){d.find(m).length&&b.push(i)});c=this.svgCanvasToString();
@@ -355,7 +355,7 @@ da.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").
355
355
  null;Ca=p.length>=2&&p[1]!=null;if(ja!=null)if(!D){if(ja!=null)switch(ja.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var J=null,M=ja.getElementsByTagName("*"),Q=0,U=M.length;Q<U;Q++){var X=M[Q].getAttribute("stroke-width");if(Q===0)J=X;else if(J!==X)J=null}a("#stroke_width").val(J===null?"":J);Oa.fill.update(true);Oa.stroke.update(true);break;default:Oa.fill.update(true);Oa.stroke.update(true);a("#stroke_width").val(ja.getAttribute("stroke-width")||1);a("#stroke_style").val(ja.getAttribute("stroke-dasharray")||
356
356
  "none");J=ja.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+J).length!=0&&B(a("#linejoin_"+J)[0]);J=ja.getAttribute("stroke-linecap")||"butt";a("#linecap_"+J).length!=0&&B(a("#linecap_"+J)[0])}if(ja!=null){J=(ja.getAttribute("opacity")||1)*100;a("#group_opacity").val(J);a("#opac_slider").slider("option","value",J);a("#elem_id").val(ja.id)}fb()}a("#path_node_panel").toggle(D);a("#tools_bottom_2,#tools_bottom_3").toggle(!D);if(D){a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");
357
357
  a("#tool_select").addClass("tool_button_current").removeClass("tool_button");t("#tool_select","select_node");Ca=false;if(p.length)ja=p[0]}else t("#tool_select","select");Na();l.runExtensions("selectedChanged",{elems:p,selectedElement:ja,multiselected:Ca})});l.bind("transition",function(g,p){var D=l.getMode(),J=p[0];if(J){Ca=p.length>=2&&p[1]!=null;if(!Ca)switch(D){case "rotate":D=l.getRotationAngle(J);a("#angle").val(D);a("#tool_reorient").toggleClass("disabled",D==0)}l.runExtensions("elementTransition",
358
- {elems:p})}});l.bind("changed",function(g,p){alert('a');var D=l.getMode();D==="select"&&hb();for(var J=0;J<p.length;++J){var M=p[J];if(M&&M.tagName==="svg"){$a();qb()}else if(M&&ja&&ja.parentNode==null)ja=M}s.show_save_warning=true;Na();if(ja&&D==="select"){Oa.fill.update();Oa.stroke.update()}l.runExtensions("elementChanged",{elems:p})});l.bind("saved",function(g,p){s.show_save_warning=false;p='<?xml version="1.0"?>\n'+p;var D=navigator.userAgent;if(~D.indexOf("Chrome")&&a.browser.version>=533||~D.indexOf("MSIE"))m(0,
358
+ {elems:p})}});l.bind("changed",function(g,p){var D=l.getMode();D==="select"&&hb();for(var J=0;J<p.length;++J){var M=p[J];if(M&&M.tagName==="svg"){$a();qb()}else if(M&&ja&&ja.parentNode==null)ja=M}s.show_save_warning=true;Na();if(ja&&D==="select"){Oa.fill.update();Oa.stroke.update()}l.runExtensions("elementChanged",{elems:p})});l.bind("saved",function(g,p){s.show_save_warning=false;p='<?xml version="1.0"?>\n'+p;var D=navigator.userAgent;if(~D.indexOf("Chrome")&&a.browser.version>=533||~D.indexOf("MSIE"))m(0,
359
359
  true);else{var J=g.open("data:image/svg+xml;base64,"+Ya.encode64(p)),M=a.pref("save_notice_done");if(M!=="all"){var Q=k.notification.saveFromBrowser.replace("%s","SVG");if(D.indexOf("Gecko/")!==-1)if(p.indexOf("<defs")!==-1){Q+="\n\n"+k.notification.defsFailOnSave;a.pref("save_notice_done","all");M="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");M!=="part"&&J.alert(Q)}}});l.bind("exported",function(g,p){var D=p.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");
360
360
  var J=a("#export_canvas")[0];J.width=l.contentW;J.height=l.contentH;canvg(J,p.svg,{renderCallback:function(){var M=J.toDataURL("image/png");ib.location.href=M;if(a.pref("export_notice_done")!=="all"){M=k.notification.saveFromBrowser.replace("%s","PNG");if(D.length)M+="\n\n"+k.notification.noteTheseIssues+"\n \u2022 "+D.join("\n \u2022 ");a.pref("export_notice_done","all");ib.alert(M)}}})});l.bind("zoomed",ra);l.bind("contextset",function(g,p){var D="";if(p){var J="";D='<a href="#" data-root="y">'+
361
361
  l.getCurrentDrawing().getCurrentLayerName()+"</a>";a(p).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){J+=" > "+this.id;D+=this!==p?' > <a href="#">'+this.id+"</a>":" > "+this.id}});ua=J}else ua=null;a("#cur_context_panel").toggle(!!p).html(D);q()});l.bind("extension_added",function(g,p){function D(){if(tb){clearTimeout(tb);tb=null}M||(tb=setTimeout(function(){M=true;H(e.iconsize)},50))}var J=false,M=false,Q=true,U=function(){if(p.callback&&!J&&Q){J=true;p.callback()}},X=[];
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sketchily
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -43,6 +43,22 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: nokogiri
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
46
62
  - !ruby/object:Gem::Dependency
47
63
  name: sqlite3
48
64
  requirement: !ruby/object:Gem::Requirement
@@ -106,6 +122,7 @@ files:
106
122
  - app/assets/javascripts/sketchily.js~
107
123
  - app/assets/javascripts/sketchily_embed.js
108
124
  - app/assets/javascripts/sketchily_embed.js~
125
+ - app/helpers/sketchily_helper.rb~
109
126
  - app/helpers/sketchily_helper.rb
110
127
  - app/views/sketchily/_sketchily.html.erb
111
128
  - app/views/sketchily/_embed.js.erb
@@ -232,6 +249,7 @@ files:
232
249
  - vendor/assets/svg-edit-2.6/svg-editor.css
233
250
  - vendor/assets/svg-edit-2.6/touch.js
234
251
  - vendor/assets/svg-edit-2.6/units.js
252
+ - vendor/assets/svg-edit-2.6/svgcanvas.js~
235
253
  - vendor/assets/svg-edit-2.6/svgedit.compiled.js
236
254
  - vendor/assets/svg-edit-2.6/contextmenu/jquery.contextMenu.js
237
255
  - vendor/assets/svg-edit-2.6/contextmenu.js
@@ -260,6 +278,7 @@ files:
260
278
  - vendor/assets/svg-edit-2.6/extensions/shapelib/object.json
261
279
  - vendor/assets/svg-edit-2.6/extensions/shapelib/raphael.txt
262
280
  - vendor/assets/svg-edit-2.6/extensions/shapelib/flowchart.json
281
+ - vendor/assets/svg-edit-2.6/extensions/ext-imagelib.js~
263
282
  - vendor/assets/svg-edit-2.6/extensions/ext-grid.js
264
283
  - vendor/assets/svg-edit-2.6/extensions/markers-icons.xml
265
284
  - vendor/assets/svg-edit-2.6/extensions/foreignobject-icons.xml