/*globals $, EmbeddedSVGEdit*/ /*jslint vars: true */ var initEmbed; // Todo: Get rid of frame.contentWindow dependencies so can be more easily adjusted to work cross-domain $(function () {'use strict'; var svgCanvas = null; var frame; initEmbed = function () { var doc, mainButton; svgCanvas = new EmbeddedSVGEdit(frame); // Hide main button, as we will be controlling new, load, save, etc. from the host document doc = frame.contentDocument || frame.contentWindow.document; mainButton = doc.getElementById('main_button'); mainButton.style.display = 'none'; }; function handleSvgData(data, error) { if (error) { alert('error ' + error); } else { alert('Congratulations. Your SVG string is back in the host page, do with it what you will\n\n' + data); } } function loadSvg() { var svgexample = ''; svgCanvas.setSvgString(svgexample); } function saveSvg() { svgCanvas.getSvgString()(handleSvgData); } function exportPNG() { var str = frame.contentWindow.svgEditor.uiStrings.notification.loadingImage; var exportWindow = window.open( 'data:text/html;charset=utf-8,' + encodeURIComponent('