Sha256: 4f44e96264bd9689604fe4b81e1053f1b47ec830fed45fb1d5c5425b68be342d
Contents?: true
Size: 1.74 KB
Versions: 1
Compression:
Stored size: 1.74 KB
Contents
<% # This partial requires svgutils.js # # Clients of this partial must supply the following variables: # id # value # hide_menu # hide_image_tool # hide_hyperlink_tool %> var svgCanvas_<%= id %> = null; function attachSubmitHandler_<%= id %>() { $("input#<%= id %>").closest("form").one("submit", function(event) { svgCanvas_<%= id %>.getSvgString()(handleSvgData_<%= id %>); return false; }); } function handleSvgData_<%= id %>(data, error) { if (error) { alert('Error: ' + error); } else { $("input#<%= id %>").attr("value", svgedit.utilities.encode64("<?xml version=\"1.0\"?>\n" + data)); $("input#<%= id %>").closest("form").trigger("submit.rails"); attachSubmitHandler_<%= id %>(); } } function changef(window, elems) { alert('changed'); }); function initEmbed_<%= id %>() { var frame = document.getElementById('svgedit_<%= id %>'); svgCanvas_<%= id %> = new embedded_svg_edit(frame); var doc; doc = frame.contentDocument; if (!doc) { doc = frame.contentWindow.document; } <% if hide_menu %> var mainButton = doc.getElementById('main_button'); mainButton.parentNode.removeChild(mainButton); var toolsTop = doc.getElementById('tools_top'); toolsTop.style.left = '5px'; <% end %> <% if hide_image_tool %> var imageTool = doc.getElementById('tool_image'); imageTool.parentNode.removeChild(imageTool); <% end %> <% if hide_hyperlink_tool %> var hyperlinkTool = doc.getElementById('tool_make_link'); hyperlinkTool.parentNode.removeChild(hyperlinkTool); <% end %> attachSubmitHandler_<%= id %>(); svgCanvas_<%= id %>.bind("changed", changef)(); svgCanvas_<%= id %>.setSvgString(svgedit.utilities.decode64("<%= value.try(:squish) %>")); }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sketchily-1.0.1 | app/views/sketchily/_embed.js.erb~ |